Skip to main content

ECP Python SDK

Python SDK for building agents that comply with the Evaluation Context Protocol (ECP).

ECP is a vendor-neutral protocol for testing agent outputs, tool calls, and evaluator-visible audit context across frameworks, models, eval platforms, and CI systems.

Install

pip install "ecp-sdk==0.10.0"

Framework extras:

pip install "ecp-sdk[langchain]==0.10.0"
pip install "ecp-sdk[crewai]==0.10.0"
pip install "ecp-sdk[llamaindex]==0.10.0"
pip install "ecp-sdk[pydanticai]==0.10.0"

Usage

from ecp import Result, agent, on_step, serve


@agent(name="MyAgent")
class MyAgent:
    @on_step
    def step(self, user_input: str):
        return Result(
            public_output=f"Echo: {user_input}",
            evaluation_context="Echoed the input for evaluation.",
            tool_calls=[{"name": "echo", "arguments": {"text": user_input}}],
        )


if __name__ == "__main__":
    serve(MyAgent())

evaluation_context is the preferred field for evaluator-safe audit evidence. private_thought is still accepted as a deprecated compatibility alias.

The SDK automatically negotiates ECP protocol 1.0 during agent/initialize. Protocol versions are independent of the SDK package version; applications do not need to add negotiation code.

Async lifecycle hooks

@on_step and @on_reset may be synchronous functions or async def coroutines. The SDK awaits async hooks on one persistent event loop, so loop-bound clients and other async resources can be reused across requests.

import asyncio

from ecp import Result, agent, on_reset, on_step, serve


@agent(name="AsyncAgent")
class AsyncAgent:
    @on_step
    async def step(self, user_input: str) -> Result:
        await asyncio.sleep(0.01)
        return Result(public_output=f"Processed: {user_input}")

    @on_reset
    async def reset(self) -> None:
        await asyncio.sleep(0)


if __name__ == "__main__":
    serve(AsyncAgent())

The same hooks work with serve_http(...). See examples/async_python_demo for a runnable agent that supports either transport.

Streamable HTTP

Agents can also run as an ECP Streamable HTTP server:

if __name__ == "__main__":
    ecp.serve_http(MyAgent(), host="127.0.0.1", port=8765, path="/ecp")

The endpoint accepts JSON-RPC POST requests at /ecp. It returns JSON for requests, 202 Accepted for notifications, and 405 Method Not Allowed for GET SSE streams until ECP defines server-initiated messages.

Testing Your Own Adapter

The bundled adaptors are a convenience, not a requirement - any framework works if you return a Result. If you write your own, ecp.testing is the same harness the built-in adaptors use, so you can pin its behaviour without installing your framework in CI or holding API keys:

from ecp.testing import record_fixture, replay

# Once, with the framework installed and credentials set:
fixture = record_fixture("crewai", crew, "What is 15 multiplied by 8?")
fixture.save("tests/fixtures/crew_calculator.json")

# Then in CI, offline:
from ecp.testing import AdapterFixture, diff_expected
assert diff_expected(AdapterFixture.load("tests/fixtures/crew_calculator.json")) == []

record_fixture captures the framework's real response object and the Result your adapter produced from it. replay re-runs the adapter against that capture. When a framework reshapes its internals, your tool_calls would otherwise go quietly empty and every tool_usage grader would fail as if the agent had regressed - this turns that into a clear test failure.

Metadata

Release files for ecp-sdk 0.10.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 ecp-sdk 0.10.0
File Size Uploaded Provenance
ecp_sdk-0.10.0.tar.gz 28.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ecp-sdk 0.10.0
File Interpreter ABI Platform
ecp_sdk-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.9 kB

Release files / ecp_sdk-0.10.0.tar.gz

Download URL ecp_sdk-0.10.0.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e44ea38dd25f17cf7feeb349e8807e9f3d502c6a828cb7b0600967e94abc1544
BLAKE2b-256 checksum
How to use checksums
e7db146407f91c4eef47ab2773668a9832f0f44b0864ed1d876e3c773cfe7562
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 18, 2026.

Transparency log

Release files / ecp_sdk-0.10.0-py3-none-any.whl

Download URL ecp_sdk-0.10.0-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cedd6c519352a5b12d745e433b4cc01c95d5f651f019a92e3ee299c475a5db84
BLAKE2b-256 checksum
How to use checksums
82d37f2362274bd160fc473af707b0f3a8faff85a5219dc6c355b7049064e8a8
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 18, 2026.

Transparency log

Security for ecp-sdk 0.10.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.

Full provenance

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

Select from 2 files

Attestation for ecp_sdk-0.10.0.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 18, 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