Skip to content

feat(studio): one run per chat, and continue any chat - #1205

Merged
LinuxDevil merged 1 commit into
mainfrom
feat/studio-runs-by-chat
Nov 18, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
feat/studio-runs-by-chat

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Runs listed every SDK trace as its own row, so one conversation showed up as many rows (the implementer showed a dozen "Failed invoke_agent implementer" rows for one stuck chat). This makes each chat one run you can open and keep talking in.

What changes

  • Each chat is its own SDK session. startAgentRun uses the current chat id as the session id. The agent's first chat keeps the agent id, so existing checkpoints and paused approvals are untouched. Checkpoint history, fork and compare follow the agent's current chat.
  • TraceSummary.conversationId (SDK): the root span's gen_ai.conversation.id, so traces can be grouped by chat exactly. Untagged older traces fall into the agent-id chat.
  • Runs screen: one row per chat showing its first message, agent, turns, last activity, tokens and cost. Clicking a row opens that chat on the agent's canvas (?chat=<id>) and makes it current. The latest trace is one click away.
  • Agent Runs tab: a chat table; selecting a chat lists its individual runs below, with ratings and Suggest a fix as before.
  • Chat panel: viewing a past conversation now has Continue this chat. It's disabled while a run is live or paused.
  • POST /agents/:id/chats/:sessionId/open (409 while running or paused, 404 for an unknown chat).
  • After a restart, the agent reopens its most recently active chat instead of always the first one.

Checked

  • Studio server tests 154 (new chatRuns.test.ts: grouping, a new chat gets its own session, reopening the old chat continues it, restart picks the latest chat) and client tests 144.
  • Both typechecks, SDK typecheck, lint on the changed files, and the API report (traces.api.md, one line) are clean.
  • In the browser, with a copy of the deployed implementer:
    • the Runs screen shows 3 chats;
    • clicking one opens it on the canvas as the current chat;
    • the Runs tab lists the selected chat's 2 runs;
    • Continue this chat switches the live chat.

Not covered: flow specs still run under the agent id. The /hooks/_trigger and inbound-event runs join whatever chat is current, as before.

🤖 Generated with Claude Code

Runs listed every SDK trace as its own row, so one conversation showed up as many rows. Each chat now runs in its own SDK session (the agent's first chat keeps the agent id, so existing checkpoints and paused approvals are untouched), traces carry that id as gen_ai.conversation.id, and the Runs screen and the agent's Runs tab show one row per chat with its turns, last activity, tokens and cost. Opening a row switches the agent to that chat so the next message continues it; the agent Runs tab lists the selected chat's individual runs below. The chat panel's past-conversation view gets a Continue this chat button, and a restart reopens the most recently active chat.

TraceSummary gains conversationId.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LinuxDevil
LinuxDevil merged commit da57986 into main Nov 18, 2026
6 checks passed
@LinuxDevil
LinuxDevil deleted the feat/studio-runs-by-chat branch November 18, 2026 12:47
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.

1 participant