@salesforce/agents
    Preparing search index...

    Class AgentSimulate

    A service to simulate interactions with an agent using a local .agent file. The file will be compiled using Agent.compileAgent before being used with the simulation endpoints.

    Examples

    Create an instance of the service:

    const agentSimulate = new AgentSimulate(connection, './path/to/agent.agent');

    Start an interactive session:

    const { sessionId } = await agentSimulate.start();

    Send a message to the agent using the session ID from the startResponse:

    const sendResponse = await agentSimulate.send(sessionId, message);

    End an interactive session:

    await agentSimulate.end(sessionId, 'UserRequest');

    Enable Apex Debug Mode:

    agentSimulate.toggleApexDebugMode(true);

    Hierarchy (View Summary)

    Index

    Constructors

    • Create an instance of the service.

      Parameters

      • connection: Connection

        The connection to use to make requests.

      • agentFilePath: string

        Path to the .agent file to simulate.

      • mockActions: boolean

        whether or not to mock the actions of the simulated agent

      Returns AgentSimulate

    Properties

    mockActions: boolean

    The client can specify whether the actions will run in a simulated mode ("mock actions", no side effects, mockActions=true) or a non-simulated mode ("real actions", actions with side effects, mockActions=false)

    Methods

    • Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user and create apex debug logs for use within VS Code's Apex Replay Debugger.

      Parameters

      • enable: boolean

        Whether to enable or disable Apex Debug Mode.

      Returns void

    • Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user and create apex debug logs for use within VS Code's Apex Replay Debugger.

      Parameters

      • enable: boolean

        Whether to enable or disable Apex Debug Mode.

      Returns void

    • Get the traces for a given session and message IDs.

      Parameters

      • sessionId: string

        A session ID provided by first calling start().

      • messageIds: string[]

        An array of message IDs to get the traces for.

      Returns Promise<PlannerResponse[]>

      PlannerResponse[]