Skip to content

An open-source, faster Devin alternative

TypeScript

v3: remove unimplemented session `usage` from SDK + docs

Igor Zalutskidb212a9de426
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdx
index 54be4e4d..265a38ce 100644
--- a/docs/agent-sessions/api-reference.mdx
+++ b/docs/agent-sessions/api-reference.mdx
@@ -15,7 +15,7 @@ Base URL `https://api.opencomputer.dev/v3`. Management calls authenticate with y
| `POST /sessions/:id/archive` | Cancel any active turn, then close (read-only). |
| `POST /sessions/:id/cancel` | Cooperatively stop the active turn (no-op if not running). |
| `GET /sessions/:id/result` | The result helper — `{ last_turn, result? }` (the resolved final event). |
-| `GET /sessions/:id/turns` · `GET …/turns/:turnId` | Per-turn history: timing, usage, error. |
+| `GET /sessions/:id/turns` · `GET …/turns/:turnId` | Per-turn history: timing, error. |
| `POST /sessions/:id/client-tokens` | Mint a client token. |
`agent` is **required** (create a saved [agent](#agents) first); a resolvable Anthropic [credential](#credentials) is also required (`422 no_credential` otherwise). `key` gives get-or-create (one session per key); a request-level `Idempotency-Key` header makes a keyless create retry-safe. `input` is the task — a string or a full [envelope](/agent-sessions/messaging#message-envelope). For the managed `claude` runtime, put all task-critical context in the task text. `limits` `{ tokens, turn_seconds, turns }` are **non-monetary** — token budget, per-turn wall-clock, auto-run count; hitting one ends the turn with a matching `last_turn.yield_reason`. Destinations on an idempotent create-replay are ignored — manage them via the [destinations API](#destinations).
@@ -27,11 +27,11 @@ Session = { id, status, head, input_cursor,
agent_snapshot: { prompt_hash, model, runtime, revision },
agent_id, credential_id, // resolved + pinned at create
last_turn: { id, state, yield_reason?, result_event_id? },
- usage, limits: { tokens?, turn_seconds?, turns? }, key?, created_at }
+ limits: { tokens?, turn_seconds?, turns? }, key?, created_at }
Turn = {
id, state, yield_reason?, result_event_id?, error?,
- started_at?, completed_at?, active_seconds, usage
+ started_at?, completed_at?
}
```
diff --git a/docs/agent-sessions/durability.mdx b/docs/agent-sessions/durability.mdx
index eaecd223..c5a25beb 100644
--- a/docs/agent-sessions/durability.mdx
+++ b/docs/agent-sessions/durability.mdx
@@ -32,7 +32,7 @@ const res = await fetch(
## Hibernate & resume
-When a session has nothing to do it goes **idle** and its sandbox **hibernates** — the VM is snapshotted and stopped. You pay storage-only while idle; **active seconds only** show up in usage. The next message (a steer, or the next turn) wakes it, typically sub-second, and it continues with prior context.
+When a session has nothing to do it goes **idle** and its sandbox **hibernates** — the VM is snapshotted and stopped. You pay storage-only while idle. The next message (a steer, or the next turn) wakes it, typically sub-second, and it continues with prior context.
<Note>This mirrors [sandbox hibernation](/sandboxes/timeout): idle ≈ free, fast wake. Sessions manage it for you — you don't set a timeout per turn. The runtime's state is also **checkpointed off-box** at each hibernate, so an idle session resumes even if its sandbox is reclaimed.</Note>
diff --git a/docs/agent-sessions/sessions.mdx b/docs/agent-sessions/sessions.mdx
index fc3fb6ec..e2a861e4 100644
--- a/docs/agent-sessions/sessions.mdx
+++ b/docs/agent-sessions/sessions.mdx
@@ -25,7 +25,7 @@ A **session** is the durable unit of an [agent](/agent-sessions/agents) at work:
| `failed` | The session errored out. |
| `archived` | Closed; read-only. |
-A session also carries `last_turn = { id, state, yield_reason?, result_event_id? }` and `usage`; the fuller turn record (`started_at`, `completed_at`, `error`, `active_seconds`, `usage`) comes from [`GET …/result`](/agent-sessions/api-reference) and `…/turns`. The **`yield_reason`** tells you *why* the last turn ended — `completed`, `needs_input` (the agent asked a question — the session is now `awaiting_input`; answer by [steering](/agent-sessions/messaging)), `budget_exceeded` / `deadline_exceeded` / `max_turns` (a [limit](#limits) tripped), or `canceled`.
+A session also carries `last_turn = { id, state, yield_reason?, result_event_id? }`; the fuller turn record (`started_at`, `completed_at`, `error`) comes from [`GET …/result`](/agent-sessions/api-reference) and `…/turns`. The **`yield_reason`** tells you *why* the last turn ended — `completed`, `needs_input` (the agent asked a question — the session is now `awaiting_input`; answer by [steering](/agent-sessions/messaging)), `budget_exceeded` / `deadline_exceeded` / `max_turns` (a [limit](#limits) tripped), or `canceled`.
## Fetch the result
@@ -56,7 +56,7 @@ Response:
## Limits
-Cap a session at create (or default it on the [agent](/agent-sessions/agents)) with `limits: { tokens, turn_seconds, turns }` — a token budget, per-turn wall-clock, and auto-run count. These are **non-monetary** (no dollar caps — we don't bill model usage yet; you run on your own key). Hitting one ends the turn with the matching `yield_reason`. (`usage` is observed-only.)
+Cap a session at create (or default it on the [agent](/agent-sessions/agents)) with `limits: { tokens, turn_seconds, turns }` — a token budget, per-turn wall-clock, and auto-run count. These are **non-monetary** (no dollar caps — we don't bill model usage yet; you run on your own key). Hitting one ends the turn with the matching `yield_reason`.
## Stop a session
diff --git a/sdks/typescript/src/agents/normalize.ts b/sdks/typescript/src/agents/normalize.ts
index b733fcc4..78955e09 100644
--- a/sdks/typescript/src/agents/normalize.ts
+++ b/sdks/typescript/src/agents/normalize.ts
@@ -4,7 +4,7 @@
const NUMERIC = new Set([
"seq", "head", "inputCursor", "inputFromSeq", "inputToSeq", "exitCode", "bytes", "port",
- "numTurns", "revision", "tokens", "turnSeconds", "turns", "activeSeconds", "usd",
+ "numTurns", "revision", "tokens", "turnSeconds", "turns",
"attempts", "responseCode",
]);
diff --git a/sdks/typescript/src/agents/types.ts b/sdks/typescript/src/agents/types.ts
index 1f32ae29..2971413e 100644
--- a/sdks/typescript/src/agents/types.ts
+++ b/sdks/typescript/src/agents/types.ts
@@ -38,8 +38,6 @@ export interface LastTurn {
error?: unknown;
}
-export interface SessionUsage { activeSeconds?: number; usd?: number; tokens?: number; }
-
export interface SessionData {
id: string;
status: SessionStatus;
@@ -48,7 +46,6 @@ export interface SessionData {
agentSnapshot?: { promptHash?: string; model?: string; runtime?: string; revision?: number };
credentialId?: string;
lastTurn?: LastTurn;
- usage?: SessionUsage;
limits?: Limits;
key?: string;
createdAt?: string;