Skip to content

docs: artifact panel & agent file return design doc#344

Closed
baryhuang wants to merge 3 commits intoopenagents-org:developfrom
baryhuang:feat/artifact-panel-file-return
Closed

docs: artifact panel & agent file return design doc#344
baryhuang wants to merge 3 commits intoopenagents-org:developfrom
baryhuang:feat/artifact-panel-file-return

Conversation

@baryhuang
Copy link
Copy Markdown
Collaborator

@baryhuang baryhuang commented Apr 13, 2026

Problem: Agent responses never include file attachments in thread messages.

  1. Agent uses workspace_write_file MCP tool — file uploads but response message has no attachments. File appears in Files panel only.
  2. Agent uses local Write tool — file saved to disk, never reaches workspace storage. User cannot see it.
  3. Thread UI treats only images and HTML as previewable. Markdown/code/text show as download links.

Decisions

  • Auto-upload on local Write: When Claude adapter sees a Write tool_use in the CLI stream, it reads file_path and content and uploads to /v1/files/base64. No prompt changes needed.
  • Collect uploaded files at response time: Before _send_response(), adapter queries GET /v1/files?channel_name=X&uploaded_by=openagents:Y for files this agent uploaded. Attaches them to the response.
  • Dedup via _attached_file_ids: Files already attached in previous responses are skipped.

Changes

  • sdk/src/openagents/adapters/base.py — _channel_uploaded_files tracking, track_uploaded_file(), _send_response() passes attachments
  • sdk/src/openagents/adapters/claude.py — _upload_local_file() on Write tool_use, _collect_uploaded_files() queries backend
  • sdk/src/openagents/client/workspace_client.py — channel_name and uploaded_by params on list_files()
  • workspace/backend/app/routers/files.py — channel_name and uploaded_by filters on GET /v1/files
  • packages/go and workspace/frontend chat-message.tsx — isPreviewable() expanded for markdown/text/code

Test

  1. pip install -e . && start backend on :8000 && frontend on :3001
  2. Create agent: openagents create claude --name test-bot --join-workspace TOKEN --endpoint http://localhost:8000
  3. Send: create a markdown file about X
  4. Agent Write tool fires -> adapter auto-uploads -> response shows eye icon attachment
  5. Click -> file preview renders markdown

Not in scope

  • Artifact side panel (click still navigates to files view)
  • Inline artifact detection from message text
  • Orchestrator path (SimpleAutoAgent) not wired

Documents the current thread message flow, file upload architecture,
identified gaps in agent file return and artifact rendering, and a
phased implementation plan.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

@baryhuang is attempting to deploy a commit to the Raphael's projects Team on Vercel.

A member of the Team first needs to authorize it.

When an agent uploads files via workspace_write_file MCP tool, those
files now appear as attachments on the agent's response message in the
thread UI. Previously files only appeared in the Files panel.

Changes:
- Base adapter: track uploaded files per channel, attach on _send_response()
- Claude adapter: query for uploaded files before sending final response
- Backend: add channel_name/uploaded_by filters to GET /v1/files
- Frontend: expand isPreviewable() to include markdown, text, and code files
@baryhuang baryhuang force-pushed the feat/artifact-panel-file-return branch from 0f287b4 to 520f170 Compare April 13, 2026 08:23
When the Claude adapter detects a Write tool_use in the CLI stream,
it uploads the file content to /v1/files/base64 and tracks it for
attachment on the response message. This closes the gap where agents
create files locally but the user never sees them in the thread.
@nebukaga nebukaga closed this in 2354bc9 Apr 14, 2026
@zomux
Copy link
Copy Markdown
Contributor

zomux commented Apr 14, 2026

Merged into develop via 2354bc9. All 3 commits cherry-picked cleanly — no adjustments needed. Thanks @baryhuang!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants