Create an instance of the service.
The connection to use to make requests.
Path to the .agent file to simulate.
whether or not to mock the actions of the simulated agent
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)
Ending is not required, or supported, for AgentSimulation this is a noop method to support easier consumer typings
AgentPreviewEndResponse
Send a message to the agent using the session ID obtained by calling start().
A session ID provided by first calling agentSimulate.start().
A message to send to the agent.
AgentPreviewSendResponse
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.
Whether to enable or disable Apex Debug Mode.
Start an interactive simulation session with the agent. This will first compile the agent script if it hasn't been compiled yet.
AgentPreviewStartResponse, which includes a session ID needed for other actions.
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.
Whether to enable or disable Apex Debug Mode.
Get the traces for a given session and message IDs.
A session ID provided by first calling start().
An array of message IDs to get the traces for.
PlannerResponse[]
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);