Skip to main content
Once an agent is handling real calls, the question stops being “does this work?” and becomes “what happened on that call?” Answering it depends on having instrumented the agent beforehand — logs and metrics you added deliberately, rather than whatever happened to be printed.

Logging

Use conv.log to record meaningful outcomes, not every step the code takes:
Good logging explains the shape of a call — which paths it took, which external calls succeeded, where it went wrong. Log around the things that can fail: API calls, validation, and any branch whose outcome you would want to explain later. Never swallow an external failure silently. A bare except with no log turns a broken integration into a mysteriously unhelpful agent, and there is nothing in the transcript to explain it.

Metrics

Metrics count things you want to aggregate across calls — how often a flow completes, how often a handoff fires, how often an API falls back. Metrics in a project are managed with poly metrics, which are then invoked in project code via conv.write_metric(...). See custom metrics for managing the definitions. The common mistake is emitting the same metric repeatedly. A metric written inside a loop, or on every turn, inflates the count and tells you nothing: See the functions reference for the conv.log and metrics APIs.
Instrument for the question you will ask laterThe useful test is whether a log line or metric would help you answer a question you can imagine being asked — “how often do callers abandon at payment?”, “did that transfer actually fire?” If it would not, it is noise.

Inspecting real conversations

poly conversations reads what actually happened on real calls:
list pages through recent conversations, get returns the full turn-by-turn detail, and get-audio downloads the recording for a voice call. To go from “what happened on this call” to “how are calls going”, the same data is readable in aggregate and by search:
poly metrics available lists what you can read, built-in metrics included; the custom metrics your functions write with conv.write_metric(...) appear there too, which closes the loop between instrumenting and reviewing. This is where you find out what callers actually say, as opposed to what you imagined they would. Treat it as an input to development rather than an end in itself — a surprising real conversation is the raw material for the next test case. Agent Studio’s Analytics pages chart the same metrics; the CLI gives you the numbers and the matching conversations where you are already working.

How this fits the workflow

Instrumentation is something you add while building, and it only pays off later. Logs and metrics you did not add are not available retroactively, so the time to think about them is while you are writing the function, not while you are debugging a call from last week.
Last modified on November 27, 2026