# Agent evaluation: system ko naapo, model ko nahi

> Agent evaluation ka object poora system hai - model, prompts, tools, control loop, environment. Episode task, trial, trace, outcome se banta hai; pass^k reliability naapta hai, stateful grading final state check karta hai, cost per-successful-task par hota hai।

- URL: https://dmxsf.com/hi/wiki/applications/agent-evaluation/
- [DMXSF](https://dmxsf.com/hi/about/)
- मध्यम
- अपडेट किया गया: 2026-11-21
- Tags: Agents, Evaluation, Tool use

## यह पृष्ठ पूरा करने पर आप

- Agent evaluation aur model evaluation ka farq saaf bataayein: system + protocol evaluate hota hai, parameters nahi।
- Ek evaluation episode ko task, trial, trace, outcome se describe karein; agent harness aur eval harness ki zimmedari alag karein।
- pass^k calculate karein, pass@k se ka farq batayein, aur agent evaluation pehle ko kyun dekhta hai yeh samjhayein।
- Samjhayein stateful grading (DB final state) aur final-state invariants "reply jaisa dikhta hai" se zyada reliable kyun hain।
- Do agent options ko "per-successful-task cost" se compare karein, aur uske blind spots batayein।

Model evaluation poochhta hai "yeh model kya kar sakta hai"; [agent evaluation](https://dmxsf.com/hi/wiki/applications/agents-and-tool-calling/) poochhta hai "yeh system real tasks mein reliably kaam karwa sakta hai?". Agar aapne [LLM evaluation methodology](https://dmxsf.com/hi/wiki/evaluation/llm-evaluation/) padhi hai, to yeh page usi rigour ko multi-step, tool-wale, state-wale systems par le jaata hai।

## Kya evaluate hota hai: system + protocol

Ek agent benchmark ka score naapta hai "specific system x specific task distribution x specific protocol". System = model, prompts, memory, tools, control loop, execution environment; koi bhi ek badla to score badal sakta hai. Isliye:

- **Mushkil sawaal = agent evaluation, nahi.** Sirf questions mushkil kar diye aur system phir bhi ek answer output karta hai - woh sirf mushkil model evaluation hai. Agent evaluation ki key change: system act kar sakta hai, consequences observe karta hai, aur usi ke aadhar par adjust karta hai।
- **Score protocol ke saath padho.** Koi bhi score - pehle poochho: benchmark version aur split, system config, allowed tools, budget (steps/tokens/time), kaun sa grader।
- **Harness system ka hissa bhi hai, eval ka bhi.** Agent harness tay karta hai model kya context dekhta hai, tool calls kaise execute hote hain, kab rukta hai; eval harness task init karta hai, limits lagata hai, evidence save karta hai, grader call karta hai, results summarize. Do responsibilities alag: **system-under-test apne grading rules ko touch nahi kar sakta**।

Ek evaluation episode ka conceptual model (Anthropic ke eval guide aur Harvard CS2680 lectures se adapted):

```text
for task in frozen_task_set:                 # task set frozen; beech mein change nahi
    for trial in trials_for(task):           # same task kai trials - jitter naapte hain
        env = reset_to(task.initial_state)   # environment resettable
        while not done(agent) and within(budget):
            obs = env.observe()              # model sirf instructions, observations, tools dekhta hai
            action = agent.next_action(obs)  # reference answers aur grading state model se hidden
            env.execute(action)
        scores = protected_graders(env, trajectory)  # graders protected
```

Task, trial, trace, outcome - chaar shabd yaad rakho: multiple trials **jitter** naapte hain, naye tasks nahi bante; trace appeal aur diagnostics ka evidence hai - failures, timeouts, tool errors sahit poora rakho।

## Metrics: reliability pehle, cost saath mein

[Task-level reliability ka repeat-run calculation dekhein](https://github.com/dmxsf/dmxsf/blob/main/src/dmxsf/applications/agent_metrics.py)

### pass^k: deployer ka metric

pass@k poochhta hai "k samples, best wala safal?" - ceiling; **pass^k** poochhta hai "same task k independent retries - har baar safal?" - reliability. Real users agent ko baar-baar use karte hain - har failure asli loss - isliye agent scenarios pass^k par zyada. Independence assumption se magnitude (is page ka arithmetic - khud recompute kar sakte hain):

```python
def passk(p, k): return 1 - (1 - p) ** k   # yeh "at least one success" hai
# pass^k (har baar safal) = p**k; dono compare karne se "retry se reliability" ki keemat dikhti hai
for p in (0.4, 0.6, 0.8):
    print(f"p={p:.1f}: p^4={p**4:.3f}  1-(1-p)^4={1-(1-p)**4:.3f}")
```

Output:

```text
p=0.4: p^4=0.026  1-(1-p)^4=0.870
p=0.6: p^4=0.130  1-(1-p)^4=0.974
p=0.8: p^4=0.410  1-(1-p)^4=0.998
```

Note: numbers original run se hain; print labels Latin transliteration mein likhe gaye hain।

Neeche widget pass^k aur pass@k ko curves ki tarah draw karta hai, aur dikhta hai ki ek jaise average wale «concentrated» aur «spread» distributions ke pass^2 ulat hote hain. 

Ek task ki single-run success 0.8 ho to independent-repetition assumption par 4 mein sab-safal ki probability lagbhag 0.41. Live system mein tasks ki difficulty alag hai - har task ka alag estimate chahiye।

### Pehle per-task, phir average

[τ-bench](https://arxiv.org/abs/2406.12045) pass^k ko same task ki $k$ attempts sab-safal ki probability ke roop mein define karta hai, phir tasks par average. Total $T$ tasks. Task $i$ ne $n_i$ runs, $c_i$ safal - inmein se $k$ uthao sab-safal hone ka combination ratio:

$$
\widehat{\mathrm{pass}}^{\,k} =
\frac{1}{T}\sum_{i=1}^{T}
\frac{\binom{c_i}{k}}{\binom{n_i}{k}}
$$

Har task ke paas kam se kam $k$ trials hon chahiye; kam hon to aur chalao, ya us $k$ ka coverage clearly report karo. Sab tasks ko ek success count mein milana nahi; overall single-run success ko seedha power nahi. Neeche dono self-written task sets ka per-task rate 50% hai, par success distribution alag. Apple M2 Max, Python 3.12.14 se।

```python
from collections.abc import Sequence
from math import comb

def pass_all(tasks: Sequence[Sequence[bool]], k: int) -> float:
    """Estimate task-average all-success probability."""
    if k < 1 or not tasks or any(len(trials) < k for trials in tasks):
        raise ValueError("need k >= 1 and at least k trials per task")
    ratios = [comb(sum(row), k) / comb(len(row), k) for row in tasks]
    return sum(ratios) / len(ratios)

concentrated = [(True, True), (False, False)]
spread = [(True, False), (False, True)]
assert pass_all(concentrated, 1) == pass_all(spread, 1) == 0.5
assert pass_all(concentrated, 2) == 0.5 and pass_all(spread, 2) == 0
for name, tasks in zip(('concentrated', 'spread'), (concentrated, spread)):
    first, second = pass_all(tasks, 1), pass_all(tasks, 2)
    print(f"{name}: k=1 {first:.0%}, k=2 {second:.0%}")
```

```text
concentrated: k=1 50%, k=2 50%
spread: k=1 50%, k=2 0%
```

Note: numbers original run se hain; print labels Latin transliteration mein badle gaye।

Concentrated: ek task baar-baar sahi ho sakta hai; spread: har task kam se kam ek baar fail. High repeat-success sirf ek easy-task batch se bhi aa sakta hai - isliye task family aur difficulty ke hisaab se bhi report karo, task-level resampling se uncertainty estimate karo. Trials ek running environment share karte hon to pehle environment reset, phir independence baat karo।

### Stateful grading: environment final state check

τ-bench-style support task: user eligible item return karna chahta hai; policy maangti hai **pehle confirm, phir refund**. Grader check karta hai: refund record exists aur state sahi; unrelated orders untouched; reply mein zaroori content; confirmation write se pehle hua. Aisi stateful grading "reply standard answer jaisa dikhta hai?" se bahut zyada reliable - agent ka object environment hai, text nahi।

### Cost: per successful task

[AI Agents That Matter](https://arxiv.org/abs/2407.01502) accuracy aur cost saath compare karne ka argument deta hai. Product mein ek task ke planning, tool calls, retries, verification aur human remediation gino. Neeche is site ke self-written 100 tasks:

```text
baseline:  $1.50/successful task (80/100)
candidate: $1.20/successful task (75/100)
difference: 5 fewer successes, unit cost $0.30 lower
```

Candidate unit cost kam, par 5 safal kam; business floor 80% success hai to candidate fail. **Agent options ko quality-cost poore frontier par compare karo, aur yeh bhi ki kaun se tasks gained/lost hue**; "per-successful-task cost" success rate zero par undefined hai, aur yeh nahi batata kaun si task types degrade hui।

*Figure: Evaluation harness tasks freeze karta hai, environment reset aur grader apne paas rakhta hai; agent harness hi tested system hai. Dashed grader agent ki padhne wali range ke bahar hai: score environment ke final state se banta hai, reply se nahi.*
## Benchmark map: "kya evaluate hota hai" se classify

CS2680 course 48-item benchmark catalog maintain karta hai; core classification idea udhaar lo - fame se nahi, evaluate-what se:

| Category | Representative benchmarks | Kya evaluate, kaise grade |
| --- | --- | --- |
| Interactive task completion | WebArena (2307.13854), OSWorld (2404.07972), GAIA (2311.12983), SWE-bench (2310.06770), Terminal-Bench, BrowseComp | Real web/desktop/repo environments mein task complete; final state ya artifacts check |
| Single-capability isolation | BFCL (tool selection), ToolSandbox (state-dependent tool use), LongMemEval (long-term memory), τ-bench / τ²-bench (2406.12045 / 2506.07982), AgentDojo (2406.13352), MultiAgentBench | Tool selection, memory, instruction-following alag-alag; precise, reproducible rules |
| Workflows aur outputs | MLE-bench, KernelBench, GDPval | End-to-end outputs (chalta hua model, kernel, docs) expert ya program se grade |
| Harder, fresher questions | GPQA, FrontierMath, HLE, LiveBench, ARC-AGI-3 | Contamination kam karta hai, par abhi bhi model evaluation ka extension - agent evaluation nahi |

Apne agent ke liye benchmark chunte waqt pehle apne product ke failure mode ka class diagnose karo, phir usse cover karne wala benchmark; aur **grading protocol padho** - same-name benchmarks ke versions mein tasks aur grading poori tarah alag ho sakte hain।

## Traces se fix points dhoondo

[Berkeley Advanced LLM Agents](https://agenticai-learning.org/sp25) memory, planning aur multimodal interaction ko alag lectures mein rakhta hai. [Scalable AI spring application assignment](https://scalable-ai.eecs.berkeley.edu/S2026/assets/assignment_4.zip) app quality aur system performance saath measure karne ko kehta hai. Ek hi sandbox task se in factors ko alag kiya ja sakta hai - jaise agent ko user ki saved preferences ke aadhar par simulated calendar mein specified meeting move karwana।

- **Observation aur memory.** Har run ko same calendar snapshot aur session history; retrieved preferences aur unke versions record. Sirf memory module switch karo; cross-session preference chahiye ya nahi uske hisaab se group karke report।
- **Planning aur execution.** Chuni gayi meeting aur tool ko diye times check. Tool timeouts ko same canned responses se replay; final state sahi? duplicate events bane?।
- **Final results.** Event IDs, times, participants aur bina-maange badle events check; call count, total time, per-success cost bhi record. Failure traces rakho; regression tests mein same initial states।

Pehle original system par baseline jama karo. Ek baar mein sirf ek cheez badlo - model, memory, planning ya tools - tabhi difference ko us change par attribute ho sakta hai।

### Simulated calendar se grader validate karna

Neeche chaar hand-built traces - correct update, no update, duplicate event, aur galat event badalna. Apple M2 Max, Python 3.14.3; do grading rules; sirf standard Python।

```python
before = [("standup", "09:00"), ("interview", "14:00")]
expected = [("standup", "10:00"), ("interview", "14:00")]
traces = [
    (True, expected),
    (True, before),
    (True, expected + [("standup", "10:00")]),
    (True, [("standup", "10:00"), ("interview", "15:00")]),
]

reported = sum(claim for claim, _ in traces)
verified = sum(sorted(events) == sorted(expected) for _, events in traces)
assert verified == 1 and reported == len(traces)
print(f"claimed success: {reported}/{len(traces)}")
print(f"final-state correct: {verified}/{len(traces)}")
```

```text
claimed success: 4/4
final-state correct: 1/4
```

Note: numbers original run se hain; sample events Hindi/Latin transliteration mein badle gaye।

Do grading results ka gap demo traces ke design se aata hai. Lists compare karte waqt pehle sort - event order ki freedom, duplicates phir bhi pakde jaate hain. Asli calendar stable event IDs use kare, aur participants, timezone jaise success-affecting fields bhi check mein।

## Common traps

- **Harness drift**: scaffolding (prompt templates, retry policy, tool descriptions) badla, score badla - tumhe laga model degrade hua. Mitigation: harness config version control mein; model change par harness freeze।
- **Sirf ek run report karna**: agent ka jitter single-turn QA se bahut zyada; ek run ka score bekaar. Kam se kam kai trials ka mean + spread; behtar pass^k।
- **Environment non-resettable**: tasks ke beech state leak; "pichhla answer yaad rakhna" capability ban jaati hai. Eval harness har trial se pehle reset kare।
- **Grader exposed**: reference answers ya grading logic model context mein aa gaye - score turant fake-high. Grading state eval harness ke paas।
- **Task set training mein leak**: agent traces garam commodity; benchmark tasks training set mein gaye to scores inflate ([benchmark contamination](https://dmxsf.com/hi/wiki/evaluation/benchmark-contamination/) wali hi logic)।

## Summary aur exercises

- Agent evaluation = system x task distribution x protocol; harness system ka hissa; do harnesses ki zimmedari alag; system-under-test grader ko touch nahi kar sakta।
- Metrics mein reliability (pass^k) > ceiling (pass@k); cost per successful task, par success rate aur latency ke saath।
- Benchmarks "kya evaluate" se chuno; score se pehle protocol padho।

### Quick self-test

**1. Same model, nayi prompt template aur retry policy - agent benchmark score kaisa ho sakta hai?**

- [x] Kaafi badal sakta hai - score "model + scaffolding + protocol" poora system naapta hai
- [ ] Same rahega - score sirf model parameters par hai
- [ ] Sirf behtar hoga, bura nahi ho sakta

> Harness system ka hissa hai. Systems compare karte waqt protocol fix aur config clear।

**2. Single-run success 0.8 wale task ke 4 lagatar trials sab-safal hone ki probability lagbhag?**

- [ ] 0.8
- [ ] 0.998
- [x] 0.41

> pass^k (har baar safal) = 0.8^4 lagbhag 0.410; 0.998 "at least one success" hai. Deployment pehla dekhta hai।

**3. τ-bench-style stateful grading mainly kya check karta hai?**

- [x] Environment final state (refund record, unrelated orders untouched) aur operation order (confirmation write se pehle)
- [ ] Reply aur reference answer ki semantic similarity
- [ ] Trace mein thinking steps ki lambai

> Agent ka object environment hai. Final state + constraint order seedha check karne se "muh se bola, waqai kuch nahi kiya" wala grading loophole band hota hai।

**4. Candidate agent option ka per-successful-task cost kam hai - kya wohi better hai?**

- [ ] Haan - cost hi ek maatra decision metric hai
- [x] Zaroori nahi: success rate kam ho sakta hai, key tasks kho sakte hain; cost ko success rate aur latency ke saath dekho
- [ ] Cost kam hai to success rate automatically zyada

> Is page ka demo: $1.20 vs $1.50 per success, par candidate 5 tasks kam safal - business floor toot sakti hai।

**5. Har trial se pehle environment reset kyun zaroori?**

- [x] Tasks ke beech state leak na ho; "pichhla answer yaad" ko capability na samajh lein
- [ ] Traces lambe banane ke liye
- [ ] Compute bachane ke liye

> Reset guarantee deta hai har trial same task test kar raha hai; state leak se results unexplainable।

### Exercises

1. Apna aam agent-type app chuno (support ya coding assistant), uska cost ledger template likhein: har episode par kaun se fields (model calls, cache hits, tool fees, human remediation...)?
2. Do agent benchmarks jo aap matter karte hain chuno; har ek ke liye teen lines mein likho "system kya receive karta hai, kya karta hai, grader kya check karta hai"; phir judge karo kaun se failure modes cover, kaun se miss।

Reference answer (exercise 1 ke key fields):

<details>
<summary>Expand karein</summary>

Har model call: model name, role (main loop / planning / compression / verification), input/output tokens, cache hit; tool calls: naam, count, cost; episode-level: total latency (p50/p95), retry count, ending (success/fail/timeout), human intervention time. Summary metrics: verified success rate, total spend / successful tasks, per-attempt cost, cost distribution across tasks. Offline costs (teacher traces, fine-tuning, evaluation itself) alag ledger - per-call mein spread na karein।
</details>

## Aage padhein

- Anthropic, [Demystifying evals for AI agents](https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents) aur [Building effective agents](https://www.anthropic.com/engineering/building-effective-agents): is page ke episode conceptual model ke sources।
- Yao adi, [τ-bench](https://arxiv.org/abs/2406.12045) (2024); Si adi, [τ²-bench](https://arxiv.org/abs/2506.07982) (2025): stateful grading aur pass^k ke landmark works।
- Kapoor adi, [AI Agents That Matter](https://arxiv.org/abs/2407.01502) (2024): cost accounting aur "quality-cost frontier" ka argument।
- Liu adi, [AgentBench](https://arxiv.org/abs/2308.03688) (2023); Zhou adi, [WebArena](https://arxiv.org/abs/2307.13854) (2023); Jimenez adi, [SWE-bench](https://arxiv.org/abs/2310.06770) (2023); Mialon adi, [GAIA](https://arxiv.org/abs/2311.12983) (2023); Xie adi, [OSWorld](https://arxiv.org/abs/2404.07972) (2024): interactive environment benchmarks ke chaar task formats।
- Debenedetti adi, [AgentDojo](https://arxiv.org/abs/2406.13352) (2024): agent ki safety aur utility ka joint eval; bhi dekhein [prompt injection aur jailbreaks](https://dmxsf.com/hi/wiki/safety/prompt-injection-and-jailbreaks/)।
- Course notes: Harvard CS2680 ke "Agent Evaluation and Benchmarks" aur "Cost-effective Agents" (2026); is page ki benchmark classification aur cost framework inhi dono se borrowed hai।

## सहायक कोड

[Agent evaluation: repeatability and terminal state](https://github.com/dmxsf/dmxsf/tree/main/labs/applications/agent-evaluation): Compare equal one-run scores and validate four calendar traces.

- सहायक रिपॉज़िटरी में चलाएँ (--quick से तेज़ जाँच): `uv run dmxsf run applications/agent-evaluation`
- [प्रयोग स्क्रिप्ट देखें](https://github.com/dmxsf/dmxsf/blob/main/labs/applications/agent-evaluation/run.py)
- [प्रयोग विवरण](https://github.com/dmxsf/dmxsf/blob/main/labs/applications/agent-evaluation/README.en.md)
- [`agent_metrics.py`](https://github.com/dmxsf/dmxsf/blob/main/src/dmxsf/applications/agent_metrics.py)
- [सूची में देखें](https://dmxsf.com/hi/code/#agent-evaluation)

## अक्सर पूछे जाने वाले सवाल

### Same model doosre agent harness mein dalein to score badlega?

Haan, aur aksar model badalne se bhi zyada. Score "model + prompt + memory + tool interface + control loop + execution environment" ka fixed protocol ke under performance naapta hai; tool descriptions badalne, retry budget badalne, stop conditions badalne - sab score badalta hai. Isliye do systems compare karte waqt protocol fix karo, aur report mein harness config clear likho।

### pass^k aur pass@k ka farq?

pass@k poochhta hai "k samples mein best wala safal maane?" - capability ceiling; pass^k poochhta hai "same task independently k retries - har baar safal tabhi pass" - reliability. Deployed agents par users baar-baar use karte hain - har ek failure asli loss hai - isliye agent scenarios pass^k dekhte hain।

### τ-bench DB state check karta hai, sirf reply nahi - kyun?

Kyunki agent ka object environment hai. "Refund ho gaya" muh se bola ja sakta hai, ya DB mein waqai ek sahi-state refund record ho, unrelated orders untouched hon, confirmation write se pehle hua ho. Stateful grading seedha final state aur constraint order check karta hai - "reply padhne mein sahi, waqai kuch sahi nahi" wala loophole band।

### Per-successful-task cost kam hai to wohi option chun lein?

Hamesha nahi. Is site ka demo: 100 tasks par baseline $120 mein 80 safal ($1.50/safal), candidate $90 mein 75 safal ($1.20/safal). Candidate ki unit cost kam, par 5 safal tasks kam; business ko 80% success rate chahiye to candidate hi fail. Cost metric success rate ke saath, aur yeh bhi ki kaun se tasks degrade hue।

### Agent benchmarks itne hain - kaise chunein?

Pehle "kya evaluate hota hai" se classify: interactive environments jo real tasks karte hain (WebArena, OSWorld, SWE-bench); isolated single capabilities (tool selection, memory, instruction-following); workflow outputs (MLE-bench). Phir apne product ke failure modes kis class ke hain - us class ko cover karne wala benchmark chuno, aur grading protocol padho - same naam ke versions aur rules bilkul alag ho sakte hain।
