Skip to main content
You can use Galtea to log and evaluate real user interactions from your production environment. This helps you monitor your product’s performance over time.
This tutorial evaluates production sessions on demand, one call at a time. To score production sessions automatically and continuously, create a Monitor instead: an always-on rule that samples and scores a product’s production sessions with a set of metric families, with no run to trigger by hand.
If your application already has its own conversation or chat ids, you can keep using them as the handle for a Galtea session, so you never store Galtea’s own session id. First, create the session once with galtea.sessions.create(custom_id=<your id>, ...). Then log every turn with session_custom_id=<your id> (plus a version_id or product_id anchor): each call finds that session by your custom id and appends to it.
The same works for logging turns without evaluating them:
Sessions are created only through the sessions API. If no session matches your session_custom_id and anchor, the call returns a 400 error. Create the session first with galtea.sessions.create(custom_id=...).
If your system already emits OpenTelemetry traces, you can create production sessions without any SDK calls. See Monitor Real User Traffic via OpenTelemetry.

Single-Turn Production Monitoring

For simple, single-turn interactions, create a production session and use galtea.inference_results.create_and_evaluate() to log and evaluate the interaction in a single call. You can pass Specification IDs so the API resolves their linked metrics automatically (recommended), or list metrics explicitly.

Multi-Turn Production Monitoring (Conversations)

For multi-turn conversations, use the session-based workflow to log the entire interaction first and then evaluate it. If your application has its own conversation ids, prefer the session_custom_id flow above: create the session once with a custom_id in step 1, then pass session_custom_id (plus version_id or product_id) instead of session_id in step 2.
1

1. Create a Session

First, create a session at the start of the conversation. For production monitoring, make sure to set is_production=True.
2

2. Log Conversation Turns

Next, log the user-assistant interactions. You can do this individually as each turn happens or in a single batch after the conversation ends.
This approach is useful for logging interactions in real-time in a live application.
3

3. Evaluate the Session

Once the conversation is complete and all turns are logged, you can run an evaluation on the entire session. Pass Specification IDs so the API resolves their linked metrics automatically (recommended), or list metrics explicitly.
4

4. Finish the Session

When the user’s conversation ends, finish the session with finish(). This closes the session, so it accepts no more turns.
Finishing matters most when you use a Monitor to score production sessions automatically: a monitor scores only closed sessions. An explicit finish makes the session eligible on the next scan, instead of waiting for the product’s inactivity auto-close window (30 minutes by default). Only call finish() once the conversation is truly over: appending a turn to a closed session follows the product’s closed-session policy, so the turn is either rejected or silently discarded.
For more details on evaluating multi-turn conversations, see the Evaluating Conversations guide.

Late Turns on a Closed Session

A production session does not stay open forever. Galtea’s auto-close sweep closes a session once it has been quiet for the product’s auto-close inactivity window (default 30 minutes), and an explicit finish closes it at once. A session that is closed (COMPLETED or FAILED) accepts no new turns.
The product’s auto-close window is the only inactivity window: it closes the session (its Status changes). A Monitor has no window of its own; it scores a session once the session is closed, whether by an explicit finish or by the auto-close sweep.
So a turn that arrives after the session closes (for example, a user who replies an hour later) is handled by the product’s Closed Session Inference Creation Policy:
  • IGNORE (the default): the log call returns success, but the turn is not stored. The late reply is silently dropped.
  • REJECT: the log call fails with an error. Your code must handle it (for example, start a new session for the reply).
Both are safe defaults, but they mean a late reply can be lost or can raise an error. If your users often reply after long gaps, you have two mitigations. Both are set per product from the API or the dashboard (the SDK reads these fields but does not set them):
  • Raise the inactivity window. Increase Auto Close Inactivity Minutes so sessions stay open longer before the sweep closes them.
  • Turn off auto-close for these sessions. Set Auto Close Scope to NONE (or a scope that excludes production) so the sweep never closes them; they then close only on an explicit finish.
See the Product properties for the three auto-close fields and their defaults, and the Session Lifecycle for the full open/closed model.

Reading Monitor Results

If you have set up a Monitor on the Galtea dashboard to continuously evaluate a sample of your production sessions, you can pull its results with a single call:
The days query parameter sets the trailing window to aggregate, bucketed by day. It defaults to 7 and accepts up to 90. The response is built to give you an honest read of your product’s quality, not just a bare average. Keep these ideas in mind when you interpret it:
  • Each metric family gets its own score series. A metric family is a metric and every later revision of it (for example, when you edit its judge prompt), grouped as one line of history. The response returns one series per family bound to the monitor, each with a whole-range headline score and one point per day bucket.
  • Scores are sampling-weighted. A monitor does not evaluate every session; it evaluates a sample to control cost. Sessions from a period when sampling was lower count for more in the average, so a period with a smaller sample does not silently pull the score toward its own noise.
  • A confidence interval tells you how much to trust a score. The confidence interval is the range that most likely contains the true score. Galtea publishes a 95% interval once a bucket has scored at least 30 sessions. Below that floor, confidenceInterval is null and collectingData is true, so you know the score is a preview, not a settled number, until more sessions land.
  • The worst metric family drives the headline, never an average. worstMetric is the lowest-scoring family over the whole range, not a blended score across families. Use it to see which quality dimension needs attention first.
  • Markers flag context changes. markers.metricRevisions marks when a bound metric family was edited, and markers.samplingChanges marks when the sampling rate changed. Both can explain a shift in the score series that isn’t a real quality change.
  • Spend shows your current billing cycle. spend.spentCredits and spend.pendingCredits are the credits already used and reserved for evaluations still running this cycle; spend.capCredits is the monthly cap you configured for the monitor (null if you did not set one). If spend reaches the cap, the monitor’s status becomes CAPPED and it pauses scoring. Sessions that close while the monitor is capped are skipped for good, like when it is paused: scoring resumes for sessions that close after the next cycle resets the cap, or after you raise it. The monitor never lowers its own sampling rate to fit the budget.
  • Sessions are listed, not just counted. sessions.scored lists the most recently evaluated sessions (capped at 200), each with the turn count it was scored at. sessions.waiting lists production sessions that have not closed yet (capped at 100); a session is scored only once it closes. A session closes when it is explicitly finished, or when the product’s auto-close setting closes it after inactivity.

Next Steps

Evaluating Conversations

Evaluate full multi-turn production conversations.

Tracing Agent Operations

Capture and analyze internal agent operations in production.