Skip to main content

Every existing tool evaluates what the agent said. OpenEval evaluates what the agent did.

Project description

OpenEval

PyPI - Version Python - Versions License: MIT CI codecov

Every existing tool evaluates what the agent said. OpenEval evaluates what the agent did.

Installation

pip install openeval-core

Note: While the package is installed as openeval-core, the CLI command to run it is openeval.

Usage

Run a single test case using the included example:

openeval run --trace examples/simple_agent/trace.json --testcase examples/simple_agent/testcase.json

Run a test suite:

openeval run --suite tests/ --output results/

Generate a report:

openeval report --input results/ --format markdown

Note: The report command will exit with a non-zero status code (1) if any JSON file in the input directory is malformed or fails to load, guaranteeing pipeline failures on corrupted evals.

Quickstart

Get your first deterministic evaluation running in under 2 minutes. OpenEval is completely framework-agnostic.

Tier 1: The Core Engine (No Framework Required)

The core engine requires zero dependencies on external frameworks or LLM SDKs. You just feed it plain Python data.

1. Install the package

pip install openeval-core

2. Score a trace deterministically Create a file named hello_eval.py and run it:

from openeval.metrics import ToolSelectionAccuracy
from openeval.models import AgentTrace, EvalTestCase, TraceStep

# 1. Define what the agent was supposed to do
test_case = EvalTestCase(
    task_id="quickstart-1",
    input="Search for the weather in Tokyo",
    expected_tool_calls=[{"tool": "search", "args": {"query": "weather in Tokyo"}}],
    expected_final_state={},
    expected_output_contains=[],
    max_steps=5,
    timeout_seconds=10.0
)

# 2. Provide the raw trace of what the agent actually did
trace = AgentTrace(
    task_id="quickstart-1",
    input="Search for the weather in Tokyo",
    steps=[
        TraceStep(
            step_id=1, 
            type="tool_call", 
            content="", 
            tool_name="search", 
            tool_args={"query": "weather in Tokyo"}, 
            tool_result="85 degrees and sunny", 
            timestamp=0.0
        )
    ],
    final_output="The weather in Tokyo is 85 degrees and sunny.",
    actual_state={},
    metadata={}
)

# 3. Score it deterministically (no LLM required)
metric = ToolSelectionAccuracy()
result = metric.score(trace, test_case)

print(f"Metric: {result.metric_name}")
print(f"Score: {result.score} (Passed: {result.passed})")
print(f"Details: {result.details}")

Expected Output:

Metric: Tool Selection Accuracy
Score: 1.0 (Passed: True)
Details: Correctly called 1 of 1 expected tools.

Tier 2: Using OpenEval with LangChain

If your traces come from LangChain, you can use our built-in adapter to automatically convert LangChain runs into OpenEval traces.

1. Install with LangChain support

pip install "openeval-core[langchain]"

2. Convert and Score (See the examples/ directory in our GitHub repository for full, runnable agent scripts using this adapter.)

from openeval.adapters.langchain import from_langchain_run
from langchain_core.tracers.context import collect_runs

with collect_runs() as cb:
    # Run your langchain agent
    agent.invoke({"input": "task input"})
    
# Convert the run to an OpenEval AgentTrace
trace = from_langchain_run(cb.traced_runs[0])

# Score it exactly like Tier 1
# metric.score(trace, test_case)

OpenAI Tool Calling

OpenEval can automatically convert raw OpenAI chat completions message lists into AgentTrace objects.

LIMITATION: This adapter flattens the message list. Only the first user message is used as the input, and the final assistant message without tool calls is used as the output. Any intermediate non-tool conversational turns are not captured structurally.

from openeval.adapters.openai import from_openai_messages

messages = [
    # ... your OpenAI messages list
]

# Convert the messages
trace = from_openai_messages(messages)

GitHub Action

OpenEval provides a GitHub Action to seamlessly gate PRs based on your agents' performance.

steps:
  - uses: actions/checkout@v4
  - name: Grade Agent Execution
    uses: organization/openeval-core@v1
    with:
      suite: path/to/your/test_suite_dir
      fail-under: '0.8'  # Fail the step if average metric score is < 80%

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openeval_core-0.1.2.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openeval_core-0.1.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file openeval_core-0.1.2.tar.gz.

File metadata

  • Download URL: openeval_core-0.1.2.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openeval_core-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a801ab4cf6a58bf7db4c17c2d666dbffc6e5889cb9369dc19bbeeec39f8df50e
MD5 14b531dcf9361d5a898057e1eea8ba28
BLAKE2b-256 3cf380abfc92936ce7a495103c43feb53afa58553bea12862104ea32bf9cffeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for openeval_core-0.1.2.tar.gz:

Publisher: publish.yml on yash161004/OpenEval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openeval_core-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: openeval_core-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openeval_core-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a081c40297fe70b390c06eab8f3dab8e69986872beaf6d36da875f74ab35beec
MD5 c4a4db375bbe7df0e01046c531e2a07c
BLAKE2b-256 1c42c0e59cce628c60156e7e1ceaa00f9b546e2188a6861daff7b2fd6af53043

See more details on using hashes here.

Provenance

The following attestation bundles were made for openeval_core-0.1.2-py3-none-any.whl:

Publisher: publish.yml on yash161004/OpenEval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page