---
title: How Agents Work on Caveman Cloud
description: "Understand the four core primitives of Caveman Cloud agents: deterministic AGENT.md builds, immutable Deployments, durable Sessions, and zero-credential Sandboxes."
canonical: https://docs.caveman.so/agents/overview
product: Caveman Cloud
tab: Documentation
group: Build & Deploy Agents
---

# How Agents Work on Caveman Cloud

> Understand the four core primitives of Caveman Cloud agents: deterministic AGENT.md builds, immutable Deployments, durable Sessions, and zero-credential Sandboxes.

An agent on Caveman Cloud is a plain folder holding an `AGENT.md` file (or a TypeScript `defineAgent()` definition that compiles to the same manifest). You build it deterministically, deploy immutable revisions under a deployment name, run durable sessions that park at zero compute between turns, and attach sandboxes, connectors, secrets, and Drives cleanly outside the loop.

Want to deploy a working agent immediately? Start from a template in [Templates & Quick Setups](/templates).

## The four core primitives

### 1. Agent Build (`AGENT.md` -> `agent.json`)

Every agent compiles to a deterministic `agent.json` manifest whose identity is its SHA-256 digest. Files are sorted bytewise with no timestamps, local paths, or secrets embedded. Re-deploying an unchanged folder creates no new version and no new revision.

```bash
cvm agent init pr-reviewer ./my-agent
cvm agent build ./my-agent
```

Read the full frontmatter and folder specification in [AGENT.md Format](/agents/agent-md).

### 2. Deployment & Immutable Revisions

A **Deployment** runs one named agent in production (or preview). Each `cvm deploy` or git push records an immutable revision with its agent version, model and budget settings, trigger (`cli`, `api`, `git`, or `rollback to N`), and commit and branch metadata when built inside a git checkout. Rolling back creates a new revision pointing back to an earlier one.

```bash
cvm deploy ./my-agent --budget 2
cvm deployments revisions pr-reviewer
cvm deployments rollback pr-reviewer 1
```

Pull-request builds deploy only as isolated preview deployments and never become the agent's latest production version. Preview deployments receive only secrets explicitly opted into `preview`.

### 3. Durable Sessions

Every piece of agent work is a **Session** backed by one append-only event log. That single log is the session's transcript, trace, cost ledger, step fence, and fork point:

- **Zero-compute parking.** When a session waits for a human approval, Slack reply, webhook, or timer, it parks cleanly and consumes zero compute while waiting.
- **Step fencing.** Declaring `effect: external` on irreversible tools ensures crash recovery and retries do not duplicate external side effects.
- **Time-travel forking and replay.** Fork any session at any sequence number (`cvm sessions fork`) to test another model or prompt, or export a production failure straight into a deterministic eval case (`cvm sessions to-eval`).

### 4. Compute Outside the Loop

The agent harness runs outside any customer code sandbox. A **computer** is an opt-in capability an agent requests rather than where the agent lives:

| `computer` tier | What the agent receives | When to use |
| --- | --- | --- |
| `none` | Declared custom tools, connectors, and Drives only; zero coding or shell tools | Support bots, Q&A, triage, PR review, scheduled digests |
| `code` | Sandboxed code-tool execution without a full Linux shell | Deterministic math, structured transforms, data checks |
| `linux` | An isolated Firecracker Linux sandbox provisioned lazily on the first tool call | Coding tasks, running test suites, building artifacts, CLI tools |

Provider credentials and user logins stay outside the sandbox at all times. Only explicitly declared organization secrets (`secrets: [NAME]`) are passed to commands that run in scope.

## Bring your own agent framework

Agents built with another framework (LangGraph, CrewAI, Pydantic AI, Vercel AI SDK, or custom code) deploy as a container implementing the `invocations.v1` contract and receive the same Deployments, Sessions, logs, traces, and cost tracking. You can also route any external agent through the gateway with a base-URL swap; see [Connect a Workload](/guides/connect-workload).

## Next steps

- [AGENT.md Format](/agents/agent-md): All 14 frontmatter keys, folder layout, determinism rules, and build limits.
- [Deploy, Run & Rollback](/agents/deploy-and-run): Local dev server, dry-run deploys, session streaming, time-travel forks, and rollbacks.
- [Connectors & Secrets](/agents/connectors-and-secrets): Org-wide MCP servers and environment-scoped secrets with zero credentials in builds.
- [Drives, Rooms & Workflows](/agents/drives-rooms-workflows): Versioned filesystems, multi-agent task rooms, tenant Apps, Listeners, and durable workflows.
