Skip to content

Commit e8ebd0f

Browse files
committed
docs(environments): explain startup script constraints and failures
1 parent 775232a commit e8ebd0f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,22 @@ asyncio.run(main())
157157

158158
Every method shown in this document has an async counterpart with the same name and signature. Async streams are opened with `async with await client.sessions.events.stream(...)`.
159159

160+
## Environment startup scripts
161+
162+
Both Forward and Managed accept `config.startup_script`. For cloud environments,
163+
it runs after `setup_script` on the first sandbox start and again on every resume,
164+
before the first tool call. The server enforces a 64 KB limit and a 5-minute
165+
timeout. Scripts must exit; start long-lived services in the background and wait
166+
for readiness when needed.
167+
168+
Failure emits a `session.error` event whose `error.type` is
169+
`environment_startup_failed_error`; the session and sandbox remain usable.
170+
The script is not retried during the same start. For self-hosted environments,
171+
the API stores and returns the script; execution depends on the external worker.
172+
See the official [Forward](https://docs.qoder.com/cloud-agents/api/forward/environments/schemas#environment-startup-script)
173+
and [Managed](https://docs.qoder.com/cloud-agents/api/environments/schemas#environment-startup-script)
174+
contracts.
175+
160176
## Streaming
161177

162178
Streaming responses are consumed incrementally. Close the stream when finished and handle interruption explicitly; closing a local stream does not cancel server-side work.

0 commit comments

Comments
 (0)