Writing agent instructions is like creating a Standard Operating Procedure (SOP) for an employee. Just as SOPs provide clear, repeatable instructions for human workers, agent instructions should be precise, actionable, and comprehensive.
When crafting agent instructions, think of yourself as a manager writing detailed procedures that any employee could follow:
Be specific: Like an SOP, leave no room for ambiguity
Include all context: Provide all necessary information upfront
Define success criteria: Clearly state what “done” looks like
Handle edge cases: Anticipate and document how to handle exceptions
Think of agents as specialized employees you delegate work to. Once you hand off a task with clear instructions, they work autonomously until completion—just like delegating to a trusted team member.
This delegation model means:
Set and forget: Give clear instructions and let the agent work independently
No micromanagement: The agent handles the task from start to finish
Clear handoff: Define input requirements and expected outputs
Trust the process: Like a well-trained employee, the agent follows your SOPs
Just as employees communicate and hand off work through tools like Slack and Notion, agents should use MCP servers and external integrations to report progress and deliver results.
Agents communicate through:
Status updates: Use Slack MCP to send progress notifications
Documentation: Update Notion databases with results
Handoffs: Save artifacts to shared filesystems for other agents
Reporting: Post summaries to webhooks or APIs
This approach mirrors how remote teams collaborate—asynchronously through shared tools rather than constant direct interaction.
Complex tasks can be decomposed into specialized agents that work together through sub-agent composition. This mirrors how organizations structure teams—each specialist handles their domain, communicating through established channels.
---model: anthropic:claude-haiku-4-5mcpServers: filesystem: command: "pnpx" args: ["-y", "@modelcontextprotocol/server-filesystem", "./research"]---You are a research specialist. Find and save relevant information.## Task1. Research the given topic thoroughly2. Save findings to research folder3. Return key insights summary
2
Writer Agent
Creates content based on research
writer.agentuse
Copy
---model: anthropic:claude-sonnet-4-5---You are a content writer. Create engaging, accurate content.## Task1. Review provided research2. Create well-structured content3. Ensure factual accuracy
3
Orchestrator Agent
Coordinates the workflow
orchestrator.agentuse
Copy
---model: anthropic:claude-sonnet-4-5subagents: - path: ./research.agentuse maxSteps: 50 - path: ./writer.agentuse maxSteps: 100---You coordinate content creation workflow.## Task1. Use research agent to gather information2. Pass findings to writer agent3. Review and finalize output
Since AgentUse agents are stateless between runs, use MCP servers to manage state:
Copy
---model: anthropic:claude-sonnet-4-5mcpServers: notion: command: "pnpx" args: ["-y", "@modelcontextprotocol/server-notion"] requiredEnvVars: ["NOTION_TOKEN"]---You track workflow state in Notion.## Task1. Check current state in Notion database2. Process next pending item3. Update state after completion
Build resilient agents with proper error handling:
robust-agent.agentuse
Copy
---model: anthropic:claude-sonnet-4-5subagents: - path: ./validator.agentuse - path: ./processor.agentuse - path: ./error-handler.agentuse---You execute tasks with comprehensive error handling.## Error Handling Strategy1. Validate input with validator agent2. If validation fails, use error-handler to log and notify3. Process with processor agent4. If processing fails, use error-handler for recovery5. Always provide clear status at completion
Process data through a sequential pipeline where each agent handles a specific transformation step:
chain-pipeline.agentuse
Copy
---model: anthropic:claude-sonnet-4-5subagents: - path: ./validator.agentuse - path: ./transformer.agentuse - path: ./publisher.agentuse---You coordinate a data processing pipeline.## Processing Pipeline1. Use validator agent to validate input data2. Pass validated data to transformer agent for processing3. Send transformed data to publisher agent for final output4. Return confirmation once all steps complete successfully
Route requests to different handlers based on complexity or type:
conditional-router.agentuse
Copy
---model: anthropic:claude-sonnet-4-5subagents: - path: ./simple-handler.agentuse - path: ./complex-handler.agentuse---You route requests to appropriate handlers based on complexity.## Routing Strategy1. Analyze the incoming request complexity2. For simple requests (< 3 steps), use simple-handler agent3. For complex requests (>= 3 steps), use complex-handler agent4. Return the handler's response with routing decision details
Implement resilient processing with automatic fallback on failures:
retry-fallback.agentuse
Copy
---model: anthropic:claude-sonnet-4-5subagents: - path: ./primary-agent.agentuse - path: ./fallback-agent.agentuse---You ensure task completion through retry and fallback mechanisms.## Execution Strategy1. Attempt task with primary-agent first2. If primary-agent succeeds, return its results3. If primary-agent fails or times out, use fallback-agent4. Log which path was taken and why5. Always provide task results, regardless of path taken