Skip to main content

Patterns and practices

  • Create a stable request ID before sending an intent; retain the identity for recovery.
  • Submit only new user text to the published Agent; render canonical server output.
  • Use one owned client/transport per protected view and clean up on unmount/sign-out.
  • Separate observer disconnect from explicit cancellation.
  • Show response, memory and graph stages independently.
  • Read embedding metadata from the backend and use explicit readiness barriers when required.
  • Keep asset/version selectors and bounded job references; fetch bytes freshly through the owned authenticated origin.
  • Apply a suggestion only against the exact current artifact version.
  • Clear private views on auth expiry/revocation and ignore superseded connection callbacks.
  • Keep model policy, credentials, graph service grants and callback secrets in trusted services.

Ordinary applications use the runtime client or AI SDK 7 remote transport. Explicit root SDK domain/admin APIs serve independent memory/maintenance needs. Do not add duplicate model/tool execution, extraction or transcript writes to a runtime turn.

Additive installation and independent application updates preserve host ownership. Review plans and conflicts before applying an update; interrupted external operations need receipt-based reconciliation. See CLI reference.

Advanced record operations​

TaskSupported operation and result
Conversation history pagesconversations.getHistory(id, { limit, offset, sortOrder, roles, since, until }) returns messages, total and hasMore; use offset plus the returned message count for the next page.
Conversation/user registry pagesconversations.list and users.list return arrays with total, effective limit/offset and hasMore. These pages are rolling reads.
Attachment pagesattachments.list({ memorySpaceId, cursor, limit }) returns attachments, total, optional cursor and hasMore; retain the server cursor unchanged.
Retained versionsMemory, facts, immutable, users, contexts and artifacts expose their own version/history methods. A missing or purged version returns null where specified. Timestamp reads select retained history, not an atomic snapshot of every layer.
Mutable atomic workmutable.transaction validates and commits its set/update/delete/counter batch in one backend mutation. mutable.update's local updater reads then writes and does not protect against concurrent lost updates.
Ownership-closure exportusers.exportData uses the fixed admin transport; stage privately and commit only after the terminal manifest and normal iterator completion.
Supported erasureusers.delete with cascade uses the fixed erasure transport and reports selected-domain receipts, exclusions and unknown outcomes. fullUserDataErased remains false.

See the concrete conversation pagination example, context tree and history example, immutable history example, mutable transaction example and export/erasure workflows.