Skip to content

feat: include endpoints to interact with specific agent sessions#943

Open
miguelangarano wants to merge 6 commits intoRightNow-AI:mainfrom
miguelangarano:feat/session-interactions
Open

feat: include endpoints to interact with specific agent sessions#943
miguelangarano wants to merge 6 commits intoRightNow-AI:mainfrom
miguelangarano:feat/session-interactions

Conversation

@miguelangarano
Copy link
Copy Markdown

Summary

This PR introduces the ability to interact with and retrieve specific agent sessions directly, bypassing the agent's default active session. This enables clients to multiplex multiple independent conversations with the same agent simultaneously over HTTP or a single WebSocket connection, while keeping the context and memory of each session strictly isolated.

Changes

  • New API Endpoints:
    • Added GET /api/sessions/{id} to fetch the conversation history of any specific session.
    • Added POST /api/agents/{id}/sessions/{session_id}/message to send a synchronous message to a specific session.
    • Added POST /api/agents/{id}/sessions/{session_id}/message/stream for SSE streaming to a specific session.
  • Kernel Updates:
    • Modified send_message_with_handle_and_blocks and send_message_streaming to accept an optional target_session_id.
    • Updated execute_llm_agent to use the target session if provided, otherwise falling back to the agent's active session.
  • WebSocket Enhancements:
    • WS payload can now accept an optional session_id to route messages.
    • Enforced session_id as a mandatory field in all outgoing WS events (typing, text_delta, response, error, etc.) to allow clients to reliably filter and route incoming streams. If the client doesn't provide one, it resolves and returns the agent's active session ID.
  • Testing:
    • Added test_specific_session_messaging in api_integration_test.rs to verify session isolation, message routing, and specific session retrieval.

Testing

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes
  • Live integration tested (if applicable)

Security

  • No new unsafe code
  • No secrets or API keys in diff
  • User input validated at boundaries

@miguelangarano miguelangarano changed the title feat: include endpoint to get specific session messages by its ID feat: include endpoints to interact with specific agent sessions Apr 1, 2026
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