Skip to main content

callspec

Contract testing for LLM tool calls.

pip install callspec
from callspec import Callspec, ToolCall, ToolCallTrajectory
from callspec.providers.mock import MockProvider

provider = MockProvider(
    response_fn=lambda p, m: "Booked flight",
    tool_calls=[
        {"name": "search_flights", "arguments": {"origin": "SFO", "dest": "JFK"}},
        {"name": "book_flight", "arguments": {"flight_id": "UA123"}},
    ],
)

v = Callspec(provider)
response = provider.call("Book me a flight from SFO to JFK")
trajectory = ToolCallTrajectory.from_provider_response(response)

result = (
    v.assert_trajectory(trajectory)
    .calls_tools_in_order(["search_flights", "book_flight"])
    .does_not_call("cancel_flight")
    .argument_not_empty("search_flights", "origin")
    .run()
)
assert result.passed

Your agent calls tools. Those calls are the contract between your code and the model. When you swap models, update a prompt, or change your retrieval pipeline, callspec tells you whether the agent still calls the right tools, in the right order, with the right arguments. No LLM-as-judge. No API calls for evaluation. Deterministic pass/fail that runs in CI.

Docs

License

Apache 2.0

Metadata

Release files for callspec 0.1.0

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

Source distribution (sdist)

Source distribution for callspec 0.1.0
File Size Uploaded Provenance Actions
callspec-0.1.0.tar.gz 124.2 kB Without provenance Details for callspec-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 224.2 kB

Release files / callspec-0.1.0.tar.gz

Download URL callspec-0.1.0.tar.gz
Size 124.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bb683868f551b10bd1ce858d97c907e40574ffd484a81f4a2511583c52473c05
BLAKE2b-256 checksum
How to use checksums
7f74f96898cdb2363631ee3363ba330603f4f29a767b5ef35e9f1f8168d16245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / callspec-0.1.0-py3-none-any.whl

Download URL callspec-0.1.0-py3-none-any.whl
Size 100.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee0c31d891d39a1cabba5fbdef0bd114c174d543ebe37a0b8e6ad1ca8b105a30
BLAKE2b-256 checksum
How to use checksums
4973f2eb3dce028361dcebefd904052d3821e1decefd8fb0fc5f1a40ede401d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for callspec 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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