Skip to main content
Agents

Stream console logs for a hosted agent session

GET
/agents/{agent_name}/versions/{agent_version}/sessions/{session_id}:logstream

Streams console logs (stdout / stderr) for a specific hosted agent session as a Server-Sent Events (SSE) stream. Each SSE frame contains: - `event`: always `"log"` - `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time — clients should treat it as an opaque string) Example SSE frames: ``` event: log data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} event: log data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} event: log data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} event: log data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} ``` The stream remains open until the client disconnects or the server terminates the connection. Clients should handle reconnection as needed.

Path Parameters
agent_namestringrequired
The name of the hosted agent.
agent_versionstringrequired
The version of the agent.
session_idstringrequired
The session ID (maps to an ADC sandbox).
Query Parameters
api-versionstringrequired
The API version to use for this operation.
Header Parameters
Foundry-Featuresstringoptional
A feature flag opt-in required when using preview operations or modifying persisted preview resources.
HostedAgents=V1Preview
Responses
eventenumrequired
The SSE event type. Currently `log`, but additional event types may be added in the future. Clients should ignore unrecognized event types.
log
datastringrequired
The event payload as plain text. Currently JSON-formatted but the schema is not contractual and may change.