Overview
ClaudeCodeAgent integrates the Claude Code CLI with the Definable framework. Claude Code is an agent with its own LLM loop, file operations, and code execution. ClaudeCodeAgent communicates with the CLI via subprocess + JSONL protocol and layers Definable features on top: memory, knowledge/RAG, custom tools, guardrails, middleware, tracing, and structured output.
No external SDK dependency — the transport layer is built-in.
Quick Start
Requires Claude Code CLI installed:
npm install -g @anthropic-ai/claude-codePrerequisites
- Install the Claude Code CLI:
npm install -g @anthropic-ai/claude-code - Authenticate:
claude auth - Install Definable:
pip install definable
Configuration
Claude Code Settings
Definable Features
All standard Definable features work withClaudeCodeAgent:
Custom Tools
Define tools with the@tool decorator. They’re automatically registered as MCP tools and called by Claude Code when needed:
Guardrails
Tool Guardrails
Tool guardrails intercept Claude Code’s tool calls via the control protocol. When the CLI requests permission to use a tool, your guardrails can allow or deny:Input/Output Guardrails
Input guardrails run before the CLI is called. Output guardrails run after:Multi-Turn Sessions
Usesession_id to continue conversations:
continue_conversation=True:
RunOutput
ClaudeCodeAgent.arun() returns the same RunOutput type as Agent.arun():