Unified Python library and CLI for orchestrating coding agents (Claude Code, Codex, etc.) with MCP tool servers and credential management.
Project description
caw: Coding Agent Wrapper
Docs · Quickstart · Examples
caw (Coding Agent Wrapper) wraps multiple coding-agent CLIs — Claude Code, Codex, and opencode — behind a single Agent / Session API. Swap providers without changing your code, attach MCP tool servers, capture structured trajectories, and manage credentials for Docker containers. caw aims at the common cases with a small, ergonomic API — if you need fine-grained control over agent behavior, reach for the underlying agent SDKs; caw isn't trying to replace them.
Install
caw is on PyPI as coding-agent-wrapper. The recommended path is uv:
uv add coding-agent-wrapper # use as a library in a uv-managed project
uv tool install coding-agent-wrapper # install just the CLI (caw, caw-traj) globally
Plain pip works too:
pip install coding-agent-wrapper
Requires Python 3.10+. You also need at least one provider CLI installed and authenticated (claude, codex, or opencode) — run caw doctor to see what caw can find.
For local development:
uv sync --extra dev
Quick start
from caw import Agent
agent = Agent() # defaults to claude_code
traj = agent.completion("Explain what this repository does")
print(traj.result)
print(f"{traj.usage.total_tokens} tokens, ${traj.usage.cost_usd:.4f}")
Multi-turn session
agent = Agent(model="claude-opus-4-7", reasoning="high")
agent.set_system_prompt("You are a security reviewer.")
with agent.start_session() as session:
print(session.send("Review src/auth.py for vulnerabilities").result)
print(session.send("Now check src/api.py").result)
# session.end() runs on exit and returns the full Trajectory
Swap providers — same code
The most common way is the CAW_PROVIDER env var — set it once and every Agent() picks it up:
export CAW_PROVIDER=codex
from caw import Agent
agent = Agent() # uses whatever CAW_PROVIDER says
Or hand caw a fallback order and let it pick whichever is installed & healthy at runtime:
agent = Agent(provider=["claude", "codex", "opencode"])
traj = agent.completion("Reply with a one-line hello.")
print(f"[{traj.agent}] {traj.result}") # whichever provider handled it
Give the agent tools
Decorate a Python function with @tool and pass it in — caw stands up a tool server for you:
from caw import Agent, tool
@tool(description="Add two numbers")
def add(a: int, b: int) -> int:
return a + b
agent = Agent(stateless_tools=[add])
print(agent.completion("What is 17 plus 25? Use the tool.").result)
For stateful tools (shared state across calls in a session), subclass ToolKit — see the guide.
Inspect a trajectory
Every call returns a structured Trajectory. Save it and browse it later:
with Agent(data_dir="caw_data").start_session(traj_path="run.json") as session:
session.send("List the Python files here and count them.")
Two viewers ship with caw:
caw-traj run.json # compact, step-indexed terminal view
caw viewer # web UI, open run.json by path in the browser
What you can do
- Providers — one API across Claude Code, Codex, and opencode.
- Auto-provider fallback — pick the first installed/healthy provider, fall back transparently.
- Models & tiers — portable
ModelTierselection instead of hard-coded model strings. - Sessions & resume — multi-turn conversations that resume across processes via a
resume_handle. - MCP tools, ToolKit, and subagents — give the agent tools, declaratively or as child agents.
- Provider health — raw availability/credential signals, with an optional live probe (
caw doctor). - Trajectory viewer — browse saved trajectories in the browser or terminal.
- Docker credentials — bind-mount agent OAuth credentials into containers without touching host files (
caw auth).
Every interaction yields a structured Trajectory with turns, content blocks, token usage, and cost — persisted to JSONL when you pass data_dir=.
Documentation
Full docs, guides, and API reference: https://zzjas.github.io/caw/. Machine-readable llms.txt / llms-full.txt are published alongside, since caw's users are often agents.
Runnable examples live in examples/.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coding_agent_wrapper-0.1.8.tar.gz.
File metadata
- Download URL: coding_agent_wrapper-0.1.8.tar.gz
- Upload date:
- Size: 88.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
802bfcde7231382481f09297449c015f5f9216260117db81efb64b671d746d3a
|
|
| MD5 |
6bacb395588ee315bf988ac7e98208e9
|
|
| BLAKE2b-256 |
0d03a08ba180bfd75ad68f31e429543f7bad5b60ca4f1588a66c3914c1b9e106
|
Provenance
The following attestation bundles were made for coding_agent_wrapper-0.1.8.tar.gz:
Publisher:
publish.yml on zzjas/caw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coding_agent_wrapper-0.1.8.tar.gz -
Subject digest:
802bfcde7231382481f09297449c015f5f9216260117db81efb64b671d746d3a - Sigstore transparency entry: 1781879487
- Sigstore integration time:
-
Permalink:
zzjas/caw@6adcdc6440eb6190f9712d6d2ce728c4066b8422 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/zzjas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6adcdc6440eb6190f9712d6d2ce728c4066b8422 -
Trigger Event:
release
-
Statement type:
File details
Details for the file coding_agent_wrapper-0.1.8-py3-none-any.whl.
File metadata
- Download URL: coding_agent_wrapper-0.1.8-py3-none-any.whl
- Upload date:
- Size: 107.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2005aca49e758d49dbd2d254a4857eb5fa0985772bfb4efd7fa790739d69d20
|
|
| MD5 |
a7b1ce602ddedd16c9e7d80260587f82
|
|
| BLAKE2b-256 |
27a0612c5801b2f0adb6aec08ce2b211e4891149bc09c58b814d8c9c8f34f1aa
|
Provenance
The following attestation bundles were made for coding_agent_wrapper-0.1.8-py3-none-any.whl:
Publisher:
publish.yml on zzjas/caw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coding_agent_wrapper-0.1.8-py3-none-any.whl -
Subject digest:
b2005aca49e758d49dbd2d254a4857eb5fa0985772bfb4efd7fa790739d69d20 - Sigstore transparency entry: 1781880024
- Sigstore integration time:
-
Permalink:
zzjas/caw@6adcdc6440eb6190f9712d6d2ce728c4066b8422 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/zzjas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6adcdc6440eb6190f9712d6d2ce728c4066b8422 -
Trigger Event:
release
-
Statement type: