Claude Managed Agents
Render a Claude Managed Agents session and show when it needs tool confirmation.
Load events from a session
Install the SDK on your server.
Managed Agents uses a beta API. Configure the required beta header and workspace on the server. Authenticate requests there and send only the session events the browser is allowed to see.
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
When session.status_idle reports requires_action, check which event IDs are blocked. A built-in or MCP tool can request user.tool_confirmation. An accepted confirmation becomes approval-resolved. Wait for the actual tool result before showing output-ready.
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.