Claude Managed Agents
Render durable session facts and keep tool confirmation distinct from custom execution.
Replay a session
Use @anthropic-ai/sdk@1.3.0 on your server. Managed Agents is a beta API; retain its required beta header and workspace configuration. Never put the API key in the React bundle. The application authenticates access and delivers approved session facts to the client.
events.list auto-paginates; preserve ascending server order. Live events.stream can feed the same application log and projection. Own the replay/live handoff, reconnect and event-ID deduplication in one server/session owner; the stream endpoint does not provide an invented Ghost replay cursor. Use replaceChatRecordsById only after your owner has established event ordering.
Approval is not execution
A session.status_idle with requires_action identifies blocked event IDs. A built-in/MCP tool request can require user.tool_confirmation; an accepted confirmation becomes approval-resolved, not output-ready. The actual native result establishes execution outcome.
An agent.custom_tool_use requires a user.custom_tool_result with custom_tool_use_id and result content after caller-owned execution. Ghost exposes this as managed-client-tool-request data, not boolean approval. Validate the request and authorize execution server-side. Missing/unmatched results stay explicit.
Preview and failure boundaries
Buffered facts are authoritative. Best-effort event_start/event_delta previews remain explicit data and are superseded by buffered messages; they are not durable transcript records or automatically displayed reasoning. Native thinking is a progress signal, not text to reveal. Use a validated custom renderer if your product needs preview data.
See Managed Agents documentation for sessions, event streaming, permissions and custom tools. For React controls, compose Tool with your server command and current request identity; the normalizer does not execute it or supply a hidden transport.