{"id":50592357,"url":"https://github.com/sachincse/trajeval","last_synced_at":"2026-06-05T11:30:21.303Z","repository":{"id":361672271,"uuid":"1255344346","full_name":"sachincse/trajeval","owner":"sachincse","description":"Trajectory evaluation for LLM agents — grade what your agent did, not just what it said.","archived":false,"fork":false,"pushed_at":"2026-05-31T18:05:37.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-31T20:08:11.980Z","etag":null,"topics":["agent-evaluation","ai-agents","eval","llm","llm-evaluation","llmops","python","tool-use"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sachincse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T18:02:04.000Z","updated_at":"2026-05-31T18:05:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sachincse/trajeval","commit_stats":null,"previous_names":["sachincse/trajeval"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sachincse/trajeval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachincse%2Ftrajeval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachincse%2Ftrajeval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachincse%2Ftrajeval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachincse%2Ftrajeval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sachincse","download_url":"https://codeload.github.com/sachincse/trajeval/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachincse%2Ftrajeval/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33939225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-evaluation","ai-agents","eval","llm","llm-evaluation","llmops","python","tool-use"],"created_at":"2026-06-05T11:30:20.445Z","updated_at":"2026-06-05T11:30:21.291Z","avatar_url":"https://github.com/sachincse.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trajeval\n\n**Grade what your agent _did_ — not just what it said.**\n\n[![PyPI](https://img.shields.io/badge/pypi-trajeval-blue)](https://pypi.org/project/trajeval/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![Python](https://img.shields.io/badge/python-3.9%2B-blue)](pyproject.toml)\n\nLLM eval tools (DeepEval, Ragas, Langfuse…) score the **final answer**. But agents\nfail in the **middle** — they pick the wrong tool, loop, burn budget on a bad path,\nor pass a final-output check while the workflow is quietly broken.\n\n`trajeval` scores the **trajectory**: the sequence of tool calls your agent made.\nIt's lightweight, local-first, framework-agnostic, and needs **no API key** for its\nstructural metrics.\n\n```bash\npip install trajeval\n```\n\n## Why trajeval\n\n\u003e \"A single intermediate mistake can pass a final-output check while still corrupting the full workflow.\"\n\n| | Final-output evals (DeepEval/Ragas) | Observability (Langfuse) | **trajeval** |\n|---|:---:|:---:|:---:|\n| Scores the final answer | ✅ | ➖ | ✅ |\n| Scores the **tool-call path** | ❌ | ➖ | ✅ |\n| Tool-selection accuracy | ❌ | ❌ | ✅ |\n| Step-efficiency / loop detection | ❌ | ❌ | ✅ |\n| Per-path cost \u0026 latency budget | ❌ | ➖ | ✅ |\n| **Ship / retry / regenerate gate** | ❌ | ❌ | ✅ |\n| Zero-dependency, local, CI-ready | ➖ | ❌ | ✅ |\n\n## Quickstart\n\n```python\nfrom trajeval import Trajectory, Step, Gate\nfrom trajeval import ToolSelectionAccuracy, StepEfficiency, LoopDetection, CostBudget\n\ntraj = Trajectory(\n    goal=\"Find the weather in Berlin and convert to Fahrenheit\",\n    steps=[\n        Step(tool=\"search_weather\", args={\"city\": \"Berlin\"}, output=\"12C\", cost_usd=0.001),\n        Step(tool=\"convert_temp\",   args={\"c\": 12},          output=\"53.6F\", cost_usd=0.0006),\n    ],\n    final_output=\"It is 53.6F in Berlin.\",\n)\n\ngate = Gate([\n    ToolSelectionAccuracy([\"search_weather\", \"convert_temp\"]),\n    StepEfficiency(optimal_steps=2),\n    LoopDetection(max_repeats=1),\n    CostBudget(max_cost_usd=0.01),\n])\n\nresult = gate.decide(traj)\nprint(result.decision)   # Decision.SHIP | RETRY | REGENERATE\nprint(result)            # per-metric PASS/FAIL breakdown\n```\n\n## The decision gate\n\nMost eval tools give you a number and stop. `trajeval` answers the question you\nactually have in production — **what do I do with this output?**\n\n- **All metrics pass** → `SHIP`\n- **Only _soft_ metrics fail** (e.g. slightly inefficient) → `RETRY`\n- **Any _hard_ metric fails** (wrong tool, infinite loop) → `REGENERATE`\n\n## Use it in CI / pytest\n\n```python\nfrom trajeval import assert_trajectory, ToolSelectionAccuracy, LoopDetection\n\ndef test_booking_agent_path():\n    traj = run_agent(\"Book a table for 2 at 7pm\")\n    assert_trajectory(\n        traj,\n        ToolSelectionAccuracy([\"search_restaurants\", \"create_booking\"], order_matters=True),\n        LoopDetection(max_repeats=1),\n    )\n```\n\n## Bring your own framework\n\nConvert any run into a `Trajectory` once, then every metric works:\n\n```python\nfrom trajeval import adapters\n\ntraj = adapters.from_anthropic(messages)   # Anthropic Messages API\ntraj = adapters.from_openai(messages)      # OpenAI tool_calls\ntraj = adapters.from_steps(my_dicts)       # raw dicts / your own loop\n```\n\n## Metrics\n\n| Metric | What it catches | Needs LLM? |\n|---|---|:---:|\n| `ToolSelectionAccuracy` | Wrong / missing tools | No |\n| `StepEfficiency` | Bloated, wandering paths | No |\n| `LoopDetection` | Repeated identical calls | No |\n| `CostBudget` | Paths that overspend | No |\n| `ToolErrorRate` | Flaky / failing tool calls | No |\n| `GoalCompletion` | Final state vs the goal | Yes (judge) |\n\nLLM-judged goal completion:\n\n```python\nfrom trajeval import GoalCompletion\nfrom trajeval.judges import anthropic_judge\n\nGoalCompletion(judge=anthropic_judge()).evaluate(traj)\n```\n\n## Roadmap\n\n- [ ] LangChain / LlamaIndex / CrewAI adapters\n- [ ] HTML trajectory report (`trajeval report run.json`)\n- [ ] Regression mode (compare two trajectories on the same task)\n- [ ] More judges (OpenAI, local models)\n\nContributions welcome — open an issue with the failure mode you wish you could catch.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachincse%2Ftrajeval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsachincse%2Ftrajeval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachincse%2Ftrajeval/lists"}