Skip to main content

caw: Coding Agent Wrapper

PyPI version Python versions License: Apache-2.0 Lint status Documentation Ruff

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 ModelTier selection 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

Apache-2.0

Metadata

Release files for coding-agent-wrapper 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coding-agent-wrapper 0.1.9
File Size Uploaded Provenance Actions
coding_agent_wrapper-0.1.9.tar.gz 90.5 kB With provenance Details for coding_agent_wrapper-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coding-agent-wrapper 0.1.9
File Interpreter ABI Platform Actions
coding_agent_wrapper-0.1.9-py3-none-any.whl Python 3 none any Details for coding_agent_wrapper-0.1.9-py3-none-any.whl

Total release size: 200.9 kB

Release files / coding_agent_wrapper-0.1.9.tar.gz

Download URL coding_agent_wrapper-0.1.9.tar.gz
Size 90.5 kB
Tags Source
SHA-256 checksum
How to use checksums
86b00b66b96b6532bb7df9be4500f98f6cb8915a9f1e0e52a1018aca1ba50889
BLAKE2b-256 checksum
How to use checksums
738670db7a1babf53488d35d46589caef01a2ec526acc3c03c8f12465574a176
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / coding_agent_wrapper-0.1.9-py3-none-any.whl

Download URL coding_agent_wrapper-0.1.9-py3-none-any.whl
Size 110.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6b1297c8e5156a8f65ab02fe3aef41a624402b8a09497a6152c95315f2f85b8
BLAKE2b-256 checksum
How to use checksums
768d5a15a46b193e9ecd69dd9e3a8e56305d11749aef30f3efcbd91745927d6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Security for coding-agent-wrapper 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for coding_agent_wrapper-0.1.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page