| Value | Meaning | Action |
|---|---|---|
| tool_use | Claude wants to call a tool | Execute the tool, append result, continue loop |
| end_turn | Claude is finished | Exit the loop, return final response |
| max_tokens | Output was truncated | Handle continuation or increase max_tokens |
| stop_sequence | Custom stop sequence hit | Handle based on application logic |
| refusal | Model refused the request | Handle gracefully, adjust prompt |
| pause_turn | Server-side tool pause | Wait for server tool completion |
Select subagents based on query complexity — don't always route through the full pipeline.
Assign distinct subtopics or source types to minimize duplication across subagents.
Coordinator evaluates synthesis → re-delegates for gaps → re-invokes synthesis loop.
Mechanism for spawning subagents. allowedTools must include "Task" for the coordinator.
| Approach | Description | Use Case |
|---|---|---|
| Input validation | Validate tool inputs before execution | Prevent malformed API calls |
| Output classification | Use a second Claude call to classify outputs | Detect harmful or off-topic responses |
| Tool restrictions | Limit available tools per agent/phase | Reduce attack surface in production |
| Human-in-the-loop | Require approval for high-impact actions | Financial transactions, data deletion |
| Conversation limits | Cap total iterations or token spend | Prevent runaway agents |