Skip to main content
Glama

replay_session

Replays a Session against a chosen pipeline version to create a new Session for reproducing or retrying a failed or suspect test-case run; this is a paid pipeline run.

Instructions

Replays one Session against a pipeline version into a new Session. Costs money.

Experiment support, for when you need it: to reproduce or retry the replay of one test case that failed or looks wrong, replay that test case's Session on the version the Experiment's side uses. It is a paid pipeline run on the customer's models: say what it costs and get a yes first. The replay is not linked to the Experiment, so the new Session is not added to it and changes none of its results. To retry an Experiment's failed replays inside the Experiment, use rerun_failed_experiment with rerun="replays". The source Session and the deployed pipeline are untouched.

FIRST_USER_MESSAGE replays the first turn only; ALL_USER_MESSAGES replays every turn of a chat in order. Leave it unset to use the server's default (the first turn), and say so when reporting. The run's session_id is the new Session; judge it with try_evaluator. If status is still CREATED or STARTED the wait ran out: poll get_session_replay with its session_replay_run_id. When it is FAILED, read error_detail and the logs.

setup_source and cleanup_source are optional Python run around the pipeline in an isolated worker. Setup must define exactly one public top-level function taking no arguments and returning a mapping with optional env (dict[str, str]), inputs (dict[str, Any], keyed by the pipeline's declared input names) and logs (list[str]); its env and inputs take precedence over the Session's own. Cleanup runs even when the replay failed; it must define one public top-level function taking the setup's return value (None without a setup) and returning a mapping with optional logs. Helpers must be underscore-prefixed or imported. Omit either to skip that step. :param pipeline_name: Name of the pipeline. :param session_id: The Session to replay: a search_session_id, or a single-turn run's query_id. :param pipeline_version_id: The pipeline version to replay against, e.g. the Experiment side's version. :param replay_mode: FIRST_USER_MESSAGE or ALL_USER_MESSAGES; unset uses the server's default. :param setup_source: Python source run before the pipeline; unset skips the step. :param cleanup_source: Python source run after the pipeline; unset skips the step. :param wait_seconds: How long to wait for the replay before handing back the run to poll. :returns: The replay run, with the new Session's session_id, or an error message.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "pipeline_name": "<pipeline_name>",
      "session_id": "<session_id>",
      "pipeline_version_id": "<pipeline_version_id>"
    },
    "name": "replay_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
session_idYes
replay_modeNo
setup_sourceNo
wait_secondsNo
pipeline_nameYes
cleanup_sourceNo
pipeline_version_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.1.44
    • addedInput schema / properties / cleanup_source
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Cleanup Source"
      +}
    • addedInput schema / properties / setup_source
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Setup Source"
      +}
  2. Addedv0.1.29

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations present the description carries the full burden and does: it discloses monetary cost, that the replay is unlinked from the Experiment and mutates none of its results, that the source Session and deployed pipeline are untouched, that cleanup runs even on failure, that wait_seconds can expire into CREATED/STARTED requiring get_session_replay polling, and that FAILED requires reading error_detail and logs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, cost, and the alternative before details, and most sentences earn their place. Minor waste: the trailing ':param ...' block restates replay_mode, setup_source, cleanup_source, and wait_seconds that the prose already covered, adding length without new meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter, unannotated, no-output-schema mutation tool with real cost implications, this is complete: it covers return shape ('the replay run, with the new Session's session_id'), success judgment via try_evaluator, and the failure/polling paths. Nothing an agent needs to call it safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% and 7 parameters are undocumented structurally, yet the description defines each one meaningfully: session_id accepts either a search_session_id or a single-turn query_id, pipeline_version_id is framed as the Experiment side's version, replay_mode's two enum values are explained plus the unset default, and setup_source/cleanup_source have their full callable contract, precedence rules, and lifetime spelled out.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb, resource, and effect: 'Replays one Session against a pipeline version into a new Session.' It also explicitly names the sibling it is not (rerun_failed_experiment with rerun="replays"), so an agent can route between the two without opening schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives the narrow triggering scenario ('to reproduce or retry the replay of one test case that failed or looks wrong'), the exclusion ('to retry an Experiment's failed replays inside the Experiment, use rerun_failed_experiment'), and a required precondition (get user consent after stating cost).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools