The problem with static evals for dynamic agents
If your agent receives different instructions per session, such as different personas, rules, or restrictions, a static eval can’t keep up. An eval that asks “does the agent avoid discussing pricing?” is correct for one tenant and wrong for another. Your evals need to know what the agent was told as well as what it said. Call metadata gives them that.How it works
When you push a call to Tuner via the API, you can attach arbitrary context to it in themetadata field. This metadata is stored with the call and becomes available inside evals.
In an eval, you:
- Write a prompt definition, a natural language description of the behavior you’re evaluating
- Select Metadata under Inputs Used, and enter the specific metadata key you want the evaluator to use
- Tuner injects the value of that key into the evaluation context for each call
Step-by-step guide
Step 1: Configure the eval
In Tuner, go to Agent Settings > Evaluation Rules and create or edit an eval. 1. Set the Eval Label and Type Give the eval a descriptive name (e.g. “Instruction Adherence”). Choose Pass/Fail for binary evaluation or Score 1-5 for a scaled rating. 2. Write the Prompt Definition This is the natural language criteria the LLM evaluator will use. Be specific about what correct behavior looks like in relation to the instructions:“Evaluate whether the agent’s responses are consistent with the instructions it was given. If the instructions prohibit a topic, the agent should not engage with it. If they specify a tone or format, the agent should follow it.”3. Select Inputs Used Under Inputs Used, open Add input from agent setup… and select Metadata. Then in the Enter metadata key field, type the key you want the evaluator to receive, for example
instructions. Then click Add.
This tells Tuner: for each call, pull metadata.instructions and include it as context when running this eval.
Step 2: Attach metadata to your calls
When logging a call to Tuner, include the session instructions (or any relevant runtime context) in themetadata field of the request body.
metadata object is flexible. Include whatever context your agent receives at runtime. Capture the instructions on each call so every call carries its own.
If your agent composes its instructions dynamically from multiple sources, log the final composed string, the complete instructions the model actually received. That’s what the evaluator needs to reason about.
Attach metadata from an SDK
If you use an SDK, metadata is a constructor option on the plugin or observer. The keys land in the same place as when you call the API directly. See your integration guide for the exact call: LiveKit, Pipecat, or custom stack.Step 3: Read the results
Once configured, every call you push to Tuner is automatically evaluated against this eval. Results are broken down per call, so you can identify:- Which calls failed the check and why
- Whether failures cluster around specific tenants or instruction sets
Complete example: multi-tenant support agent
The full pattern end to end: At call time, your backend logs the call with the tenant’s runtime instructions inmetadata:
- Prompt definition: “Evaluate whether the agent follows the instructions it was given. Check that it respects any restrictions or formatting rules specified.”
- Inputs Used: Metadata with the key
instructions
When to use this pattern
This pattern applies any time the correctness of a response depends on context that varies per call:- Session-scoped agents where context (user role, permissions, goals) changes between sessions
- Multi-tenant agents where each customer has different rules, personas, or restrictions
- Instruction-following evals where instructions are injected at runtime
Next steps
Create evals
Create a custom eval that reads a metadata key.
Create Call API
The full call schema, including the
metadata field.