Agent Monitor uses three probe pairs. Each pair has a Start action and an End action. Place the Start probe at the beginning of the step you want to observe, and the End probe immediately after it completes.
The three probe pairs are:
Instrumenting the Agent Flow
The agent flow is the main Server Action that runs your agent. It typically contains: StartAgentCall, BuildMessages, one or more LLM calls, tool dispatching, and a final response step.
Step 1 — Add StartAgentCall at the beginning of the flow, before any processing.
Parameters:
StartAgentCall returns an AgentCallId. Store this value — it is required by all subsequent probes in this flow.
Step 2 — Add StartLLMCall before each CallModel (LLM invocation).
StartLLMCall returns an LLMCallId. Store this value — it is required by EndLLMCall and by any tool calls triggered by this LLM response.
Step 3 — Add EndLLMCall immediately after CallModel returns.
Step 4 — Add EndAgentCall at the end of the flow, after the final response is ready.
Instrumenting Tool Calls
Each tool is a separate Server Action called by the agent after an LLM response requests it. To link tool calls to the LLM call that triggered them, add LLMCallId as an input parameter to each tool Server Action.
Step 1 — Add LLMCallId as an input parameter to the tool Server Action. Pass this value from the agent flow when dispatching the tool call.
Step 2 — Add StartAgentToolCall at the beginning of the tool Server Action.
StartAgentToolCall returns an AgentToolCallId. Store this value for EndAgentToolCall.
Step 3 — Execute the tool logic normally.
Step 4 — Serialize the tool output to JSON before logging (e.g., using JSONSerialize).
Step 5 — Add EndAgentToolCall after the tool logic completes.