| name | agent-chain-configure |
| description | Orchestrate builder, reviewer, and tuner agent handoffs for solution plays โ define roles, model routing, token budgets, and quality gates |
Agent Chain Configure
Configure the builderโreviewerโtuner agent triad for a solution play. This skill covers role definitions, model assignment, handoff protocol, token budgets, evaluation gates, and the .agent.md files that wire it all together.
Agent Roles
The chain has three stages, each with a distinct responsibility and model:
| Role | Purpose | Model | Token Budget |
|---|
| Builder | Implement the solution โ write code, create infrastructure, generate config | gpt-4o | 60% of total |
| Reviewer | Audit the builder's output โ security, WAF compliance, code quality | gpt-4o-mini | 25% of total |
| Tuner | Validate production readiness โ config values, eval thresholds, guardrails | gpt-4o-mini | 15% of total |
Builder gets gpt-4o because implementation requires deep reasoning and long-context code generation. Reviewer and tuner use gpt-4o-mini because their tasks are checklist-driven and cost-sensitive.
Builder Agent Definition
---
description: "Implements the solution โ code, infra, config, tests"
model: ["gpt-4o", "gpt-4o-mini"]
tools: ["codebase", "terminal", "github"]
waf: ["reliability", "security", "performance-efficiency"]
---
You are the builder agent for this solution play. Your job is to implement,
not to review or tune.
- Write application code following SDK best practices
- Create Bicep infrastructure files using AVM modules
- Generate config/*.json with sensible defaults
- Write unit and integration tests
- Create evaluation datasets if the play involves AI
- Never skip error handling โ every external call needs retry + timeout
- Use Managed Identity for all Azure service auth โ no connection strings
- Keep files under 300 lines โ split into modules when needed
- Run `npm run validate:primitives` before handing off
When implementation is complete, hand off to @reviewer with:
- List of files created/modified
- Any assumptions made about config values
- Known gaps or TODOs
Reviewer Agent Definition
---
description: "Audits builder output for security, WAF compliance, and quality"
model: ["gpt-4o-mini", "gpt-4o"]
tools: ["codebase"]
waf: ["security", "operational-excellence", "responsible-ai"]
---
You audit the builder's output. You do not write new features.
1. **Security** โ No hardcoded secrets, Managed Identity used, RBAC scoped
2. **OWASP LLM Top 10** โ Prompt injection defense, output validation
3. **WAF Alignment** โ Each file maps to at least one WAF pillar
4. **Error Handling** โ Retry with exponential backoff, circuit breaker present
5. **Config Compliance** โ Values in config/*.json match TuneKit ranges
6. **Test Coverage** โ Unit tests exist for core logic, integration tests for APIs
Produce a structured review with pass/fail per category:
- PASS items: confirm with one-line evidence
- FAIL items: cite the file and line, describe the fix
- WARN items: acceptable but flag for tuner attention
When review is complete, hand off to @tuner with:
- Review summary (pass/fail/warn counts)
- List of FAIL items requiring config or threshold changes
Tuner Agent Definition
---
description: "Validates production readiness โ config, thresholds, guardrails"
model: ["gpt-4o-mini", "gpt-4o"]
tools: ["codebase"]
waf: ["cost-optimization", "responsible-ai", "reliability"]
---
You validate that config values and evaluation thresholds are production-ready.
You do not write features or perform code review.
1. **openai.json** โ temperature โค0.3 for deterministic, max_tokens right-sized
2. **guardrails.json** โ groundedness โฅ0.85, relevance โฅ0.80, safety โฅ0.95
3. **Token Budgets** โ Total budget fits deployment tier (S0=80K TPM, S1=240K TPM)
4. **Model Selection** โ Correct model for workload (GPT-4o vs GPT-4o-mini)
5. **Cost Projection** โ Estimated monthly cost within acceptable range
6. **Evaluation Pipeline** โ eval/ folder has datasets, metrics, and pass thresholds
Produce a TuneKit validation report:
- Config files checked with current vs recommended values
- Evaluation metrics with pass/fail against thresholds
- Cost estimate at dev and prod scale
Handoff Protocol
Each handoff passes a structured JSON payload so the next agent has full context:
{
"handoff": {
"from": "builder",
"to": "reviewer",
"play": "01-enterprise-rag",
"task": "Review the RAG pipeline implementation",
"context": {
"files_changed": ["src/rag.py", "infra/main.bicep", "config/openai.json"],
"assumptions": ["Using text-embedding-3-small for cost reasons"],
"known_gaps": ["No load test yet"]
},
"token_budget_remaining": 25000,
"evaluation_gate": {
"required_pass_rate": 0.8,
"blocking_categories": ["security", "config-compliance"]
}
}
}
Pre-Filled Prompt Templates
Use these at each handoff point in Copilot Chat:
Builder โ Reviewer:
@reviewer Review the implementation in this play. Check security (no secrets,
Managed Identity, RBAC), WAF alignment, error handling, and test coverage.
Files changed: [list]. Flag any FAIL items with file:line references.
Reviewer โ Tuner:
@tuner Validate production readiness. Review passed with [N] warnings.
Check config/openai.json values, guardrails.json thresholds, token budgets,
and evaluation pipeline. Confirm cost estimate is within range.
FAIL items from review: [list or "none"].
Tuner โ Complete:
@workspace Tuning complete. Play is production-ready.
Config validated, eval thresholds pass, cost estimate: $X/month at prod scale.
Remaining action items: [list or "none"].
VS Code @-Mention Routing
In Copilot Chat, reference agents with @agent-name:
@builder โ routes to .github/agents/builder.agent.md
@reviewer โ routes to .github/agents/reviewer.agent.md
@tuner โ routes to .github/agents/tuner.agent.md
The agent names in @-mentions must match the filename stem. If the file is builder.agent.md, the mention is @builder. Copilot discovers agents automatically from .github/agents/.
Token Budget Splitting
For a play with a 100K token budget:
| Stage | Allocation | Use |
|---|
| Builder | 60K | Code generation, infra, tests |
| Reviewer | 25K | Audit pass with citations |
| Tuner | 15K | Config validation, cost calc |
If the builder uses less than its allocation, the surplus rolls to the reviewer. The tuner's budget is fixed โ tuning should be concise.
Track budget in fai-manifest.json:
{
"toolkit": {
"tunekit": {
"token_budget": {
"total": 100000,
"builder": 60000,
"reviewer": 25000,
"tuner": 15000
}
}
}
}
Evaluation Gates Between Stages
Each handoff has a gate. If the gate fails, the chain loops back:
| Gate | Trigger | Action on Fail |
|---|
| Builder โ Reviewer | Builder marks complete | Return to builder with FAIL list |
| Reviewer โ Tuner | Review pass rate โฅ80% | Return to builder for fixes |
| Tuner โ Done | All thresholds pass | Return to reviewer if config change needed |
A chain should complete in 1-2 loops. If it loops 3+ times, escalate to a human.
Wiring in fai-manifest.json
Register the agent chain in the play manifest:
{
"primitives": {
"agents": [
"./.github/agents/builder.agent.md",
"./.github/agents/reviewer.agent.md",
"./.github/agents/tuner.agent.md"
]
}
}
Common Mistakes
| Mistake | Fix |
|---|
| Using gpt-4o for all three roles | Reviewer and tuner are checklist tasks โ use gpt-4o-mini |
| No handoff context | Always pass files_changed + assumptions in handoff JSON |
| Skipping the tuner | Config validation catches 40% of prod incidents โ never skip |
| Equal token splits | Builder needs 60% โ code generation is token-heavy |
| Missing evaluation gate | Without gates, bad output propagates to production |