# cairnflow > Cairnflow is a durable execution runtime for AI agents, workflows and stateful services. You write handlers with the TypeScript SDK `@cairnflow/sdk` (or the Python or Go SDK) in your own HTTP service; cairnflow journals every step on object storage, so a crash or a deploy resumes a run where it stopped. Important notes for agents: - Every docs page is also available as Markdown: add `.md` to its URL, e.g. https://cairnflow.dev/docs/quickstart.md. - Every side effect inside a handler must go through `ctx.run(name, fn)` (or `cairnTools` / `cairnMiddleware` for the Vercel AI SDK). Step names are part of the journal. - No `Date.now()`, `Math.random()` or random IDs outside `ctx.run`; never swallow errors around `ctx` commands. - State and durable promises exist only on virtual objects and workflows. - There are three SDKs: TypeScript (`@cairnflow/sdk`), Python (`cairnflow`) and Go (package `cairn`). These docs show TypeScript; the Python SDK and Go SDK pages list what is spelled differently. Do not invent APIs that are not in these docs. - Install the SDKs from their registries: `npm install @cairnflow/sdk`, `pip install cairnflow`, and `go get github.com/cairnflowdev/cairnflow/sdk/go`. - Cairnflow Cloud is in early-access waitlist; self-host today with prebuilt release binaries (Linux, macOS), Docker (`ghcr.io/cairnflowdev/cairnflow`), or from source. Pages, as Markdown: Get started: - [Introduction](https://cairnflow.dev/docs/index.md): What cairnflow is, and when to use it. - [Quickstart](https://cairnflow.dev/docs/quickstart.md): Install a release binary or run Docker, start a node on your own machine, and run a first durable invocation in two minutes. - [Build with AI](https://cairnflow.dev/docs/build-with-ai.md): Copy-paste prompts and Markdown docs so your coding agent can add cairnflow to a project. - [Concepts](https://cairnflow.dev/docs/concepts.md): Services, virtual objects, workflows, the journal and the three rules of handler code. Develop: - [Services and handlers](https://cairnflow.dev/docs/develop/services.md): Declare services, virtual objects and workflows, choose handler types, and serve them with serve(). - [Virtual objects and state](https://cairnflow.dev/docs/develop/state.md): Keyed objects with durable state and one writer at a time. - [Durable steps](https://cairnflow.dev/docs/develop/durable-steps.md): ctx.run, what it guarantees, and what has to go inside it. - [Errors and retries](https://cairnflow.dev/docs/develop/errors-retries.md): Terminal errors, retried errors, retry policies and paused invocations. - [Timers and sleeping](https://cairnflow.dev/docs/develop/timers.md): Durable sleeps, deadlines, and delayed calls. - [Calling other handlers](https://cairnflow.dev/docs/develop/calls.md): Durable request-response calls, one-way sends, idempotency keys, scopes, and attaching to invocations. - [Promises, signals, awakeables](https://cairnflow.dev/docs/develop/promises-signals.md): Wait for a person or an outside system, and complete the wait from another handler or over HTTP. - [Streams, logs and traces](https://cairnflow.dev/docs/develop/streams-logs.md): Stream tokens and progress to a UI, write logs, and record spans with token counts. - [Artifacts](https://cairnflow.dev/docs/develop/artifacts.md): Keep large bytes out of the journal with ctx.artifact, and pass references between steps. - [Schedules](https://cairnflow.dev/docs/develop/schedules.md): Run a handler on a cron expression or a fixed period, managed by cairnflow. - [Typed client](https://cairnflow.dev/docs/develop/client.md): Call services, objects and workflows from your app with @cairnflow/sdk/client. - [Cancellation](https://cairnflow.dev/docs/develop/cancellation.md): Cooperative cancel that lets your code clean up, hard cancel as the fallback, and how steps react. - [Deploying new versions](https://cairnflow.dev/docs/develop/versioning.md): Change handler code without breaking invocations that are already running. - [Local development](https://cairnflow.dev/docs/develop/local-development.md): Run your service on your own machine against a dev environment in Cairnflow Cloud, through an HTTPS tunnel whose URL does not change. - [Python SDK](https://cairnflow.dev/docs/develop/python.md): Write services, virtual objects and workflows in Python with the cairnflow package, serve them, and call them with the Python client. - [Go SDK](https://cairnflow.dev/docs/develop/go.md): Write services, virtual objects and workflows in Go with the cairn package, serve them, and call them with the Go client. Agents: - [Vercel AI SDK](https://cairnflow.dev/docs/agents/vercel-ai-sdk.md): Durable chat agents with streamText, useChat, tools and human approval. - [Human approval](https://cairnflow.dev/docs/agents/approvals.md): Make an agent wait for a person before a tool runs, and answer from the chat, an admin page or a webhook. - [Streaming to the browser](https://cairnflow.dev/docs/agents/streaming.md): How tokens reach the page over SSE, what happens on reload, stop() and failures, and the limits of temporary streams. - [Agents without chatObject](https://cairnflow.dev/docs/agents/custom-agents.md): Build your own agent handler with cairnMiddleware and cairnTools, and the contract the chat transport expects. Workflows: - [Workflows](https://cairnflow.dev/docs/workflows/workflows.md): Multi-step processes that run once per workflow ID. - [Serverless (fetchHandler)](https://cairnflow.dev/docs/workflows/serverless.md): Run services and workflows on Vercel, Cloudflare Workers, AWS Lambda, Deno and Bun. Query with SQL: - [Querying](https://cairnflow.dev/docs/query.md): Ask questions about invocations, journals, state and usage with read-only SQL over POST /query. - [Table reference](https://cairnflow.dev/docs/query/tables.md): Columns, types and meanings of the sys_* tables you can query in an environment. Self-hosting: - [Overview](https://cairnflow.dev/docs/self-hosting.md): What you run when you host cairnflow yourself, the deployment shapes, and the ports involved. - [Object stores](https://cairnflow.dev/docs/self-hosting/storage.md): Store URIs, S3 credentials, the startup capability checks, and which object stores cairnflow supports. - [Running a cluster](https://cairnflow.dev/docs/self-hosting/cluster.md): Several cairnflow nodes on one bucket, addressing rules, failover, and splitting and merging key ranges. - [Docker](https://cairnflow.dev/docs/self-hosting/docker.md): Running cairnflow from the container image, and a two-node cluster on SeaweedFS with Docker Compose. - [Configuration](https://cairnflow.dev/docs/self-hosting/configuration.md): The important cairnflow runtime flags, their environment variables and defaults, grouped by purpose. - [Security](https://cairnflow.dev/docs/self-hosting/security.md): API keys and roles, tenants, console sessions, single sign-on, request identity, TLS and outbound request policy for self-hosted cairnflow. - [Operations](https://cairnflow.dev/docs/self-hosting/operations.md): Health checks, metrics, logs, graceful shutdown, upgrades and the SST disk cache for a self-hosted cairnflow. - [Backup and restore](https://cairnflow.dev/docs/self-hosting/backup-restore.md): What can be recovered in a self-hosted cairnflow, and how to use cairn-ctl to verify, back up, restore and recover from the trash. Cairnflow Cloud: - [Overview](https://cairnflow.dev/docs/cloud.md): The hosted service — organizations, environments, region, and what the Beta includes. - [API keys and identity](https://cairnflow.dev/docs/cloud/api-keys.md): The environment endpoint, API keys and their roles, console sign-in, and the identity key your service checks. - [Deployments](https://cairnflow.dev/docs/cloud/deployments.md): Register your service's URL, choose the transport, and ship new versions without breaking runs in flight. - [The console](https://cairnflow.dev/docs/cloud/console.md): Follow invocations step by step, see why one is waiting, act on it, query with SQL, and read usage and the audit log. - [Beta limits](https://cairnflow.dev/docs/cloud/limits.md): What every Cairnflow Cloud environment is allowed during the Beta, and what happens at each limit. - [Known limitations](https://cairnflow.dev/docs/cloud/known-limitations.md): What Cairnflow Cloud and the SDK do not do yet during the Beta. - [Data and deletion](https://cairnflow.dev/docs/cloud/data-and-deletion.md): What Cairnflow Cloud stores for an environment, how long it keeps it, and what deleting an environment does. Reference: - [HTTP API](https://cairnflow.dev/docs/reference/http-api.md): Reference for the cairnflow ingress and admin HTTP API, grouped by area, with parameters and main responses. - [Errors](https://cairnflow.dev/docs/reference/errors.md): The cairnflow error body, HTTP status codes, machine-readable error codes, invocation failure codes, and what clients should retry. - [CLI](https://cairnflow.dev/docs/reference/cli.md): Reference for the cairn command-line client, plus a summary of the cairn-ctl recovery tool. - [Flow control](https://cairnflow.dev/docs/reference/flow-control.md): Scopes, limit keys, concurrency and rate rules, how 429 differs from 202, and the diagnostics endpoints. ## Documentation Sets - [Abridged documentation](https://cairnflow.dev/llms-small.txt): a compact version of the documentation for cairnflow, with non-essential content removed - [Complete documentation](https://cairnflow.dev/llms-full.txt): the full documentation for cairnflow - [Agents](https://cairnflow.dev/_llms-txt/agents.txt): Durable AI agents with the Vercel AI SDK: steps, approvals, streaming - [SDK](https://cairnflow.dev/_llms-txt/sdk.txt): The TypeScript SDK: services, state, steps, errors, timers, calls, promises, streams, schedules, client ## Notes - The complete documentation includes all content from the official documentation - The content is automatically generated from the same source as the official documentation