Skip to content

Claude Code Agent

The Claude Code agent delegates your queries to Anthropic's Claude Code CLI, a locally installed tool that can read files, execute commands, and reason about infrastructure with full tool use capabilities.

Prerequisites

Install the Claude Code CLI:

bash
npm install -g @anthropic-ai/claude-code

Verify the installation:

bash
claude --version

You also need a valid Anthropic API key or an active Claude Code subscription configured in your environment.

Usage

Single-Shot Queries

bash
clanker ask --agent claude-code "list my running EC2 instances"

Interactive Conversations

bash
clanker talk --agent claude-code

This starts a REPL session where Claude Code maintains context across turns:

$ clanker talk --agent claude-code
Claude Code Agent (interactive mode)
Type 'exit' or 'quit' to end the session.

you> What EC2 instances are running?
claude-code> [lists instances with details]

you> Which one has the highest CPU usage?
claude-code> [answers based on previous context]

With AWS Context

When you have an AWS profile configured in ~/.clanker.yaml, Clanker automatically gathers infrastructure context and injects it into the prompt. This means Claude Code can reason about your live AWS environment without needing direct AWS SDK access.

bash
clanker ask --agent claude-code --aws "analyze my security groups for overly permissive rules"

Debug Mode

Enable debug output to see process lifecycle, tool calls, thinking steps, and cost information:

bash
clanker ask --agent claude-code --debug "describe my infrastructure"

Debug output includes:

  • Claude Code CLI version
  • AWS context gathering progress
  • Tool calls (file reads, command execution)
  • Thinking/reasoning steps
  • Response duration and API cost

How It Works

When you use --agent claude-code, Clanker:

  1. Checks availability by running claude --version. If the binary is not found, it returns an error with installation instructions.
  2. Gathers AWS context (if an AWS profile is configured) by querying your live infrastructure and building a context string.
  3. Launches the Claude CLI with --output-format stream-json for streaming responses.
  4. Parses streaming events including text chunks, tool calls, thinking blocks, and the final result.
  5. Displays the response with real-time streaming output.

For interactive talk mode, Clanker launches Claude Code with --input-format stream-json and --output-format stream-json, keeping the process alive across multiple turns.

Configuration

The Claude Code agent uses whatever authentication is configured for the claude CLI itself. Clanker does not pass API keys to Claude Code since it manages its own authentication.

You can configure the model used by Claude Code through the claude CLI's own settings. Refer to the Claude Code documentation for details.

Comparison with Other Agents

FeatureClaude CodeHermes
Tool use (file read/write, commands)Yes (native)Yes (via bridge)
Multi-turn conversationsYesYes
AWS context injectionYesYes
Code analysisExcellentGood
Infrastructure queriesGoodGood
Setup complexitynpm install -gmake setup-hermes
Underlying modelClaude (Anthropic)Configurable (OpenAI, Anthropic, etc.)

Troubleshooting

"claude CLI not found in PATH"

Install Claude Code:

bash
npm install -g @anthropic-ai/claude-code

Then verify:

bash
claude --version

Authentication errors

Claude Code manages its own authentication. Run claude interactively to complete the login flow before using it as a Clanker agent.

Slow responses

Claude Code with --verbose and --output-format stream-json may include tool execution time. Use --debug to see where time is being spent.

See Also