Sends a message to the active agent in a swarm session as if it originated from the client side.
This function executes a command or message on behalf of the specified agent within a swarm session, designed for scenarios like reviewing tool output
or initiating a model-to-client conversation. It validates the agent and session, checks if the specified agent is still active, and executes the content
with performance tracking and event bus notifications. The execution is wrapped in beginContext for a clean environment and runs within an
ExecutionContextService context for metadata tracking. If the active agent has changed, the operation is skipped.
Parameters
content: string
The content to be processed or stored.
clientId: string
The unique identifier of the client session.
agentName: string
The name of the agent to use or reference.
Returns Promise<string>
Throws
If agent, session, or swarm validation fails, or if the execution process encounters an error.
Example
constresult = awaitexecute("Review this output", "client-123", "AgentX"); console.log(result); // Outputs the agent's response or "" if skipped
Sends a message to the active agent in a swarm session as if it originated from the client side.
This function executes a command or message on behalf of the specified agent within a swarm session, designed for scenarios like reviewing tool output or initiating a model-to-client conversation. It validates the agent and session, checks if the specified agent is still active, and executes the content with performance tracking and event bus notifications. The execution is wrapped in
beginContext
for a clean environment and runs within anExecutionContextService
context for metadata tracking. If the active agent has changed, the operation is skipped.