Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
A comprehensive collection of Agent Skills for context engineering, multi-agent architectures, and production agent systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
examples/llm-as-judge-skills/agents/orchestrator-agent/orchestrator-agent.md
1# Orchestrator Agent23## Purpose45The Orchestrator Agent manages complex workflows by delegating tasks to specialized agents, coordinating their outputs, and ensuring coherent end-to-end execution. It serves as the primary interface for multi-agent operations.67## Agent Definition89```typescript10import { ToolLoopAgent } from "ai";11import { anthropic } from "@ai-sdk/anthropic";12import { orchestrationTools } from "../tools";1314export const orchestratorAgent = new ToolLoopAgent({15name: "orchestrator",16model: anthropic("claude-sonnet-4-20250514"),17instructions: `You are a workflow orchestration expert.1819Your role is to:201. Analyze complex tasks and break them into subtasks212. Assign subtasks to appropriate specialized agents223. Coordinate agent outputs and handle dependencies234. Synthesize results into coherent final outputs245. Handle errors and retries gracefully2526Orchestration Principles:27- Decompose tasks by capability requirements28- Parallelize independent operations when possible29- Maintain context continuity across agent handoffs30- Validate intermediate outputs before proceeding31- Provide clear status updates during long operations3233Available Agents:34- evaluator: Assesses quality of LLM outputs35- researcher: Gathers and synthesizes information36- writer: Generates and refines content37- analyst: Performs data analysis and insights3839When delegating:40- Provide complete context the agent needs41- Specify expected output format42- Set clear success criteria`,4344tools: {45delegateToAgent: orchestrationTools.delegateToAgent,46parallelExecution: orchestrationTools.parallelExecution,47waitForCompletion: orchestrationTools.waitForCompletion,48synthesizeResults: orchestrationTools.synthesizeResults,49handleError: orchestrationTools.handleError50}51});52```5354## Capabilities5556### Task Delegation57Route a task to a specialized agent.5859**Input:**60- Agent name61- Task description62- Context/dependencies63- Expected output format6465**Output:**66- Agent response67- Execution metadata68- Status6970### Parallel Execution71Execute multiple independent tasks simultaneously.7273**Input:**74- List of (agent, task) pairs75- Timeout configuration7677**Output:**78- Results array79- Completion status per task80- Any errors encountered8182### Result Synthesis83Combine outputs from multiple agents into coherent result.8485**Input:**86- Agent outputs87- Synthesis instructions88- Target format8990**Output:**91- Synthesized result92- Source attribution93- Confidence assessment9495### Error Handling96Manage failures and implement retry logic.9798**Input:**99- Failed task100- Error details101- Retry policy102103**Output:**104- Retry result or105- Graceful degradation or106- Error escalation107108## Configuration109110```typescript111interface OrchestratorConfig {112// Execution settings113maxParallelTasks: number;114defaultTimeout: number; // ms115retryPolicy: RetryPolicy;116117// Quality settings118validateIntermediateOutputs: boolean;119evaluateBeforeDelivery: boolean;120121// Reporting122enableProgressUpdates: boolean;123updateFrequency: number; // ms124}125126interface RetryPolicy {127maxRetries: number;128backoffMultiplier: number;129retryableErrors: string[];130}131132const defaultConfig: OrchestratorConfig = {133maxParallelTasks: 5,134defaultTimeout: 60000,135retryPolicy: {136maxRetries: 3,137backoffMultiplier: 2,138retryableErrors: ["RATE_LIMIT", "TIMEOUT", "TEMPORARY_ERROR"]139},140validateIntermediateOutputs: true,141evaluateBeforeDelivery: false,142enableProgressUpdates: true,143updateFrequency: 5000144};145```146147## Usage Example148149```typescript150import { orchestratorAgent } from "./agents/orchestrator-agent";151152const result = await orchestratorAgent.generate({153prompt: `Complete the following research and analysis task:1541551. Research current best practices for LLM evaluation1562. Analyze the trade-offs between different evaluation methods1573. Generate a recommendation report1584. Evaluate the quality of the report159160Ensure the final output is comprehensive but accessible to technical leaders.`161});162```163164## Orchestration Patterns165166### Sequential Pipeline167```mermaid168graph LR169A[Task] --> B[Research Agent]170B --> C[Analyst Agent]171C --> D[Writer Agent]172D --> E[Evaluator Agent]173E --> F[Final Output]174```175176### Parallel with Aggregation177```mermaid178graph TD179A[Task] --> B[Parallel Dispatch]180B --> C[Agent 1]181B --> D[Agent 2]182B --> E[Agent 3]183C --> F[Aggregation]184D --> F185E --> F186F --> G[Synthesis]187```188189### Iterative Refinement190```mermaid191graph TD192A[Draft] --> B[Evaluator]193B --> C{Score OK?}194C -->|No| D[Refine]195D --> A196C -->|Yes| E[Final Output]197```198199## Integration Points200201- **API Gateway**: Primary entry point for complex requests202- **Job Queue**: Handle long-running orchestrated tasks203- **Monitoring**: Track multi-agent execution metrics204- **Audit Log**: Record all delegations and decisions205206