Skip to content

Add session_id tracking to messages for multi-agent support - #138

Merged
mpfaffenberger merged 1 commit into
mpfaffenberger:mainfrom
janfeddersen-wq:feature/session-id-tracking
Dec 18, 2025
Merged

Add session_id tracking to messages for multi-agent support#138
mpfaffenberger merged 1 commit into
mpfaffenberger:mainfrom
janfeddersen-wq:feature/session-id-tracking

Conversation

@janfeddersen-wq

Copy link
Copy Markdown
Contributor

This enables GUI clients to identify which agent emitted each message, solving the issue of interleaved messages when multiple sub-agents run in parallel.

Changes:

  • Add optional session_id field to BaseMessage (backward compatible)
  • Add set_session_context/get_session_context to MessageBus
  • Auto-tag messages with current session_id in emit()
  • Set/restore session context in invoke_agent tool

When an agent invokes a sub-agent, the session_id is set as the current context. All messages emitted during that sub-agent's execution are automatically tagged. The previous context is restored when the sub-agent completes.

This enables GUI clients to identify which agent emitted each message,
solving the issue of interleaved messages when multiple sub-agents run
in parallel.

Changes:
- Add optional session_id field to BaseMessage (backward compatible)
- Add set_session_context/get_session_context to MessageBus
- Auto-tag messages with current session_id in emit()
- Set/restore session context in invoke_agent tool

When an agent invokes a sub-agent, the session_id is set as the current
context. All messages emitted during that sub-agent's execution are
automatically tagged. The previous context is restored when the sub-agent
completes.
@mpfaffenberger
mpfaffenberger merged commit 79cf50d into mpfaffenberger:main Dec 18, 2025
1 of 3 checks passed
mpfaffenberger pushed a commit that referenced this pull request Dec 30, 2025
This enables GUI clients to identify which agent emitted each message,
solving the issue of interleaved messages when multiple sub-agents run
in parallel.

Changes:
- Add optional session_id field to BaseMessage (backward compatible)
- Add set_session_context/get_session_context to MessageBus
- Auto-tag messages with current session_id in emit()
- Set/restore session context in invoke_agent tool

When an agent invokes a sub-agent, the session_id is set as the current
context. All messages emitted during that sub-agent's execution are
automatically tagged. The previous context is restored when the sub-agent
completes.
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