condensate

Build your own product on the Condensate runtime

The HTTP API, resumable streams, AG-UI and the SDK.

On this page

Condensate's own apps are built on the runtime through the same HTTP API it serves to you, on 127.0.0.1:4741 in the developer setup and on port 24741 if you used the installer. Your product can read a thread's events, follow them live, send work and start new threads over that API, or through the TypeScript SDK that wraps it.

Streams you can reconnect to

Every thread is an append-only log in SQLite, and each event is stored before any stream reads it. A stream keeps no state of its own. When the runtime stores an event it signals every follower waiting on that thread, and each follower reads the log from its own position. A client that disconnects reconnects with the last position it stored, as after or as the Last-Event-ID header, and gets exactly what it missed.

RouteWhat it carries
GET /threads/:id/tailOne page of stored events, up to 1000. after reads forward, before reads older events newest first.
GET /threads/:id/followStored events as server-sent events, from after or Last-Event-ID.
GET /threads/:id/streamLive text and thinking as it is generated. It has no positions and replays nothing, and a slow reader loses its oldest frames.
GET /threads/:id/aguiThe thread as AG-UI events, the open protocol chat front ends read, with stored history and live deltas folded together.
GET /threads/:id/agui-pageOne reverse page as AG-UI frames, for chat clients that open at the end and page back.
GET /workspaces/:name/changesWhich threads in a workspace moved, and to which position.

Use follow or agui when you need a record and stream when you only need what is happening now. Order comes from stored events, never from deltas. The change stream sends positions rather than events for up to 256 threads in one workspace, and each thread you subscribe starts with its current position, so a reconnecting client needs no extra tail read. The HTTP reference lists every route.

The SDK

@condensate/agents-sdk is a TypeScript client for the API, built on the Effect library. It decodes every response against a schema and fails with one of three typed errors, AgentsTransportError, AgentsRejected and AgentsDecodeError. It ships with early access and is not published on npm.

Its follower keeps one cursor across reconnects. It uses the push route when the runtime has one and polls tail with the same cursor when it does not, so no event is delivered twice across the change. Use the TypeScript SDK has runnable examples.

import { Agents } from "@condensate/agents-sdk"
import { Effect } from "effect"

// Store the last event position and pass it back as `after` on reconnect.
const resume = (threadId: string, lastPosition: number) =>
    Effect.map(Agents, (agents) => agents.follow(threadId, { after: lastPosition }))

Code mode

Code mode lets an agent run one short JavaScript program against typed namespaces in a sandbox instead of making one model round trip per tool call. It is off by default. CONDENSATE_CODE_MODE turns it on, and only the principals in CONDENSATE_CODE_MODE_PRINCIPALS see it. Each run is capped at 10 seconds of JavaScript time, 20 tool calls, 100 namespace calls and a 64 KiB result, and hitting a cap returns a typed error that names it. Code mode and credits has the rest.

Where agents run

An agent runs as a process on the runtime's machine unless it is placed somewhere else. The runtime can also run it as a pod on a Kubernetes node, in a container, or on a worker, another machine that joined to lend what the main one cannot do. Every start passes one admission check, and a refusal gives the same reason whichever runner the check ran for. Where agents run explains how the runtime picks.

Long tasks and the context window

The runtime keeps the full history and reduces only what the model sees next, cheapest step first. A step that frees less than 10% of the window gives way to the next one. The first step clears older large tool results that can be read again and keeps the last 5. The second clears older action results too and leaves a note of up to 200 characters for each. The third keeps the newest 20,000 estimated tokens as written and summarizes what came before. Results under 1,500 characters are never cleared by the first two steps.

On Claude Code the runtime switches off the CLI's own compaction and builds the window itself. On Codex it raises the native limit so its own steps run first. The model's view is rendered from the log, so two renders of one log are byte-identical and the provider's prompt cache holds. Context windows and memory has the detail.

Checkouts

Every task gets its own git worktree. A keeper returns finished worktrees and watches free disk. Each of its rules starts in observe mode, where it reports what it would do, and acts only once you set it to act in CONDENSATE_KEEPER_MODES. A return names the reservation the keeper saw, so it fails instead of wiping the files of a task that has since taken the worktree. With the disk rule set to act, new tasks pause while free disk is under 10 GB and resume once it is back over 30 GB.

When something fails

FaultWhat the runtime does
The host restarts during a runAt boot the runtime marks the run as lost and waits for a person to press Resume. Nothing re-runs by itself.
A run dies of a passing fault before any tool has startedThe run retries once. After a tool has started it does not retry, so a side effect is never replayed.
An account refuses for quotaThe task moves to the next account in its workspace. A stream that has already sent text is not moved.
Every account in the workspace is outThe refusal names each account, why it is out, and the earliest reset.
A login is rejectedThe account is marked as needing sign-in, and the task moves to the next account.
A restart is requested while runs are activeNew requests get HostDraining with the list of active threads, and the restart script waits for them to finish.