You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a Conversation.fork() primitive in openhands-sdk that deep-copies a conversation object — agent config, event log, workspace metadata — and assigns a new ID. Expose it through the agent-server REST API as POST /api/conversations/{id}/fork.
This is the general-purpose primitive that #1787 (fork-on-tool-change) and OpenHands/OpenHands#8560 (UI fork feature) both need. Building it once at the SDK layer means downstream apps don't have to re-implement it.
Motivation
Downstream apps that surface system-generated conversations (CI runs, scheduled pipelines, agent-on-agent tasks) need a way to let humans branch off a run for follow-up exploration without contaminating the original audit trail.
The only workaround today is to start a fresh conversation and replay the original transcript as a synthesized initial_message. That loses event-level fidelity:
Action/observation tool_call_id pairing
LLM token/cost metrics from the original run
Condenser state (LLMSummarizingCondenser keep_first window, etc.)
Thinking blocks
Hook execution records
These all matter when the fork wants to continue an actual agentic loop, not just re-summarize text.
Concrete use cases:
Internal dashboards (e.g. Qortex Dashboard) where pipeline-generated reports/decisions are read-only audit records but humans want to ask follow-up questions
CI agents that produced a wrong patch — engineer forks to debug without losing the original run
A/B-testing prompts: fork at a given turn, change one variable, compare downstream
Summary
Add a
Conversation.fork()primitive inopenhands-sdkthat deep-copies a conversation object — agent config, event log, workspace metadata — and assigns a new ID. Expose it through the agent-server REST API asPOST /api/conversations/{id}/fork.This is the general-purpose primitive that #1787 (fork-on-tool-change) and OpenHands/OpenHands#8560 (UI fork feature) both need. Building it once at the SDK layer means downstream apps don't have to re-implement it.
Motivation
Downstream apps that surface system-generated conversations (CI runs, scheduled pipelines, agent-on-agent tasks) need a way to let humans branch off a run for follow-up exploration without contaminating the original audit trail.
The only workaround today is to start a fresh conversation and replay the original transcript as a synthesized
initial_message. That loses event-level fidelity:These all matter when the fork wants to continue an actual agentic loop, not just re-summarize text.
Concrete use cases:
Proposed API
SDK primitive
Behavior:
conversation_id(UUID) andpersistence_diragentdeep-copied (or replaced via the kwarg — that's how Proposal: Fork conversation when tools change #1787's tool-change case slots in)eventsdeep-copied; source conversation untouchedworkspace,confirmation_policy,security_analyzercopied verbatimstatsreset (cost on the fork starts at 0)execution_status=idleAgent-server REST endpoint
Auth/permissions follow whatever the existing PATCH/DELETE endpoints use.
Out of scope
Relationship to existing issues
conversation.fork(agent=agent_with_new_tools))Happy to put together a PR if the API shape looks right.