Function commitUserMessage

  • Commits a user message to the active agent's history in a swarm session without triggering a response.

    This function commits a user message to the history of the specified agent, ensuring the agent is still active in the swarm session. It performs validation checks on the agent, session, and swarm, logs the operation if enabled, and delegates the commit operation to the session public service. The execution is wrapped in beginContext to ensure it runs outside of existing method and execution contexts, providing a clean execution environment.

    Type Parameters

    • Payload extends object = object

    Parameters

    • content: string

      The content parameter.

    • mode: ExecutionMode

      The mode parameter.

    • clientId: string

      The clientId parameter.

    • agentName: string

      The agentName parameter.

    • Optionalpayload: Payload

      Payload object containing the data to be processed.

    Returns Promise<void>

    If validation fails (e.g., invalid agent, session, or swarm) or if the session public service encounters an error during the commit operation.

    await commitUserMessage("User input message", "client-123", "AgentX");