Skip to content

feat: Conversation branching via session fork API #108

Description

@rdwj

Summary

Allow conversations to be forked at any message index — creating a new session that starts from a checkpoint of an existing one. Enables A/B testing of agent configurations, user "what-if" exploration, and red-teaming. Only LangGraph offers this today — a differentiating feature for the framework.

Requirements

  • POST /v1/sessions/{id}/fork endpoint with at_message parameter (0-based index)
  • Creates a new session with messages [0..at_message] copied from the source
  • Forked session inherits tenant context and configuration but gets a new session_id
  • Session store schema changes: messages stored as ordered, addressable sequence (not a single JSON blob)
  • Fork metadata: source_session_id, fork_point tracked for lineage
  • GET /v1/sessions/{id}/forks — list all sessions forked from a given session

FIPS Considerations

No specific concerns. Forking is a data copy operation. No new cryptographic operations introduced.

Implementation Notes

Requires refactoring session storage from blob-level to message-level addressing. Each message gets an index and is independently queryable. This is the most architecturally impactful change in this batch — it affects SqliteSessionStore and PostgresSessionStore schemas and will require a migration path for existing sessions. The fork lineage tracking enables tree visualization of conversation branches for evaluation and debugging workflows.

Companion Issues

Companion issues will be filed on fips-agents/gateway-template, fips-agents/ui-template, fips-agents/fips-agents-cli, and fips-agents/examples.

Size

M-L

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions