feat(agent): opt-in output_file declares session deliverables - #447
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideConverts Sequence diagram for declaring a session deliverablesequenceDiagram
participant Agent
participant Harness
participant OutputFile as output_file
participant EventLog
participant SessionAPI
participant Console
Agent->>Harness: call output_file(path, description, media_type, data)
Harness->>OutputFile: executeOutputFile(sandbox, args)
OutputFile-->>Harness: JSON result without inline data
Harness->>EventLog: emit agent.output_declared
Note over EventLog: Excluded from model context
SessionAPI->>EventLog: read session events
EventLog-->>SessionAPI: agent.output_declared events
SessionAPI-->>Console: outputs[] without data
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Make output_file an opt-in tool (same gate as browser) that marks a file as a keep-this deliverable instead of a default-on write to /mnt/session/outputs/. Successful calls emit agent.output_declared; GET /v1/sessions/:id overlays outputs[] from the event log. Console renders a compact deliverable card and a Declared output Artifacts tab. Closes #341 Co-authored-by: duyet <duyet@users.noreply.github.com>
7ff0d72 to
0e3e2f2
Compare
Closes #341 (part of #347). Coordinates with #340 on the Artifacts panel conceptually; this PR is the tool/declaration side only.
What
output_fileis no longer a default-on write to/mnt/session/outputs/. It is an opt-in tool (sameconfigsgate asbrowser/run_dynamic_worker) that marks a file as a session deliverable:{ "type": "agent_toolset_20260401", "configs": [{ "name": "output_file", "enabled": true }] }{ path, description?, media_type?, data? }(legacyfilename+contentstill writes under/mnt/session/outputs/)agent.output_declared(OMA extension, not in model context)GET /v1/sessions/:idoverlaysoutputs[]from the event log at read time — no new table★ Declared outputbadge + agent description as subtitledatais inline base64 (no sandbox write required);pathis a best-effort sandbox cross-refOut of scope
Why a tool, emitted from the harness
The agent already acts through tools, so
output_fileparticipates in the tool loop, turn history, and hooks. The declaration event is broadcast afteragent.tool_result(same pattern ascall_agent_*thread events) so inlinedatacan live on the event without stuffing base64 into the model-facing result.Test plan
output_fileomitted by default; registered whenconfigsopt indatawrites bytes best-effort and does not echo in the tool resultagent.output_declaredis skipped byeventsToMessages(prompt-cache)GET /v1/sessions/:idincludesoutputs[]pnpm typecheck && pnpm testCould not browser-verify the Artifacts tab or conversation card in a live authenticated session (login needs secrets this run did not invent). Unit tests cover those UIs.
Summary by Sourcery
Enable agents to explicitly declare session deliverables and surface them consistently across the event log, session API, and Console.
New Features:
output_filetool for declaring session deliverables with metadata and optional inline base64 content.Bug Fixes:
Enhancements:
outputs[]from the event log without introducing a new persistence table.Documentation:
Tests: