Symptom
After consuming Agent.run_stream(), streamed.result.workspace is an unavailable placeholder. Reading an artifact through that settled result raises WorkspaceUnavailableError, while streamed.workspace still works.
Evidence what you'll see
- The report's example writes
artifact.txt, runsrun_stream, awaitsget_output(), then readsresult.workspace.result.workspace is workspaceprintsFalse, andawait result.workspace.read_text('artifact.txt')raisesWorkspaceUnavailableError. - The same omission happens after
stream_text(),stream_output(), andstream_response(). - The response still holds the correct
workspace_ref. JSON and pickle reloads are meant to keep omitting the live workspace.
Why it happens
When a run_stream() stream settled, StreamedRunResult.result built its AgentRunResult without attaching the run's workspace. AgentRun.result already attaches it on result.__dict__['_workspace']. Pull request 10048 does the same from self.workspace on the settled-stream branch, including a ReadOnlyWorkspace wrapper.
Affected versions
Python 3.12.14, Linux. Reproduced on main at cd99fbc21959 with a local filesystem workspace. Realtime sessions are out of scope in the pull request.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- After
await streamed.get_output(),result.workspaceis the same object asstreamed.workspace, andawait result.workspace.read_text('artifact.txt')returns the artifact instead ofWorkspaceUnavailableError.
If it still fails
- JSON and pickle reloads still omit the live workspace; that omission is intentional.
- The linked issue does not describe
WorkspaceUnavailableErroron settledrun_stream()results afterv2.55.0.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it