How cayu-dev/cayu works
Cayu is a Python framework and runtime for building long-running agents. The main workflow composes an application and agent, runs resumable sessions through model and tool calls, and records durable state; policy, approvals, budgets, tasks, and recovery support that execution. Separate branches cover collaboration, knowledge, artifacts, evaluation, and operations. Edges use README capability descriptions or the supplied source references; unsampled internals are represented only where documented, not as inferred call chains.
Main entry points: _session_engine.py Session orchestration · applications.py Application composition · contracts.py Background tasks · tools.py Tool approval policy
Components 27
Agent runtime
- Application composition
src/cayu/applications.py - Session orchestration
src/cayu/runtime/_session_engine.py - Session records
src/cayu/sessions/records.py - Runtime events
src/cayu/events.py - Application stores
src/cayu/storage/application.py - Model providers
src/cayu/providers - Context and output
src/cayu/context/structured_output.py - Input validation
src/cayu/_validation.py - Failure handling
src/cayu/_exception_groups.py
Authority and work
- Human approvals
src/cayu/approvals/review.py - Tool approval policy
src/cayu/approvals/tools.py - Human input
src/cayu/approvals/user_input.py - Spend limits
src/cayu/budgets/base.py - Model pricing
src/cayu/budgets/pricing.py - Usage accounting
src/cayu/budgets/usage.py - Background tasks
src/cayu/tasks/contracts.py - Task records
src/cayu/tasks/records.py - Task waiting
src/cayu/_task_wait.py
Agent capabilities
- Agent collaboration
src/cayu/collaboration - Reviewed knowledge
src/cayu/knowledge - Artifacts and workspaces
src/cayu/artifacts
Evaluation and operations
- Evaluation and replay
src/cayu/evals - Control-plane API
src/cayu/server/routes.py - Operator dashboard
dashboard/src/main.tsx - Developer CLI
src/cayu/cli
Other components
- Application developer
- Agent operator
Connections 25
- Application developer → Application composition: composes
- Application composition → Session orchestration: runs sessions
- Session orchestration → Model providers: calls models
- Session orchestration → Context and output: assembles context
- Session orchestration → Application stores: persists state
- Session orchestration → Session records: tracks sessions
- Session orchestration → Runtime events: records events
- Application composition → Input validation: validates inputs
src/cayu/applications.py - Session orchestration → Failure handling: handles failures
src/cayu/runtime/_session_engine.py - Session orchestration → Tool approval policy: checks tool policy
src/cayu/runtime/_session_engine.py - Tool approval policy → Human approvals: requests review
src/cayu/approvals/tools.py - Session orchestration → Human input: awaits input
src/cayu/runtime/_session_engine.py - Session orchestration → Spend limits: checks spend
- Spend limits → Model pricing: prices calls
src/cayu/budgets/base.py - Session orchestration → Usage accounting: accounts usage
- Application composition → Background tasks: dispatches work
- Background tasks → Task records: uses records
src/cayu/tasks/records.py - Background tasks → Task waiting: waits for work
- Session orchestration → Agent collaboration: supports delegation
- Application composition → Reviewed knowledge: offers knowledge
- Application composition → Artifacts and workspaces: supports artifacts
src/cayu/applications.py - Application developer → Evaluation and replay: evaluates agents
- Agent operator → Control-plane API: operates runtime
- Control-plane API → Operator dashboard: serves operations UI
- Agent operator → Developer CLI: uses CLI