changeToAgent

declare function changeToAgent(agentName: AgentName, clientId: string): Promise<boolean>;

Changes the active agent for a given client session in a swarm.

This function facilitates switching the active agent in a swarm session, validating the session and agent dependencies, logging the operation if enabled, and executing the change using a TTL-limited, queued runner. The execution is wrapped in beginContext to ensure it runs outside of existing method and execution contexts.

Parameter Description
agentName The name of the agent to switch to.
clientId The unique identifier of the client session.