Skip to content

optimize agent-performance-analyzer with inline sub-agents#29843

Merged
pelikhan merged 2 commits intomainfrom
copilot/optimize-agent-performance-analyzer
May 3, 2026
Merged

optimize agent-performance-analyzer with inline sub-agents#29843
pelikhan merged 2 commits intomainfrom
copilot/optimize-agent-performance-analyzer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 2, 2026

agent-performance-analyzer handles all data extraction/classification with the main model despite having distinct phases ideal for delegation. Phase 1 (memory reads) and Phase 3 (pattern classification) are pure extraction tasks with no deep reasoning requirements — ~196K avg tokens/run with 0–20 turn execution drift.

Changes

  • Frontmatter: adds inline-agents: true to features
  • Phase 1: delegates all repo-memory file reads to new metrics-extractor sub-agent (haiku); sub-agent reads all shared memory paths and returns a single structured JSON object, eliminating repeated file-read turns by the main model
  • Phase 3: delegates behavioral pattern classification to new pattern-detector sub-agent (haiku); receives agent profiles JSON, returns a per-agent map of detected patterns (over-creation, under-creation, repetition, scope-creep, inconsistency)

New sub-agents

## agent: `metrics-extractor`
---
model: claude-haiku-4.5
description: Reads shared repo-memory metric files and returns structured JSON with all relevant performance data
---

## agent: `pattern-detector`
---
model: claude-haiku-4.5
description: Classifies agent behavioral patterns from profiles and returns a structured categorization of issues found
---

Expected: ~15–20% token reduction per run, more consistent turn counts in Phase 1, faster Phase 1 + Phase 3 execution.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw github.com/githudiff -lang=go1.25 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/bin/go go EnableCommentTool=true;EnablePlanTool=true] -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv lyzer.md -trimpath 64/bin/go -d internal/fuzz -lang=go1.25 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go env ithub/workflows GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/download-artifact/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv 69910c48:.github/workflows/smoke-pi.md GO111MODULE $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/node/24.14.1/x64/bin/git GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/download-artifact/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv 69910c48:.github/workflows/agent-performance-analyzer.lock.yml GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE tnet/tools/git GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv ." (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv cli/install.sh..." (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv lyzer.md -trimpath 64/bin/go -p github.com/pmezaadd -lang=go1.16 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv ithub/workflows GO111MODULE rgo/bin/git GOINSECURE GOMOD GOMODCACHE go env 97e5dab3ea8812f769910c48:.github-f GO111MODULE r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv -crush.lock.yml GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv -crush.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE ndor/bin/git GOINSECURE GOMOD GOMODCACHE go env 69910c48:.github-f GO111MODULE ache/go/1.25.8/x-f GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 69910c48 GOINSECURE GOMOD GOMODCACHE go env 69910c48:.github/workflows/smoke-f GO111MODULE r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env def6316056a12d4907a9d4d84ff7a3b GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 69910c48 GOINSECURE GOMOD GOMODCACHE go env 69910c48:.github/workflows/smoke-pi.md GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch ithub/workflows GO111MODULE t elete GOMOD 97e5dab3ea8812f7/home/REDACTED/work/gh-aw/gh-aw go env 97e5dab3ea8812f769910c48:.github/workflows/agent-performance-analyzer.md GO111MODULE rostylelite-markdown-spellcheck.lock.yml GOINSECURE GOMOD GOMODCACHE go (http block)

If you need me to access, download, or install something from one of these locations, you can either:

- Add `inline-agents: true` to features frontmatter
- Add `metrics-extractor` sub-agent (claude-haiku-4.5) for Phase 1 memory reads
- Add `pattern-detector` sub-agent (claude-haiku-4.5) for Phase 3 pattern classification
- Recompile lock file

Closes #<issue>"

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/99053b03-badd-47aa-a744-52e42876615a

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize agent-performance-analyzer with inline sub-agents optimize agent-performance-analyzer with inline sub-agents May 2, 2026
Copilot AI requested a review from pelikhan May 2, 2026 23:59
@pelikhan pelikhan marked this pull request as ready for review May 3, 2026 00:03
Copilot AI review requested due to automatic review settings May 3, 2026 00:03
@pelikhan pelikhan merged commit 0629770 into main May 3, 2026
18 of 20 checks passed
@pelikhan pelikhan deleted the copilot/optimize-agent-performance-analyzer branch May 3, 2026 00:03
@github-actions github-actions Bot mentioned this pull request May 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors agent-performance-analyzer to use inline sub-agents for two prompt phases: repo-memory metrics extraction and behavioral pattern classification, with the goal of reducing token usage and stabilizing execution flow.

Changes:

  • Enables the inline-agents feature for the workflow.
  • Replaces Phase 1’s manual shared-memory read instructions with a metrics-extractor sub-agent.
  • Replaces Phase 3’s in-prompt pattern detection instructions with a pattern-detector sub-agent and regenerates the compiled lock file accordingly.
Show a summary per file
File Description
.github/workflows/agent-performance-analyzer.md Adds inline-agent support, updates Phase 1 and Phase 3 instructions to delegate work to new sub-agents, and defines the new metrics-extractor and pattern-detector agent blocks.
.github/workflows/agent-performance-analyzer.lock.yml Regenerates the compiled workflow to upload and restore inline sub-agent artifacts and refreshes generated prompt/config identifiers.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment on lines +595 to +598
You are a metrics extraction assistant. When given a newline-separated list of file paths (one path per line), read each file using bash and return a single JSON object containing all data found.

For JSON files, parse and include the full content under a key matching the file's basename (without extension). For a directory path, list and read all files within it, using their basenames as keys. For markdown files, include the raw text under a key matching the filename.

Comment on lines +307 to +311
Use the `pattern-detector` sub-agent to classify agent behavioral patterns from the profiles you built in Phase 1. Pass the agent profiles as an inline JSON object. It will return a structured classification of:
- Over/under-creation patterns
- Repetition or duplication
- Scope creep instances
- Inconsistent behavior flags
Comment on lines +307 to +311
Use the `pattern-detector` sub-agent to classify agent behavioral patterns from the profiles you built in Phase 1. Pass the agent profiles as an inline JSON object. It will return a structured classification of:
- Over/under-creation patterns
- Repetition or duplication
- Scope creep instances
- Inconsistent behavior flags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[q] optimize agent-performance-analyzer with inline sub-agents

3 participants