Skip to content

An open-source, faster Devin alternative

TypeScript

docs: consistency pass over the memory, React and webhook pages

Igor Zalutskie284139f882d
diff --git a/docs/agents/document-memory.mdx b/docs/agents/document-memory.mdx
index b81c503c..8a64e3ad 100644
--- a/docs/agents/document-memory.mdx
+++ b/docs/agents/document-memory.mdx
@@ -85,7 +85,8 @@ Session inspection returns a `memory` array. Entries contain `resource`,
for read-only bindings, frozen/deleted documents and ended sessions.
Reusing a session-create `Idempotency-Key` requires identical agent, deployment,
-environment and bindings; incompatible inputs return `409 conflict`.
+environment and bindings; incompatible inputs return `409 idempotency_conflict`.
+The [management API](/agents/api#create) page has the full rules.
### Start a session on a new document
@@ -135,7 +136,9 @@ run the first turn at once, and `--json` for the ids.
Over HTTP, send `PUT .../documents/<id>` with `If-None-Match: *`, treat `412`
as "exists" (then `GET` it; `404` means the id was deleted), and `POST
/api/managed-agents/sessions` with an `Idempotency-Key`; `201` created the
-session, `200` returned the one that key had already created.
+session, `200` returned the one that key had already created. The helper's
+signature and errors are in the
+[TypeScript SDK reference](/reference/typescript-sdk#serverless-agents-helpers).
## Reading
@@ -243,10 +246,10 @@ A committed save whose reply was lost can conflict on retry. Read current
content before writing again. Separately, **model-generation retries can
render again using newer memory**; they do not preserve the same projection.
-Observed saves produce `memory.saved` events with `resource`, `documentId`,
-`revision`, `bytes`. Delivery is best-effort: a write can commit without a
-reply or event. Refresh documents when attaching, reconnecting and completing
-work.
+Observed saves produce `memory.saved` [session events](/agents/events#memory)
+with `resource`, `documentId`, `revision`, `bytes`. Delivery is best-effort: a
+write can commit without a reply or event. Refresh documents when attaching,
+reconnecting and completing work.
## Owner access
@@ -339,7 +342,8 @@ and exports remain. Use a new ID for new notes.
## Management API
-Use `x-api-key: <api-key>` and project access. Every route requires
+Use `x-api-key: <api-key>` on `https://app.opencomputer.dev`, as for the rest
+of the [management API](/agents/api). Every route requires
`environment=development` or `environment=production` as a query parameter.
Below, `<p>` is the project ID and `<r>` the resource ID.
diff --git a/docs/agents/memory-providers.mdx b/docs/agents/memory-providers.mdx
index b23e5f6c..5c929297 100644
--- a/docs/agents/memory-providers.mdx
+++ b/docs/agents/memory-providers.mdx
@@ -260,5 +260,6 @@ consumes model context.
- **Ownership:** the provider supplies retention, backups, inspection, export
and deletion. OpenComputer document editing/freezing applies only to
`documentMemory`; deleting a project does not delete remote data.
-- **Inspection:** the proposed Memory page identifies the provider. Session
- inspection exposes namespace and partition so owners can locate remote data.
+- **Inspection:** the [resource inventory](/agents/document-memory#resource-inventory)
+ identifies each resource's provider. Session inspection would expose
+ namespace and partition so owners can locate remote data.
diff --git a/docs/agents/memory.mdx b/docs/agents/memory.mdx
index 1d1be995..5bc67baa 100644
--- a/docs/agents/memory.mdx
+++ b/docs/agents/memory.mdx
@@ -56,7 +56,7 @@ Treat saved text as data the model reads, not as instructions it follows.
## Bind a document to a session
Include `memory` when creating a [session](/agents/sessions) with
-`POST /api/managed-agents/sessions`:
+`POST /api/managed-agents/sessions` ([management API](/agents/api#create)):
```json
{
@@ -82,6 +82,11 @@ credentials nor permission to select another document. A
[collection binding](/agents/document-memory#session-bindings) instead lets it
browse documents with `memory_list` and `memory_read`.
+The document must exist before the session binds it. `startSessionOnDocument`
+in the [TypeScript SDK](/reference/typescript-sdk#serverless-agents-helpers)
+creates it if needed and then the session, and the CLI's
+`session create --memory notes=workshop --create-document` does the same.
+
## Save and reuse notes
Saving is explicit: the model calls `memory_save({ text })`. Each save replaces
@@ -90,7 +95,9 @@ Conversation history is not automatically extracted into memory.
Sessions bound to the same document share its latest saved text. Each model
step reads it again; [revision checks](/agents/document-memory#saving) prevent
-an agent from overwriting changes made since its read.
+an agent from overwriting changes made since its read. A successful save is
+reported as a `memory.saved` [session event](/agents/events#memory), delivered
+best-effort.
Memory belongs to a **project and environment**. It survives session end,
sandbox loss, conversation compaction and new deployments. Development and
diff --git a/docs/agents/react.mdx b/docs/agents/react.mdx
index a0f5f247..9e3e26e4 100644
--- a/docs/agents/react.mdx
+++ b/docs/agents/react.mdx
@@ -40,21 +40,23 @@ const { session } = await startSessionOnDocument({
apiKey: process.env.OPENCOMPUTER_API_KEY!,
projectId: process.env.OPENCOMPUTER_PROJECT_ID!,
environment: "development",
- agent: "topic-worker",
- resource: "topics",
- documentId: topicId,
- document: { title },
- idempotencyKey: `topic/${topicId}/${user.id}`,
+ agent: "<agent-id>",
+ resource: "notes",
+ documentId: "workshop",
+ document: { title: "Workshop notes" },
+ idempotencyKey: `workshop/${user.id}`,
});
-// Store session.id with the topic; the browser attaches to it.
+// Store session.id with the workshop; the browser attaches to it.
```
Without memory, `POST /api/managed-agents/sessions` with `x-api-key` and
-`{ "agentId": "<agent-id>@development" }` returns `{ session: { id } }`.
+`{ "agentId": "<agent-id>@development" }` returns `{ session: { id } }`. Both
+are [management API](/agents/api#sessions) calls.
### 2. Proxy three routes
-The hook needs exactly these, relative to its `basePath`:
+The hook needs exactly these [management API](/agents/api) routes, relative
+to its `basePath`:
| Route | Purpose |
| --- | --- |
@@ -101,7 +103,7 @@ envelope `{ error: { message } }`.
```tsx
import { useAgent } from "@opencomputer/react";
-export function TopicChat({ sessionId, onNotesChanged }: { sessionId: string; onNotesChanged: () => void }) {
+export function WorkshopChat({ sessionId, onNotesChanged }: { sessionId: string; onNotesChanged: () => void }) {
const { messages, send, stop, isReplaying, isRunning, error } = useAgent({
sessionId,
basePath: "/api/agent",
@@ -148,8 +150,8 @@ Every `memory.saved` event the session records
owner route when one arrives. Saves are reported best-effort: a document
can change without an event, so also refresh when the user opens the panel.
-Any other event is available through `onEvent`, for example tool activity for
-an activity view.
+Every event is available through `onEvent`, for example tool activity for an
+activity view; the types are listed on [Session events](/agents/events).
## Create a session from the browser
diff --git a/docs/agents/webhooks.mdx b/docs/agents/webhooks.mdx
index c22fe3d8..db2ea3ed 100644
--- a/docs/agents/webhooks.mdx
+++ b/docs/agents/webhooks.mdx
@@ -75,8 +75,8 @@ with your API key; the session id there is authoritative, since a retried
start can use a different session than the one first announced:
```bash
-curl 'https://app.opencomputer.dev/api/managed-agents/projects/<project-id>/webhooks/<webhook-id>/requests?environment=production' \
- -H 'Authorization: Bearer <api-key>'
+curl 'https://app.opencomputer.dev/api/managed-agents/projects/<project-id>/webhooks/<webhook-id>/requests' \
+ -H 'x-api-key: <api-key>'
```
Each delivery needs an identity so that a retry does not start a second
@@ -159,3 +159,5 @@ identity source to the field that names the delivery, for example
Development and Production webhooks have separate URLs, tokens, and sessions.
Disable or remove a webhook when its caller should no longer start sessions.
+The webhook routes are listed on the [management API](/agents/api#webhooks)
+page.