Framework-agnostic coverage testing and observability tool for LLM Agents.
Project description
🛡️ Agent Cover
Agent Cover is an observability and testing framework designed for LLMOps. Unlike traditional tools that measure executed lines of code, Agent Cover measures the Logical Coverage of your Agent.
It verifies that your test suite actually exercises the agent's capabilities: its Prompts, its Tools, and its Business Decision branches.
📉 The Gap in LLM Testing
Traditional tools (like coverage.py) measure Python execution. However, in LLM-based applications, "line coverage" creates a false sense of security.
The Scenario: Your agent has a tool
refund_userand a prompt instruction to "Ask for confirmation".The Problem: Your test runs the code, but the LLM decides to skip the tool or ignore the prompt. Standard coverage says 100%. Agent Cover says 0% Tool Coverage.
🚀 How It Works
Agent Cover operates on a hybrid "Static + Runtime" model:
-
🔍 Inventory Scan (Static): Before tests run, it scans your codebase to build a map of "Logical Assets":
- Prompts: LangChain objects, Jinja2 templates, and raw global strings.
- Tools: Functions decorated with
@toolor inheriting fromBaseTool. - Decisions: Automatically derives coverage rules from your Pydantic models (Enums, Literals, Booleans).
-
⚡ Instrumentation (Runtime): It hooks into the execution lifecycle (LangChain, LlamaIndex, OpenAI, PromptFlow) to verify if those assets were actually used by the LLM.
📦 Installation
pip install agent-cover
For development and testing support:
pip install "agent-cover[dev]"
⚡ Quick Start
1. Configuration (Optional but Recommended)
Create an agent-cover.yaml to define your Business Logic requirements.
# agent-cover.yaml
decisions:
- id: intent_classification
description: "Ensure the agent triggers all support paths"
target_field: intent
expected_values: ["REFUND", "TECH_SUPPORT", "SALES"]
2. Run with Pytest
Simply add the --agent-cov flag to your existing test run.
pytest --agent-cov --agent-cov-html=coverage_report
3. View the Report
Open coverage_report/index.html. You will see:
- Prompt Coverage: Which templates were formatted and sent to the LLM.
- Tool Coverage: Which tools the LLM actually decided to call.
- Decision Coverage: Which logical branches (e.g.,
REFUNDvsSALES) were observed in the output.
🔌 Supported Frameworks
Agent Cover dynamically patches these libraries to intercept logical events.
| Framework | Status | Features Tracked |
|---|---|---|
| LangChain | ✅ | Chains, Agents, Tools, Callbacks, Pydantic Parsers |
| LlamaIndex | ✅ | AgentRunner, FunctionTools, Prompts |
| OpenAI SDK | ✅ | ChatCompletions, Function Calling (Raw Strings) |
| PromptFlow | ✅ | Flow Nodes, Jinja Templates, Python Tools |
| Pydantic | ✅ | Auto-generation of decision rules from Models |
🛠 Advanced Usage: Microsoft PromptFlow
PromptFlow executes nodes in separate worker processes, which breaks standard coverage tools. Agent Cover includes a dedicated CLI wrapper to handle multi-process aggregation.
Instead of running pf run, wrap your command:
# Injects instrumentation into all child worker processes
agent-cover run --source-dir ./src -- pf run create --flow ./my_flow --data data.jsonl
This will automatically aggregate coverage data from all parallel workers into a single report.
🤝 Contributing
Contributions are welcome! Please ensure all pull requests pass the CI quality gates.
- Clone the repository.
- Install development dependencies:
pip install -e ".[dev]" - Install pre-commit hooks:
pre-commit install - Run the test suite:
pytest
📄 License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_cover-0.1.1.tar.gz.
File metadata
- Download URL: agent_cover-0.1.1.tar.gz
- Upload date:
- Size: 78.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4739585f471278b4a6ebc1585148f2b11db681083696c6d32b28b1ca505850df
|
|
| MD5 |
d71a222f42294915a5b631f59bdcbb99
|
|
| BLAKE2b-256 |
5c5b422ce6818e9fd0abe560a354657aeb2dec41453de44a3ee32ae8c6a44b67
|
Provenance
The following attestation bundles were made for agent_cover-0.1.1.tar.gz:
Publisher:
release.yml on vittoriomussin/agent-cover
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_cover-0.1.1.tar.gz -
Subject digest:
4739585f471278b4a6ebc1585148f2b11db681083696c6d32b28b1ca505850df - Sigstore transparency entry: 835361233
- Sigstore integration time:
-
Permalink:
vittoriomussin/agent-cover@43c7cf39c9c634c3b5b8dcda44f4706303f788e1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/vittoriomussin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@43c7cf39c9c634c3b5b8dcda44f4706303f788e1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_cover-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agent_cover-0.1.1-py3-none-any.whl
- Upload date:
- Size: 102.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37cdb22ff31bfed0ae54475f7a9b85289c5d6ac5b70a8e97b9fcab14ad2163f7
|
|
| MD5 |
8836e49e4b4199df52bf001eba2cf673
|
|
| BLAKE2b-256 |
748d7702adc3d6d464f9f5e36b2f334ebc2a21fb79a227233e3f800d6ac64f65
|
Provenance
The following attestation bundles were made for agent_cover-0.1.1-py3-none-any.whl:
Publisher:
release.yml on vittoriomussin/agent-cover
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_cover-0.1.1-py3-none-any.whl -
Subject digest:
37cdb22ff31bfed0ae54475f7a9b85289c5d6ac5b70a8e97b9fcab14ad2163f7 - Sigstore transparency entry: 835361237
- Sigstore integration time:
-
Permalink:
vittoriomussin/agent-cover@43c7cf39c9c634c3b5b8dcda44f4706303f788e1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/vittoriomussin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@43c7cf39c9c634c3b5b8dcda44f4706303f788e1 -
Trigger Event:
push
-
Statement type: