Cayu
Find public concepts ·
Run the example
Cayu is a Python runtime for long-running agents: durable sessions that survive
restarts and redeploys, human approval before side effects, spend caps enforced
before each model call, and multi-agent collaboration.
Start with the installed guides: cayu guide untrusted-code to run untrusted
code with controlled filesystem and network access, cayu guide external-agents
to run Claude Code or Codex as a step in your app, and cayu guide long-running
for approvals, timers, retries and recovery. cayu guide --help lists every topic.
| Capability |
Cayu parts |
| Durable sessions and recovery |
SQLiteSessionStore or PostgresSessionStore (cayu.storage) with ResumeRequest; ExecutionProfilePolicy (cayu.runtime) governs resumes on a new build |
| Approval before side effects |
ToolPolicy returning ToolPolicyDecision.REQUIRE_APPROVAL (cayu.tools), resolved through cayu.approvals |
| Spend caps |
BudgetLimit per request and BudgetPolicy per app (cayu.budgets), checked before each model call |
| Timers and background work |
TaskStore workers and TaskSchedulePolicy for scheduled follow-ups (cayu.tasks) |
| Multi-agent collaboration |
SubagentTool (cayu.tools), forks, and participants with durable requests (cayu.collaboration) |
| Claude Code or Codex runs |
run_external_agent with ClaudeAgentAdapter or CodexAgentAdapter (cayu.external_agents, extras cayu[claude-agent-sdk] and cayu[codex]) and a launcher: linux_agent_launch (Docker-free Linux confinement with Landlock ABI 6 and seccomp), local_agent_launch (no sandbox), or docker_agent_launch, recorded as sessions with usage and deadlines; see cayu guide external-agents |
Cayu is Python only and is not a graph DSL: agents, tools and workflows are
ordinary Python. It is not only a hosted service: run it on your own
infrastructure or deploy to the optional Cayu Cloud.
Cayu is open source. Build your agent's harness from Python components and
defaults: model providers, context, tools, integrations, knowledge, memory,
policies, domain logic and verification. Choose the capabilities your job
needs, then evaluate and operate the resulting agent on your infrastructure or
with optional Cayu Cloud.
The integrated runtime carries that work through model and tool calls, durable
sessions, task dispatch, leased workers, resumable workflow steps, approvals and
recovery. Applications can use those execution capabilities directly without a
separate workflow engine.
Framework, harness, runtime and agent
| Term |
Role |
| Framework |
Cayu's Python APIs, components and defaults for building and running agents |
| Harness |
The domain-specific system you assemble: context, tools, memory, policies, domain logic and verification |
| Runtime |
The framework's execution machinery for sessions, state, authority, workers, budgets and recovery |
| Agent |
The resulting application that performs a defined job |
| Cloud |
Optional deployment and shared operation of agents built with the framework |
Applications own their user interface, authentication, business authorization,
domain rules and completion criteria. See the public concepts and source
map for the
components to build with.
Why we built Cayu
We built Cayu while developing domain-specific agents that needed to carry
consequential work through model calls, tools, human decisions and failures.
Those applications needed both a configurable harness and dependable execution.
We began by building agents with SDKs and frameworks including the Claude Agent
SDK, Mastra, and LangGraph. They helped us implement the model-and-tool loop
quickly. Production quality required deeper control of the loop itself: context
assembly, model and tool invocation, output validation, and failure handling.
Production quality also depended on everything around that loop: scheduling,
durable state, credentials, execution environments, human intervention,
recovery, cost attribution, and evaluation. Cayu gives applications control of
that entire agent execution lifecycle.
Why Cayu
Agent prototypes are easy to start. Production failures happen at the
boundaries:
- a process dies after a side effect but before state is recorded;
- a model requests a valid tool with the wrong authority;
- a run needs human input or approval halfway through;
- context grows until a provider rejects the next request;
- retries, forks, or subagents lose cost and causal attribution;
- operators cannot reconstruct what happened from prompt text alone; or
- evals test final prose while missing the runtime trajectory.
Cayu treats these as runtime contracts. Important actions become structured
events; tool authority and recovery are explicit; configured durable stores let
transcripts and checkpoints survive process boundaries; and the same public
seams support local development, tests, Developer dashboard inspection, and hosted
deployments.
What Cayu provides
| Need |
Framework components |
| Models and the agent loop |
Provider adapters, reasoning controls, structured output, validation and bounded repair |
| Provider flexibility |
OpenAI API, experimental OpenAI subscription login, Anthropic, Bedrock, Vertex, OpenAI-compatible APIs |
| Tools and integrations |
Typed Python tools, MCP, capability discovery, application services and workflow composition |
| Web research and browsers |
Search/fetch adapters, stateful browser tools and application-selected execution backends |
| Context and memory |
Token counting, projection, compaction, overflow recovery and prompt-cache-aware strategies |
| Reviewed knowledge |
Durable entries, approval state, keyword/vector retrieval and recall tools |
| Long-term recall |
Bounded knowledge/transcript sources, deterministic fusion, exact locators and coverage |
| Multi-agent work |
Subagents, delegation, forks, participants and durable peer requests |
| Workspaces and artifacts |
Files, execution runners, workspace lifecycle, durable artifacts, vaults and egress |
| Verified completion |
Work contracts, proposal evidence, independent acceptance and repair decisions |
| Evals and improvement |
Runtime tests, production-session promotion, durable evals, replay, comparison and CI reports |
| Git and GitHub delivery |
Governed repository changes, commits, pull requests and delivery receipts |
| Development and deployment |
Project scaffolding, application factories, process roles and optional Cloud deployment |
| Operations |
FastAPI server API and the packaged Developer dashboard for sessions, workflows, usage and evals |
The integrated durable runtime
The same framework provides the execution contracts behind those capabilities:
- durable sessions, transcripts, events, checkpoints, resume and interruption;
- controlled tool effects, policies, approvals and idempotency identities;
- human-input checkpoints, approval resolution and manual recovery;
- task dispatch, worker ownership, resumable workflows and child-session lineage;
- usage accounting, run limits, budgets, pricing and causal attribution; and
- execution admission, recovery and reconciliation of uncertain external effects.
Configure the stores, adapters, policies and execution boundaries for your job.
Native Python tools are trusted application code; configured isolation and
external receipts determine the guarantees at the application boundary.
Verify the runtime
Want executable evidence before adopting Cayu? The runtime qualification guide
maps tool roundtrips, durable continuation, approval gating, and reviewed-proposal
binding to existing tests. It provides a pinned installed-wheel setup, a small
credential-free acceptance plan, the restartable support integration, and broader
release qualification, with report interpretation and coverage limits.
Quickstart
Need a non-coding agent that survives restarts and waits for approval? Follow the
restartable support-agent example.
It investigates an order, asks for clarification, proposes a replacement, and
waits for verified representative approval before executing it. The guide and
executable ship with Cayu:
cayu guide order-support
python -m cayu.examples.order_support --help
For a model-only agent, start with the generated project below.
Start a project
The generated project is the recommended path for both humans and coding
agents. Cayu requires Python 3.11 or newer.
You can give a coding agent one request: “Run pip install cayu and create a
code review agent.”
pip install cayu pytest
cayu new myagent
cd myagent
cayu inspect --json
cayu check --fail-on warning --json
pytest
cayu eval run
# After configuring the provider through configuration/settings.py or CAYU_PROVIDER:
python run.py --message "Review this change."
When PyPI has a newer Cayu release than the one installed, cayu new prints both
versions and the command that scaffolds with the latest release
(uvx --from 'cayu==X.Y.Z' cayu new ... with your arguments). In a terminal it
asks before continuing; otherwise it warns on stderr and continues, and --json
adds a newer_release field.
Every other cayu command, cayu cloud included, prints one line on stderr after
its output when a newer release exists, at most once a day, for example
cayu 0.20.0 is available; you're running 0.16.1., followed by how to update for
the way Cayu is installed: in a project that depends on Cayu, allow the release in
pyproject.toml if its requirement excludes it (the pin stays yours to move), then
uv lock --upgrade-package cayu and uv sync; uv tool upgrade cayu
for a uv tool install, or uvx cayu@latest under uvx. It stays quiet when
stderr is not a terminal, when CI is set, and when the command asks for JSON
(--json, --jsonl or --format json), and never writes to stdout.
The check waits at most about two seconds, asks PyPI at most once a day, and stays
silent when PyPI is unreachable. Set CAYU_NO_VERSION_CHECK=1 to turn it off.
For a portable operator snapshot that performs no agent, tool, recovery, repair,
or live-provider work, run cayu doctor --bundle cayu-support.zip. The
command reuses maintained-service diagnostics when selected and forces
CayuApp and project control-plane stores backed by the built-in SQLite and
PostgreSQL implementations into diagnostic read-only validation without creating
or migrating them. Session history is excluded unless you
explicitly repeat --session. See
Diagnostic support bundles
for the contents, redaction boundary, hard limits, and exit codes.
The scaffold is credential-free and includes:
- a composition-only
app.py with a process-scoped build_app() factory;
- one model-only agent with no required tools;
- a web app for your team, which
cayu serve serves at / beside the Developer
dashboard at /cayu/ (--without web-app leaves it out; cayu guide app-ui);
- complete tracked homes for prompts, tools, policies, environments, workflows,
operations, knowledge, memory, integrations, observability, and domain code;
- explicit provider, storage, runtime, and agent-registration seams;
- a hermetic runtime test and output eval; and
- a source-controlled
[tool.cayu.scaffold] plan plus AGENTS.md and the
minimal CLAUDE.md bridge.
Open the generated project, describe the requested job in the existing agent,
and keep its public test/eval seam intact.
For an explicit, editable repository-coding starter with bounded file and Git
tools, durable knowledge, background review delegation, and human input, opt in
to the maintained composition:
cayu new mycoder --preset coding
cd mycoder
cayu check --fail-on warning --json
pytest -q tests/test_coding_composition.py
python run.py --agent mycoder --message "Implement the requested change."
Add --execution docker for the maintained GitHub-independent coding product.
Its build_coding_product_application() front door produces durable
patch_ready_for_delivery evidence after required checks, source copy-back, Git
inspection, and configured review gates settle. It performs no commit, push,
pull-request, CI, or merge effect. See the
maintained coding product.
Add --with remote-git-delivery to generate the optional host-side broker seam.
It prepares the exact patch-ready tree for application approval, then can create
and push one exact commit to a new configured branch without exposing remote or
credential authority to the coding agent. See
approved remote Git delivery.