{"slug": "build-domain-specific-harness-and-long-horizon-agents-with-os-python-framework", "title": "Build domain-specific harness and long-horizon agents with OS Python framework", "summary": "Cayu launched as a production agent runtime in Python that gives applications control of the full agent execution lifecycle, including context assembly, tool invocation, durable state, approvals, recovery, and evaluation. Cayu was extracted from the production runtime behind an agent-operated software factory that built and deployed thousands of business applications, where specialized agents served as AI SRE, AI product manager, AI coder, and FDE assistant. The framework provides runtime primitives such as durable sessions, task dispatch, leased workers, resumable workflow steps, and approvals, and supports providers including OpenAI API, Anthropic, Bedrock, Vertex, and OpenAI-compatible APIs.", "body_md": "[Find public concepts](https://github.com/cayu-dev/cayu/blob/main/docs/public-concepts.md) ·\n[Run the example](https://github.com/cayu-dev/cayu/blob/main/examples/application/README.md)\n\nCayu is a production agent runtime for building and operating AI agents in Python.\n\nA harness turns a model into an agent by supplying its context, tools, permissions, and execution logic. Cayu gives applications control of the full agent execution lifecycle: how context is assembled, models and tools are invoked, where agent code runs, how state is persisted, authority is governed, failures are recovered, and behavior is observed and evaluated.\n\nCayu provides durable agent-runtime primitives including sessions, task dispatch, leased workers, resumable workflow steps, approvals, and recovery. Applications can use them directly without a separate workflow engine.\n\nApplications retain control of their UI, authentication, domain logic, and business workflows.\n\nCayu is designed for agents that do consequential or long-horizon work. You compose its runtime primitives directly in your application.\n\nCayu was extracted from the production runtime behind an agent-operated software factory that built and deployed thousands of business applications. Specialized agents worked together as the AI SRE, AI product manager, AI coder, and FDE assistant behind that delivery process.\n\nWe 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.\n\nProduction 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.\n\nAgent prototypes are easy to start. Production failures happen at the boundaries:\n\n- a process dies after a side effect but before state is recorded;\n- a model requests a valid tool with the wrong authority;\n- a run needs human input or approval halfway through;\n- context grows until a provider rejects the next request;\n- retries, forks, or subagents lose cost and causal attribution;\n- operators cannot reconstruct what happened from prompt text alone; or\n- evals test final prose while missing the runtime trajectory.\n\nCayu 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, control-plane inspection, and hosted deployments.\n\n| Need | Cayu primitive | \n|---|---|\n| Long-horizon work | Durable sessions, transcripts, events, resume, fork, interruption | \n| Safe effects | Typed tools, effect declarations, policies, approvals, idempotency keys | \n| Human interaction | User-input checkpoints, approval resolution, manual recovery | \n| Context pressure | Token counting, projection, compaction, overflow recovery | \n| Cost control | Usage events, run limits, budgets, pricing, causal-budget summaries | \n| Execution boundaries | Environments, workspaces, runners, artifacts, vaults, egress | \n| Reviewed knowledge | Durable entries, approval state, keyword/vector retrieval, recall tools | \n| Long-term recall | Bounded knowledge/transcript sources, deterministic fusion, exact locators and coverage | \n| Provider flexibility | OpenAI API, experimental OpenAI subscription login, Anthropic, Bedrock, Vertex, OpenAI-compatible APIs | \n| Agent operations | Tasks, dispatchers, event watchers, subagents, runtime hooks | \n| Behavioral proof | Runtime tests, production-session promotion, durable evals, comparison, and CI reports | \n| Operations | FastAPI control plane and a packaged dashboard for sessions, workflows, usage, and evals | \n\nThe generated project is the recommended path for both humans and coding agents. Cayu requires Python 3.11 or newer.\n\nYou can give a coding agent one request: “Run `pip install cayu` and create a\ncode review agent.”\n\n```\npip install cayu pytest\ncayu new myagent\ncd myagent\n\ncayu inspect --json\ncayu check --fail-on warning --json\npytest\ncayu eval run\n\n# After configuring the provider through configuration/settings.py or CAYU_PROVIDER:\npython run.py --message \"Review this change.\"\n```\n\nFor a portable operator snapshot that performs no agent, tool, recovery, repair,\nor live-provider work, run `cayu doctor --bundle cayu-support.zip`. The\ncommand reuses maintained-service diagnostics when selected and forces\nCayuApp and project control-plane stores backed by the built-in SQLite and\nPostgreSQL implementations into diagnostic read-only validation without creating\nor migrating them. Session history is excluded unless you\nexplicitly repeat `--session`. See\n[Diagnostic support bundles](https://github.com/cayu-dev/cayu/blob/main/docs/diagnostic-support-bundles.md)\nfor the contents, redaction boundary, hard limits, and exit codes.\n\nThe scaffold is credential-free and includes:\n\n- a composition-only `app.py` with a process-scoped`build_app()` factory;\n- one model-only agent with no required tools;\n- complete tracked homes for prompts, tools, policies, environments, workflows, operations, knowledge, memory, integrations, observability, and domain code;\n- explicit provider, storage, runtime, and agent-registration seams;\n- a hermetic runtime test and output eval; and\n- a source-controlled `[tool.cayu.scaffold]` plan plus`AGENTS.md` and the\nminimal`CLAUDE.md` bridge.\n\nOpen the generated project, describe the requested job in the existing agent, and keep its public test/eval seam intact.\n\nFor 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:\n\n```\ncayu new mycoder --preset coding\ncd mycoder\ncayu check --fail-on warning --json\npytest -q tests/test_coding_composition.py\npython run.py --agent mycoder --message \"Implement the requested change.\"\n```\n\nAdd `--execution docker` for the maintained GitHub-independent coding product.\nIts `build_coding_product_application()` front door produces durable\n`patch_ready_for_delivery` evidence after required checks, source copy-back, Git\ninspection, and configured review gates settle. It performs no commit, push,\npull-request, CI, or merge effect. See the\n[maintained coding product](https://github.com/cayu-dev/cayu/blob/main/docs/coding-product.md).\n\nAdd `--with remote-git-delivery` to generate the optional host-side broker seam.\nIt prepares the exact patch-ready tree for application approval, then can create\nand push one exact commit to a new configured branch without exposing remote or\ncredential authority to the coding agent. See\n[approved remote Git delivery](https://github.com/cayu-dev/cayu/blob/main/docs/remote-git-delivery.md).\n\nAdd `--with github-delivery` to include the subsequent host-only PR, exact-head\nchecks, review, and provenance-labelled follow-up seam. It implies remote Git\ndelivery and does not authorize merge. See [GitHub delivery](https://github.com/cayu-dev/cayu/blob/main/docs/github-delivery.md).\n\nThe generated repository starts from a clean Git commit, and each new product\nrun requires a clean committed Git source baseline. It also requires `git`,\n`rg`, and the POSIX descriptor-relative filesystem primitives used by secure\n`LocalWorkspace` path operations. Unsupported hosts fail during generation or\napplication construction. Its local workspace and runner are trusted-host\ndevelopment adapters, not a hostile-code sandbox. The default scaffold is the\ncomplete Cayu application convention. Select `--preset agent`, `--preset service`,\nor `--preset coding`; optional capabilities share the same application layout.\n\nDiscover or review the Rails-style generation plan before writing:\n\n```\ncayu new --list-presets --json\ncayu new --list-capabilities --json\ncayu new myagent --preset agent --database postgres --provider anthropic --dry-run --json\ncayu guide applications#planning --json\n```\n\nCloud commands ship in the same `cayu` package; no additional CLI package is\nrequired. Cayu Cloud is currently invite-only. Login-backed commands are pinned to\nthe production service at `https://cloud.cayu.dev`; users never select an API URL.\n\n```\ncayu cloud --help\ncayu cloud login\ncayu cloud whoami\ncayu cloud init\ncayu cloud deploy\n```\n\nLogin uses WorkOS device authorization. It opens the browser when possible and always\nprints a verification URL and one-time user code for SSH, containers, Cursor, Codex,\nand Claude Code. The resulting Organization-scoped session is stored privately and\nrefreshed automatically; no WorkOS secret is embedded in Cayu. Use `--no-browser` when\na human will open the displayed URL on another device. Login selects the WorkOS session\nover any previously persisted private context; a later `cayu cloud context use PATH`\ndeliberately switches back to that internal automation context. Private contexts and\nexplicit API credentials remain endpoint-bound operator mechanisms and do not change\nthe default customer endpoint.\n\n`cayu cloud init` generates the small deployment descriptor from standard\n`pyproject.toml` metadata and a configured Cayu server, worker, or console\nscript. Review the generated process topology before deploying it. Existing\ndescriptors are never replaced unless `--force` is explicit.\n\nThe default command packages the current local working directory and uploads it directly to the selected Cayu Cloud Organization as an immutable source bundle. It includes an applied patch and does not require GitHub, a clean worktree, a commit, or a push. Git-ignored files and common local credential/cache paths are omitted.\n\nDeploy creates or updates the 8-63 character application slug declared in\n`cayu-cloud.toml`. Slugs use lowercase letters, numbers, and interior hyphens.\n`--application SLUG` overrides that create-or-update slug; check it carefully because\na valid typo creates a separate application.\n\nDeploy output and local evidence redact runtime environment values. Cayu verifies the\nevidence destination before Cloud mutation; if only the final evidence write fails after\na successful rollout, deploy still exits successfully with `evidence_id: null` and an\n`evidence.status: unavailable` diagnostic.\n\nTo deploy an exact remote GitHub revision instead, pass its canonical URL and 40-character commit. For a private source, make authentication available to the process that runs Cayu:\n\n```\ngh auth status --hostname github.com\n# For noninteractive CI or an isolated Codex/Claude Code home:\nGH_TOKEN=\"$GITHUB_TOKEN\" cayu cloud deploy \\\n  https://github.com/example/agent --revision COMMIT_SHA\n```\n\nGitHub CLI credentials stored in a desktop keychain may not be reachable after\nchanging `HOME`, even when `GH_CONFIG_DIR` points at an authenticated GitHub CLI\nconfiguration. In that case, pass a short-lived `GH_TOKEN` explicitly. Cayu\ndoes not persist the token in its Cloud context or include GitHub CLI stderr in\nits JSON errors. Public GitHub repositories remain deployable without GitHub\nauthentication.\n\nFor CI and other noninteractive automation, the existing\n`CAYU_CLOUD_API_KEY`, `CAYU_CLOUD_API_KEY_FILE`, and private Cloud-context\noptions remain available. Explicit automation credentials take precedence over\nthe saved interactive login.\n\nThis compact example shows the core API. Real projects should put the same\nregistrations in the generated `build_app()` factory instead of constructing a\nmodule-global app.\n\n``` python\nimport asyncio\n\nfrom cayu import (\n    AgentSpec,\n    CayuApp,\n    Message,\n    OpenAIProvider,\n    RunRequest,\n    run_to_completion,\n)\n\nasync def main() -> None:\n    app = CayuApp()\n    app.register_provider(OpenAIProvider(), default=True)  # reads OPENAI_API_KEY\n    app.register_agent(AgentSpec(name=\"assistant\", model=\"gpt-5.6\"))\n\n    outcome = await run_to_completion(\n        app,\n        RunRequest(\n            agent_name=\"assistant\",\n            messages=[Message.text(\"user\", \"Explain durable agent sessions.\")],\n        ),\n    )\n\n    if outcome.ok:\n        print(outcome.final_text)\n    else:\n        print(f\"{outcome.status}: {outcome.error}\")\n\nasyncio.run(main())\n```\n\n`CayuApp()` uses in-memory stores by default, which is appropriate for this\none-shot example and for tests. The generated project configures all local Cayu\nstores in `data/cayu.db` so sessions survive process restarts. Multi-process\nproduction deployments should select a conforming shared store such as\nPostgreSQL.\n\n`CayuApp.run(...)` is the lower-level event-stream API. Runtime failures arrive\nas terminal `session.failed` events instead of exceptions raised from\niteration.\n`run_to_completion(...)` consumes that same stream and returns a typed outcome\nwhen an application only needs the result. It retains the complete event stream\nin `RunOutcome.events`; use it for bounded runs. Consume `CayuApp.run(...)`\nincrementally for long-lived or high-volume runs.\n\nFor a credential-free domain-tool tracer bullet, run `cayu guide references#domain-tool`, then use `cayu generate tool`. To add workspace tools\nand command execution, see\n[`examples/local_environment_runtime.py`](https://github.com/cayu-dev/cayu/blob/main/examples/local_environment_runtime.py).\nFor a finite application-owned command surface, use\n[`NamedCheck` and `RunCheckTool`](https://github.com/cayu-dev/cayu/blob/main/docs/named-checks.md)\ninstead of exposing\nmodel-authored shell or argv.\n\nThe generated `AGENTS.md` is the project-local source of truth. Ask the coding\nagent to read it first, then use Cayu's package-shipped guides and structured\ninspection:\n\n```\ncayu guide anatomy\ncayu guide authoring\ncayu inspect --json\ncayu check --fail-on warning --json\n```\n\nThe package-shipped `cayu guide authoring#cayu-map` routes each optional\ncapability to the smallest version-matched local reference. Its online\n[source mirror](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/authoring.md#cayu-map)\nis secondary. The\n[examples index](https://github.com/cayu-dev/cayu/blob/main/examples/README.md)\nprovides runnable references without making them required project structure.\n\nThe supported authoring loop is:\n\n``` php\nunderstand -> inspect -> plan -> change -> test -> eval -> exercise -> report evidence\n```\n\nStart by editing the existing model-only agent, test, and eval. Add a generated tool-backed slice only when the requested job needs a capability outside the model; generated slices remain unfinished until their placeholder behavior, test, and eval have been replaced.\n\nCayu separates the agent's identity from the resources and durable state used for one execution:\n\n```\nAgentSpec\n  identity, model, system prompt, defaults, runtime policies\n\nEnvironment\n  workspace, runner, artifacts, vault, proxy, knowledge, MCP\n\nSession\n  durable identity, transcript, events, status, checkpoints\n\nToolContext\n  the active environment services and call identity for one tool execution\n```\n\n- **Agent** describes who is acting and how model work is configured.\n- **Environment** describes what that agent can touch.\n- **Session** records one durable execution and its lineage.\n- **Tool** is an explicitly registered, application-owned capability that the\nmodel may request. A native Python`Tool` runs inside the trusted Cayu\napplication process;`ToolPolicy` gates its invocation but does not sandbox\nits implementation.\n- **Task** is an optional durable unit of background or orchestrated work.\n- **Workflow** is deterministic application orchestration around agent steps.\n\nAn environment is optional for a conversational agent. It becomes important\nwhen tools need files, commands, artifacts, secrets, network policy, or a\nsandbox. Static environments are useful for trusted local work;\n`EnvironmentFactory` creates or reattaches session-specific environments in\nproduction.\n\nChoose the execution surface according to where code should run and which boundary should contain it:\n\n| Surface | Execution location | Boundary | \n|---|---|---|\n| Native Python `Tool` | Cayu application process | Trusted application code; policy controls invocation, not host-process access | \n| Process-isolated host `Tool` | Disposable POSIX child process session | Hard wall-clock liveness and owned process-group cleanup for an explicitly reconstructable trusted adapter; not a security sandbox | \n| Runner-backed operation ( `ctx.runner` ) | Selected runner for that operation; the enclosing `Tool.run()` stays in the Cayu application process | Isolation, environment, network, and filesystem guarantees for the operation come from the admitted runner and environment | \n| MCP tool | Configured MCP process or server | Separate integration boundary whose process, transport, credentials, and isolation remain deployment choices | \n| Virtual egress | Selected runner plus a trusted broker outside it | A conforming adapter can keep the real credential out of the workload; code isolation still depends on the runner | \n\nDo not add every Cayu primitive to every application.\n\n| Desired behavior | Start with | \n|---|---|\n| One model-driven interaction | `CayuApp` ,`AgentSpec` , provider,`RunRequest` | \n| Deterministic model-callable action | `Tool` ,`ToolSpec` , explicit`ToolEffect` | \n| Authority over an effect | `ToolPolicy` ; approval only where a human gate is required | \n| Mutable files or commands | Explicit `Environment` ,`Workspace` , and`Runner` | \n| Durable uploaded or generated files | `ArtifactStore` | \n| Long-lived conversation or recovery | Durable `SessionStore` and checkpoint APIs | \n| Background durable work | `TaskStore` plus an explicitly started worker | \n| Delegated model work | Subagent tools with bounded child-session policy | \n| Behavioral regression proof | `EvalSuite` and trajectory assertions | \n\nStart a conversation agent with the model and state it needs. Add workflows, task queues, environments, memory stores, servers, or multi-agent topology when the behavior requires them. Give coding agents narrow domain tools before granting broader shell access.\n\nArtifact writes have a bounded cancellation-settlement contract. After a dispatched write is interrupted, stores distinguish an exact committed artifact, positively proved absence, and a typed reconciliation-required orphan candidate; the candidate is diagnostic evidence, never a readable artifact reference.\n\nYour application should own:\n\n- end-user prompts and domain forms;\n- product authentication and authorization;\n- business-specific workflow and state;\n- user-facing streaming, notifications, and presentation; and\n- decisions about when a run, task, approval, or interruption is allowed.\n\nCayu owns runtime execution and the operational state recorded by the application's configured stores. Its optional dashboard is a control plane for developers and operators: inspect sessions, events, transcripts, tasks, usage, artifacts, pending actions, and recovery state. Your application remains responsible for the product experience.\n\nStart work through the API that matches the trigger:\n\n- `run` for an immediate new session;\n- `resume` for a deliberate continuation;\n- `dispatch` for placement through a dispatcher;\n- a task worker for durable queued work;\n- a subagent for model-selected bounded delegation; or\n- an event watcher for durable reactions to already-persisted events.\n\nSee [Triggering runs](https://github.com/cayu-dev/cayu/blob/main/docs/triggering-runs.md) for the decision guide and\nlifecycle responsibilities.\n\nThe base package includes the provider contracts and built-in OpenAI, Anthropic, OpenAI-compatible HTTP, and experimental OpenAI-subscription adapters. Optional extras add integrations without forcing their dependencies into every deployment:\n\n| Extra | Adds | \n|---|---|\n| `cayu[server]` | FastAPI control plane and packaged dashboard | \n| `cayu[server-settings]` | Server extra plus typed environment and `.env` loading | \n| `cayu[postgres]` | PostgreSQL session, task, knowledge, and related stores | \n| `cayu[aws]` | Amazon Bedrock and Lambda MicroVM support | \n| `cayu[vertex]` | Anthropic models through Google Cloud Vertex AI | \n| `cayu[e2b]` | E2B runner and workspace | \n| `cayu[microsandbox]` | Local microVM-backed untrusted-code runner | \n| `cayu[egress]` | Virtual egress and credential-broker primitives | \n| `cayu[files]` | Image and PDF inspection | \n| `cayu[console]` | Interactive application console | \n| `cayu[otel]` | OpenTelemetry tracing and metrics support | \n| `cayu[all]` | Every runtime integration extra above | \n\n`cayu[all]` intentionally excludes `cayu[browser]`, which is dashboard and\nbrowser verification tooling rather than a runtime integration.\n\nProviders normalize text, thinking, tool calls, usage, completion reasons, and typed failures behind one runtime contract. Applications register providers explicitly and may add deterministic model-pattern routing; an arbitrary model name never selects a provider.\n\nCayu focuses on OpenAI, Anthropic, OpenRouter, Google, Bedrock, and Vertex.\nOpenRouter is a first-class `cayu new --provider openrouter` and\n`CAYU_PROVIDER=openrouter` choice backed by the generic Chat Completions adapter;\nit requires `OPENROUTER_API_KEY` and an explicit `CAYU_MODEL` slug. Compatible\nChat Completions services such as Fireworks, Baseten Model APIs, and OpenCode Go\nuse that generic adapter directly. Run `cayu guide providers#openrouter` or use\nthe [package guide](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/providers.md#openrouter)\nfor exact setup.\n\nFor local development without separate OpenAI API billing, users can sign in with their own ChatGPT subscription:\n\n```\ncayu auth openai login\n# For SSH or a remote machine:\ncayu auth openai login --headless\npython\nfrom cayu import OpenAISubscriptionProvider\n\napp.register_provider(OpenAISubscriptionProvider(), default=True)\n```\n\nThis experimental integration uses the Codex backend. It does not use the\ndocumented OpenAI Platform API. Cayu identifies itself with `originator: cayu`\nand preserves upstream rejections. OpenAI has not documented this raw backend\nas a general third-party provider API, so support may change or stop.\n\n**Intended-use boundary:** Use this path only for a subscription holder's own\nlocal development and evaluation. For production, customer-facing or\nmulti-user services, use the OpenAI Platform API or another officially\nsupported provider. Do not share or resell credentials or bypass plan limits.\n\nSee [OpenAI subscription authentication](https://github.com/cayu-dev/cayu/blob/main/docs/openai-subscription.md) for the\nsupport boundary, credential storage, and fallback options.\n\nThe same agent can run in a local workspace, trusted Docker container, E2B, Microsandbox, Lambda MicroVM, or an application-owned runner without changing its identity or transcript contract.\n\nCayu ships three equally supported control-plane choices: use the bundled compiled dashboard, eject the exact version-matched React/TypeScript source for application-owned customization, or provide a completely custom UI over the versioned control-plane API.\n\n```\ncayu dashboard eject ./control-plane\ncd control-plane\nnpm ci\nnpm run dev\nnpm run build\n```\n\nExtraction uses package data only—no repository clone, GitHub access, or network request. Serve\nthe resulting `dist/` with `DashboardConfig(directory=...)`,\n`mount_cayu(..., dashboard_dir=...)`, or `mount_dashboard(..., dashboard_dir=...)`. Cayu never\nrewrites the extracted application-owned source during upgrades. See [Open and replaceable\ncontrol plane](https://github.com/cayu-dev/cayu/blob/main/docs/control-plane.md) for the complete workflow, compatibility gate, and\nredistribution obligations.\n\nCayu makes safety boundaries explicit, but configuration still matters:\n\n- Native Python `Tool` implementations are trusted host-process code and can\naccess authority available to the Cayu application.`ToolPolicy` controls\nwhether the model may call a tool and with which arguments; it is not an OS\nisolation boundary. Run model-authored or otherwise untrusted code through an\nadmitted runner or separately governed external tool boundary. Native tools\nthat need credentials should use explicit`SecretRef` values through`ctx.proxy` or`ctx.vault` and return only safe results; ambient host\nenvironment values are not automatically mediated as workload credentials.\n- `LocalRunner` executes directly on a trusted local machine and provides no\nsandbox isolation.\n- `DockerRunner` is useful for development and CI; ordinary Docker isolation\nis not presented as a secure untrusted-code boundary.\n- Environment registration does not imply selection: mark a default explicitly or name the environment on the request. Provider defaults and model-pattern routing should likewise be configured deliberately and kept unambiguous.\n- Tool effects do not authorize themselves. Use policies, approvals, scoped credentials, and destination controls where consequences require them.\n- SQLite is appropriate for local and single-writer deployments. Use PostgreSQL or another conforming shared store for sustained multi-process concurrency.\n- The FastAPI control plane requires an explicit `ServerConfig` access policy.\nUse`AuthenticatedAccess` for deployed operator surfaces;`OpenAccess` and`ServerConfig.local_development()` are deliberate local-only choices.\nDeployment names are descriptive metadata and never relax security policy.\nSee[server configuration](https://github.com/cayu-dev/cayu/blob/main/docs/server-configuration.md) .`AuthContext.tenant` records authenticated operator provenance but does not\nfilter or isolate Cayu data. See[Server authentication and tenant\nisolation](https://github.com/cayu-dev/cayu/blob/main/docs/recipes/server-auth-tenancy.md) .\nGenerated API documentation is a separate exposure decision.\n- Public or multi-user product routes need a separate customer authorization\nboundary; operator authentication does not make the raw Cayu surface\ntenant-scoped. Start new services with\n`cayu new NAME --preset service` , then require both`cayu check --deploy --fail-on warning --json` and the generated`tests/test_public_service_security.py` . Cayu reports arbitrary host-owned\nASGI routes outside that maintained factory as unverified.\n- When embedding with `mount_cayu(..., path=\"/your/path\")` or the lower-level`mount_dashboard(...)` , use`/your/path/` as the canonical dashboard URL.\nCayu redirects an exact GET or HEAD of the slashless non-root mount after a\nsuccessful dashboard mount. That public 307 may be returned without\ncredentials; dashboard HTML, assets, deep links, and other protected content\nat the canonical target still require configured authentication.`mount_cayu(...)` places its control-plane API under`/your/path/api` ;`mount_dashboard(...)` configures`apiBaseUrl` independently and defaults it\nto`/api` .\n- Usage is derived from recorded events and survives restarts when those events use a durable store; cost remains an estimate against the price book your application selects.\n- Recovery never invents the outcome of an ambiguous external side effect. Reconcile it through the typed recovery APIs.\n\nRead [Runtime contracts](https://github.com/cayu-dev/cayu/blob/main/docs/runtime-contracts.md) before changing persistence,\nreplay, approval, interruption, budget, provider, runner, or recovery behavior.\n\nStart with the [documentation index](https://github.com/cayu-dev/cayu/blob/main/docs/README.md)\nfor maintained guides, operational references, design records, research evidence,\nand explicitly archived material.\n\nStart with the document that matches the job:\n\n| Goal | Guide | \n|---|---|\n| Choose Cayu concepts and build an application, by hand or with an AI coding agent | `cayu guide authoring#cayu-map` | \n| Configure primary or compatible model services | `cayu guide providers` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/providers.md) ) | \n| Classify and verify tool mutation and replay behavior | `cayu guide tool-effects` | \n| Build a durable propose, authorize, act, verify, and recover lifecycle | `cayu guide durable-operations` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/durable-operations.md) ) | \n| Notify people about durable questions, approvals, and recovery gates | `cayu guide human-attention` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/human-attention.md) ,[example](https://github.com/cayu-dev/cayu/tree/main/examples/human_attention/) ) | \n| Reconstruct service-backed tools with stable identities and scoped knowledge | `cayu guide durable-service-tools` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/durable-service-tools.md) ,[example](https://github.com/cayu-dev/cayu/tree/main/examples/durable_service_tools/) ) | \n| Understand factories, process roles, and lifecycle | `cayu guide anatomy` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/application-anatomy.md) ) | \n| Choose how work starts | [Triggering runs](https://github.com/cayu-dev/cayu/blob/main/docs/triggering-runs.md) | \n| Create per-session workspaces and runners | [Environment factories](https://github.com/cayu-dev/cayu/blob/main/docs/environment-factories.md) | \n| Produce a durable checked patch without external delivery | [Maintained coding product](https://github.com/cayu-dev/cayu/blob/main/docs/coding-product.md) | \n| Deliver an approved exact patch to a new remote Git branch | [Approved remote Git delivery](https://github.com/cayu-dev/cayu/blob/main/docs/remote-git-delivery.md) | \n| Create a bound GitHub PR and observe exact-head checks/reviews | [GitHub delivery](https://github.com/cayu-dev/cayu/blob/main/docs/github-delivery.md) | \n| Implement a runner for your platform | [Build a runner](https://github.com/cayu-dev/cayu/blob/main/docs/build-a-runner.md) | \n| Contain a non-cooperative trusted host dependency behind a hard deadline | [Process-isolated host tools](https://github.com/cayu-dev/cayu/blob/main/docs/process-isolated-tools.md) | \n| Configure network and credential boundaries | [Virtual egress](https://github.com/cayu-dev/cayu/blob/main/docs/virtual-egress.md) | \n| Let an agent search and read bounded public web evidence | [Web fetch and hosted search](https://github.com/cayu-dev/cayu/blob/main/docs/web-fetch.md) | \n| Run GitHub CLI without giving the runner a real token | [GitHub CLI through virtual egress](https://github.com/cayu-dev/cayu/blob/main/docs/recipes/github-cli-virtual-egress.md) | \n| Run a first Control Plane evaluation | `cayu guide evals-first` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/evals-first.md) ) | \n| Add rubric-based AI quality evaluation | `cayu guide evals-ai-quality` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/evals-ai-quality.md) ) | \n| Evaluate production sessions, scenarios, tools, and memory | `cayu guide evals-production` ([source](https://github.com/cayu-dev/cayu/blob/main/src/cayu/guides/evals-production.md) ) | \n| Look up complete Evals contracts | [Evals reference](https://github.com/cayu-dev/cayu/blob/main/docs/evals.md) | \n| Understand knowledge authorization, retrieval fusion, and memory baselines | [Memory foundation contracts](https://github.com/cayu-dev/cayu/blob/main/docs/memory-foundation.md) | \n| Reproduce bounded stateful agent evaluations | [Portable agent snapshots](https://github.com/cayu-dev/cayu/blob/main/docs/runtime-contracts.md#portable-agent-snapshots) | \n| Estimate and govern cost | [Cost optimization](https://github.com/cayu-dev/cayu/blob/main/docs/cost-optimization.md) | \n| Use the application console | [Console](https://github.com/cayu-dev/cayu/blob/main/docs/console.md) | \n| Start a configured server process | [Project server](https://github.com/cayu-dev/cayu/blob/main/docs/project-server.md) | \n| Use, customize, or replace the operator control plane | [Open and replaceable control plane](https://github.com/cayu-dev/cayu/blob/main/docs/control-plane.md) | \n| Start a named worker process | [Project workers](https://github.com/cayu-dev/cayu/blob/main/docs/project-workers.md) | \n| Configure CLI session-store discovery | [Session-store targets](https://github.com/cayu-dev/cayu/blob/main/docs/session-store-targets.md) | \n| Inspect durable sessions safely | [Session inspection](https://github.com/cayu-dev/cayu/blob/main/docs/session-inspection.md) | \n| Configure a control-plane server deployment | [Server configuration](https://github.com/cayu-dev/cayu/blob/main/docs/server-configuration.md) | \n| Embed Cayu behind tenant-aware product APIs | [Server authentication and tenant isolation](https://github.com/cayu-dev/cayu/blob/main/docs/recipes/server-auth-tenancy.md) | \n| Inspect supported model metadata | [Model catalog](https://github.com/cayu-dev/cayu/blob/main/docs/model-catalog.md) | \n| Look up exact runtime behavior | [Runtime contracts](https://github.com/cayu-dev/cayu/blob/main/docs/runtime-contracts.md) | \n| Track prerelease behavior and migrations | [Release notes](https://github.com/cayu-dev/cayu/blob/main/docs/release-notes.md) | \n\nMaintainer-facing architecture is documented in\n[Architecture](https://github.com/cayu-dev/cayu/blob/main/docs/architecture.md),\n[Project layout](https://github.com/cayu-dev/cayu/blob/main/docs/project-layout.md),\nand the [Glossary](https://github.com/cayu-dev/cayu/blob/main/docs/glossary.md).\n\n- [Examples index](https://github.com/cayu-dev/cayu/blob/main/examples/README.md) :\nfind the smallest reference for a capability.\n- `cayu guide references#domain-tool` : credential-free domain-tool authoring\nand generator path.\n- [Local environment runtime](https://github.com/cayu-dev/cayu/blob/main/examples/local_environment_runtime.py) :\nfiles and commands.\n- [Server example](https://github.com/cayu-dev/cayu/blob/main/examples/server_example.py) :\nprotected API and control plane.\n- [Cloud PR reviewer](https://github.com/cayu-dev/cayu/blob/main/docs/recipes/pr-reviewer.md) :\ndurable task, isolated workspace,\nQA, and an explicit external effect.\n- [Business approvals](https://github.com/cayu-dev/cayu/blob/main/docs/recipes/business-approvals.md) :\ndomain approval routing\nover the binary runtime primitive.\n- [GitHub CLI through virtual egress](https://github.com/cayu-dev/cayu/blob/main/docs/recipes/github-cli-virtual-egress.md) :\nan\nunmodified CLI with a virtual token, exact REST policy, and explicit mutation boundary.\n- [Advanced runtime examples](https://github.com/cayu-dev/cayu/blob/main/examples/ADVANCED_RUNTIME_EXAMPLES.md) :\nforks,\ncompaction, taint isolation, speculative approval, and measured evidence.\n\nAdvanced examples are executable runtime specifications. Each example states\nits evidence boundary instead of presenting one strategy as suitable for every\nworkload. Their measured results are described in\n[Advanced runtime strategies](https://github.com/cayu-dev/cayu/blob/main/docs/advanced-runtime-examples.md).\n\nCayu contributors should read\n[CONTRIBUTING.md](https://github.com/cayu-dev/cayu/blob/main/CONTRIBUTING.md) for\nplacement policy, setup, validation commands, and pull-request requirements.\nNew third-party integrations normally live in their own packages against\nCayu's public extension contracts.\n\nReport suspected vulnerabilities privately as described in\n[SECURITY.md](https://github.com/cayu-dev/cayu/blob/main/SECURITY.md). Do not open a public issue or pull request for a\nsuspected security vulnerability.\n\nFor questions and project discussion, join\n[Discord](https://discord.gg/jWa3kKJ7R8). Use\n[GitHub issues](https://github.com/cayu-dev/cayu/issues) for actionable bugs and\nconcrete feature proposals.\n\nCayu is licensed under the\n[Apache License 2.0](https://github.com/cayu-dev/cayu/blob/main/LICENSE).", "url": "https://wpnews.pro/news/build-domain-specific-harness-and-long-horizon-agents-with-os-python-framework", "canonical_source": "https://github.com/cayu-dev/cayu", "published_at": "2026-09-16 03:35:04+00:00", "updated_at": "2026-09-16 04:09:12.997597+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-products", "mlops"], "entities": ["Cayu", "Python", "Claude Agent SDK", "Mastra", "LangGraph", "OpenAI", "Anthropic", "FastAPI"], "alternates": {"html": "https://wpnews.pro/news/build-domain-specific-harness-and-long-horizon-agents-with-os-python-framework", "markdown": "https://wpnews.pro/news/build-domain-specific-harness-and-long-horizon-agents-with-os-python-framework.md", "text": "https://wpnews.pro/news/build-domain-specific-harness-and-long-horizon-agents-with-os-python-framework.txt", "jsonld": "https://wpnews.pro/news/build-domain-specific-harness-and-long-horizon-agents-with-os-python-framework.jsonld"}}