Executes a single command in a swarm session and disposes of it, optimized for developer troubleshooting.

This function creates a temporary swarm session, executes a provided command, and disposes of the session upon completion. It is designed for developer needs, such as testing tool execution or troubleshooting, 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. The operation is TTL-limited and queued to manage resource usage efficiently.

If swarm or session validation fails, execution encounters an error, or disposal fails.

const result = await complete("Calculate 2 + 2", "client-123", "MathSwarm");
console.log(result); // Outputs "4"
  • Type Parameters

    • Payload extends object = object

    Parameters

    • content: string
    • clientId: string
    • swarmName: string
    • Optionalpayload: Payload

    Returns Promise<string>