Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
To support multi-agent interactions within WebClaw. Users need the ability to choose which specialized agent they want to converse with when starting a new session, and to clearly see which agent they are interacting with in historical sessions.
Description
This PR introduces the Session Agent Selection feature, allowing users to select a specific AI Agent for their chat sessions. It dynamically fetches available agents from the backend and displays the selected agent within the chat interface.
Changes Made
/api/agentsendpoint (apps/webclaw/src/routes/api/agents.ts) that fetches the list of available agents viagatewayRpc('agents.list', {})./api/sessions.tsendpoint to accept anagentIdin the POST body. TheagentIdis now encoded directly into the session key (agent:<agentId>:<uuid>) instead of being passed as a separate parameter to the Gateway.fetchAgentstochat-queries.tsto retrieve the agent list and handle fallback naming (usingidifnameis empty).chat-screen.tsxto manage theselectedAgentIdstate and apply default agent settings. Added a query to fetch the available agents for new chats.chat-header.tsxto display an agent<select>dropdown for new, empty chats. Once a session is established, the dropdown is replaced with a static label (e.g., "Agent: product_manager") displaying the agent associated with that specific session.deriveAgentIdFromKeyutility function inutils.tsto correctly parse theagentIdfrom the modified session key format.Testing
/api/agentsendpoint correctly returns the agent list.agentIdis correctly sent in the session creation payload and encoded into the session key.