Sends a message to the active agent in a swarm session as if it originated from the client side, forcing execution regardless of agent activity.
This function executes a command or message on behalf of the active agent within a swarm session, designed for scenarios like reviewing tool output
or initiating a model-to-client conversation. Unlike execute, it does not check if the agent is currently active, ensuring execution even if the
agent has changed or is inactive. It validates the session and swarm, executes the content with performance tracking and event bus notifications,
and is wrapped in beginContext for a clean environment and ExecutionContextService for metadata tracking.
Parameters
content: string
The content or command to be executed by the active agent.
clientId: string
The unique identifier of the client session requesting the execution.
Returns Promise<string>
A promise that resolves to the result of the execution.
Throws
If session or swarm validation fails, or if the execution process encounters an error.
Example
constresult = awaitexecuteForce("Force this execution", "client-123"); console.log(result); // Outputs the agent's response regardless of its active state
Sends a message to the active agent in a swarm session as if it originated from the client side, forcing execution regardless of agent activity.
This function executes a command or message on behalf of the active agent within a swarm session, designed for scenarios like reviewing tool output or initiating a model-to-client conversation. Unlike
execute
, it does not check if the agent is currently active, ensuring execution even if the agent has changed or is inactive. It validates the session and swarm, executes the content with performance tracking and event bus notifications, and is wrapped inbeginContext
for a clean environment andExecutionContextService
for metadata tracking.