Overview
This example demonstrates the agentic capabilities of Claude Code CLI by having it search through the codebase to find and explain validation examples. TheAgentCtrlConsoleLogger provides full visibility into tool calls, streaming,
and the agent’s decision-making process.
Key concepts:
AgentCtrl::claudeCode(): Factory for Claude Code agent builderwithMaxTurns(): Allow multiple turns for explorationonText()/onToolUse(): Real-time streaming callbacksAgentCtrlConsoleLogger: Shows execution lifecycle alongside streaming output
Example
Expected Output
Key Points
- Agentic search: Agent autonomously explores files and synthesizes answers
- Full visibility: Console logger shows every tool call alongside streaming output
- Sandbox awareness: Enable
showSandboxto see sandbox initialization details - Multi-turn:
withMaxTurns(10)allows the agent to explore iteratively