Skip to main content

CortexOps

Reliability infrastructure for AI agents.
Evaluate · Observe · Operate — for LangGraph, CrewAI, and AutoGen.

PyPI version Python 3.10+ CI License: MIT


What's New in v0.5.1

Prompt version tracking

tracer = CortexTracer(project="payments-agent")
tracer.set_prompt("refund-system", "v3")   # every trace is tagged refund-system@v3
graph = tracer.wrap(your_langgraph_app)

with tracer.use_prompt("refund-system", "v4-candidate"):
    graph.invoke({"messages": [...]})       # tagged v4-candidate, then back to v3

Filter hosted traces with GET /v1/traces?project=...&prompt_name=refund-system&prompt_version=v3.

pytest eval gates

# test_agent_quality.py — pip install "cortexops[pytest]"
import cortexops

@cortexops.eval_gate("golden_v1.yaml", fail_on="task_completion < 0.90")
def test_payments_agent():
    return build_agent()   # return the agent; the gate runs every case

The plugin loads automatically, prints an eval summary at the end of the pytest run, and marks gates with cortexops_eval so pytest -m "not cortexops_eval" skips them.

Sampling configuration

export CORTEXOPS_SAMPLE_RATE=0.1   # trace 10% of successful runs; failures are always captured

Or pass CortexTracer(sample_rate=0.1, sample_errors=True).


What's New in v0.4.0

LLM-as-judge evaluation

from cortexops.judge import LLMJudge

judge = LLMJudge(api_key="sk-...")
result = judge.evaluate(
    case_id="case-001",
    input="Process refund for order #4821",
    output="Refund of $49.99 approved and processed.",
    rubric="task_completion",
)
print(result.score, result.passed, result.reasoning)

Golden dataset API

from cortexops.dataset import GoldenDataset

ds = GoldenDataset(name="refund-agent-v1")
ds.add(input="Refund order #4821", expected="refund_approved")
ds.add(input="Cancel subscription", expected="subscription_cancelled")
ds.save("datasets/refund_agent.yaml")

results = ds.run(agent=your_agent, fail_on="task_completion < 0.90")

CI/CD eval gate

cortexops eval run \
  --dataset datasets/refund_agent.yaml \
  --judge \
  --fail-on "task_completion < 0.90"
# Exit code 1 if regression detected — drop into GitHub Actions

The problem

You deployed an agent. You have no idea if it regressed overnight.

No standard eval format. No failure traces. No CI gate before the next prompt change ships.
CortexOps fixes that.


Quickstart

pip install cortexops  # v0.4.0
from cortexops import CortexTracer, EvalSuite

# Wrap your LangGraph app — zero refactor required
tracer = CortexTracer(project="payments-agent")
graph  = tracer.wrap(your_langgraph_app)

# Run evaluations against a golden dataset
results = EvalSuite.run(
    dataset="golden_v1.yaml",
    agent=graph,
)

print(results.summary())
# CortexOps eval — payments-agent
#   Cases           : 9  (7 passed, 2 failed)
#   Task completion : 91.4%
#   Tool accuracy   : 97.0/100
#   Latency p50/p95 : 42ms / 187ms
#   Failed cases:
#     - escalation_router: tool_call_mismatch (score 41)

Golden dataset format

Define test cases in YAML. Run them locally or in CI.

# golden_v1.yaml
version: 1
project: payments-agent

cases:
  - id: refund_lookup_01
    input: "What is the status of refund REF-8821?"
    expected_tool_calls: [lookup_refund]
    expected_output_contains: ["approved", "REF-8821"]
    max_latency_ms: 3000

  - id: dispute_escalation_01
    input: "I was charged twice — this is unauthorized"
    expected_tool_calls: [classify_dispute, route_escalation]
    expected_output_contains: ["escalated"]
    max_latency_ms: 5000

CI eval gate

Add to .github/workflows/eval.yml:

- name: CortexOps eval gate
  run: |
    python examples/langgraph_payments/run_eval.py \
      --dataset golden_v1.yaml \
      --fail-on "task_completion < 0.90"

If the eval drops below threshold, the job exits non-zero and the PR is blocked.

Prefer pytest? Use @cortexops.eval_gate(...) and run the gate with the rest of your test suite.


Repo structure

cortexops/
├── sdk/                        # pip install cortexops  # v0.4.0
│   ├── cortexops/
│   │   ├── tracer.py           # CortexTracer — wraps LangGraph / CrewAI
│   │   ├── eval.py             # EvalSuite — golden dataset runner
│   │   ├── metrics.py          # task_completion, tool_accuracy, latency, hallucination
│   │   ├── models.py           # Pydantic data models
│   │   └── client.py           # HTTP client for hosted API
│   └── tests/
├── backend/                    # FastAPI + Celery + SQLite/Postgres
│   ├── app/
│   │   ├── main.py
│   │   ├── routers/            # /v1/evals, /v1/traces
│   │   ├── models/             # DB records + API schemas
│   │   └── worker/             # Celery async eval tasks
│   └── Dockerfile
├── frontend/                   # React + TypeScript dashboard
├── examples/
│   └── langgraph_payments/     # Full runnable demo
│       ├── agent.py
│       ├── golden_v1.yaml
│       └── run_eval.py
└── docker-compose.yml

Run the full stack locally

git clone https://github.com/ashishodu2023/cortexops
cd cortexops

# Start API + worker + Redis
docker compose up --build

# In another terminal — run the demo eval
cd examples/langgraph_payments
pip install -e ../../sdk/
python run_eval.py

# API docs at http://localhost:8000/docs
# Dashboard at http://localhost:3000

Supported frameworks

Framework Status
LangGraph Stable
CrewAI Stable
AutoGen Beta
LlamaIndex agents Coming soon
Custom callables Supported via CortexTracer.wrap()

Built-in metrics

Metric What it checks
task_completion Agent produced a valid, non-error output
tool_accuracy Expected tool calls were actually made
latency Response within max_latency_ms budget
hallucination Detects fabrication signals in output

Add custom metrics by subclassing cortexops.Metric.


Contributing

git clone https://github.com/ashishodu2023/cortexops
cd cortexops/sdk
pip install -e ".[dev]"
pytest tests/ -v

See CONTRIBUTING.md. Issues labeled good first issue are a great place to start.


Citation

@software{cortexops2025,
  author  = {Ashish, et al.},
  title   = {CortexOps: Reliability Infrastructure for AI Agents},
  year    = {2025},
  url     = {https://github.com/ashishodu2023/cortexops},
}

License

MIT — see LICENSE.


cortexops.ai · Issues · Discussions

Metadata

Release files for cortexops 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cortexops 0.5.1
File Size Uploaded Provenance Actions
cortexops-0.5.1.tar.gz 41.7 kB With provenance Details for cortexops-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cortexops 0.5.1
File Interpreter ABI Platform Actions
cortexops-0.5.1-py3-none-any.whl Python 3 none any Details for cortexops-0.5.1-py3-none-any.whl

Total release size: 80.2 kB

Release files / cortexops-0.5.1.tar.gz

Download URL cortexops-0.5.1.tar.gz
Size 41.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8e1500059a6ef5c77cc1ce8b29506e9595e32b018e46a4047ae000b1cde19321
BLAKE2b-256 checksum
How to use checksums
166ddad0af911c1e04e6dc1f9cdd196be85eee9e787bbf8a9339f173dca7c1f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / cortexops-0.5.1-py3-none-any.whl

Download URL cortexops-0.5.1-py3-none-any.whl
Size 38.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
608b008de2d0d2c081ffa75a61649be62c0cf4d1e568b3241606b08865639657
BLAKE2b-256 checksum
How to use checksums
2831c50b120c9f1a239e287843388e1c1473b4808cd26de920205519c8c3a54b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Security for cortexops 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cortexops-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page