Agent Research — April 2026

Research into agent architecture for the pilot: how to build the agent host, what tools are needed, how Claude Code works under the hood.

Claude Code Architecture

Claude Code's agency is NOT model fine-tuning. It is:

Anthropic API Tool Call Format

Proprietary format, NOT MCP. Clean and structured.

Request — tool definitions:

{
  "name": "get_weather",
  "description": "Get current weather",
  "input_schema": {
    "type": "object",
    "properties": { "location": { "type": "string" } },
    "required": ["location"]
  }
}

Response — tool call:

{
  "stop_reason": "tool_use",
  "content": [
    { "type": "text", "text": "Let me check." },
    {
      "type": "tool_use",
      "id": "toolu_01A09q90qw90lq917835lq9",
      "name": "get_weather",
      "input": { "location": "San Francisco, CA" }
    }
  ]
}

Sending result back (in user message):

{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01A09q90qw90lq917835lq9",
      "content": "68F, partly cloudy"
    }
  ]
}

MCP bridge: MCP uses inputSchema (camelCase), Anthropic uses input_schema (snake_case). MCP uses arguments, Anthropic uses input. Minor field renaming to bridge. Anthropic also has a beta MCP connector for server-side bridging.

Claude Code — Complete Tool Reference

File Operations

Execution

Web

Agent / Sub-agents

Task Management

Planning

User Interaction

Tool Discovery

Skills

Worktrees

IDE-specific

MCP Resources

Computer Use

Total: ~24 built-in tools + unlimited via MCP servers.

Claude Code Lifecycle Hooks

25 lifecycle events. Key ones:

Event Data Can Control
UserPromptSubmit full prompt text inject context
PreToolUse tool name, full args, tool_use_id block, modify, allow, escalate
PostToolUse tool name, args, full result inject context, block further
PostToolUseFailure same as PostToolUse same
Stop stop_hook_active (no response text!)
SessionStart/End source, model
SubagentStart/Stop agent_id, transcript_path

Gap: Stop event does not include Claude's response text. Must read from JSONL transcript file.

Hook types: command (shell), http (POST), prompt (LLM eval), agent (multi-turn subagent).

Agent SDK

The Claude Agent SDK packages the Claude Code loop as an embeddable library (TypeScript and Python):

Open Source Agent Frameworks

Best fit for OpenLight (thinnest, don't own state)

Moderate fit (some opinions, configurable)

Poor fit (own too much)

WebSearch — Server-Side, Zero Implementation

WebSearch is a built-in server-side capability of the Anthropic Messages API. Not a tool you implement — you add {"type": "web_search_20250305", "name": "web_search"} to the tools array and the API handles everything.

No implementation needed for the pilot. Just include it in the tool definitions.

Brave Search is a separate, unrelated option available via MCP. Free tier: 2k queries/month. Useful as a fallback or for vendor independence.

VM Containment

Lightweight Linux VM — not Docker, not process-level sandboxing. Docker and sandbox-runtime (srt) share the host kernel — container escapes are real. For running AI agents with tool execution on a machine with sensitive data, hardware-level isolation with a separate kernel is required.

The decision: OrbStack or Lima on macOS (Apple Virtualization.framework), Firecracker on Linux. Real VMs, separate kernels, hardware isolation.

Researched alternatives (rejected):

CLI Tools and the Anthropic API

CLI tools (executables receiving JSON on stdin) map cleanly to the Anthropic tool format:

No MCP overhead needed for our own tools. MCP is useful for consuming external tool servers but not required.

Resolved Questions

Decisions Made