Skip to main content

ASAP Compliance Harness

Protocol compliance testing suite for ASAP (Async Simple Agent Protocol) implementations.

Overview

The Compliance Harness validates that ASAP agents follow the protocol specification. Third parties can use this package to certify their agents are ASAP-compliant, enabling ecosystem interoperability.

Installation

uv add asap-compliance
# or
pip install asap-compliance

Usage

Run compliance tests against an agent:

pytest --asap-agent-url https://your-agent.example.com -m asap_compliance

Or set the agent URL via environment variable:

ASAP_AGENT_URL=https://your-agent.example.com pytest -m asap_compliance

Test Categories

  • handshake (implemented): Agent connection, health/content-type, manifest schema, signature verification, version negotiation
  • schema (implemented): Pydantic model compliance (Envelope, TaskRequest, TaskResponse, McpToolResult, MessageAck, extensions, extra='forbid')
  • state: Task state machine transitions

Profiles

A profile checks one integration against a running server. It returns one result per check ID, and a failed check says what it expected and what it got. The compliance testing guide lists every config field and every check ID.

  • mcp-auth-bridge (since 1.3.0). Checks stdio MCP JWTs, grants, and constraints. It also checks that the server registers each tool in the manifest. See MCP Auth Bridge and the stdio example.
  • mcp-auth-http: an HTTP MCP server protected by @asap-protocol/mcp-auth, checked over plain HTTP, with no MCP SDK. Each refusal must carry the right asap:* code in the right layer (HTTP 401 or 403 with a Bearer challenge, or a tool error result). It also checks Agent JWT replay, access-token reuse, a tool that the server does not declare, and that no answer echoes a token. Config: McpAuthHttpComplianceConfig; entry point: validate_mcp_auth_http.
  • a2a-bridge: an A2A v1.0 agent served by an ASAP gateway. The Agent Card must be at the well-known path, parse as A2A v1.0, verify under the keys in your config, name the agent URN in your config, list the gateway's JSON-RPC interface, and match the ASAP manifest on the same origin. Then one SendMessage per case: a valid access token (sent twice), no token, a malformed, forged, or wrong-audience token, a token without the grant, arguments that break the grant's constraint, and a skill that the card does not list. Config: A2ABridgeComplianceConfig; entry point: validate_a2a_bridge.

The two HTTP profiles need a fresh token for each request. By default they get them from the server's test-only probe endpoint (probe_tokens_url); you can pass your own ProbeTokenProvider instead. This version of the package needs asap-protocol 2.6.0 or later.

Select a profile by name and run it:

from asap_compliance import profile_config, validate_profile

config = profile_config("mcp-auth-http", {
    "mcp_url": "http://127.0.0.1:8787/mcp",
    "probe_tokens_url": "http://127.0.0.1:8787/compliance/probe-tokens",
})
result = validate_profile(config)
for check in result.checks:
    print("PASS" if check.passed else "FAIL", check.name, check.message)

Or with pytest: put the config fields in a JSON file, and write one test that takes the compliance_profile fixture:

# test_profile.py
from asap_compliance import validate_profile


def test_profile(compliance_profile):
    result = validate_profile(compliance_profile)
    assert result.passed, [check for check in result.checks if not check.passed]
pytest test_profile.py --asap-profile a2a-bridge --asap-profile-config a2a-bridge.json

The default mcp-auth-bridge config uses the example server and manifest fixture from the ASAP Protocol checkout. If you install the package outside the checkout, select --asap-profile mcp-auth-bridge and pass a JSON file with --asap-profile-config. Set server_command to a list with the command and arguments for your stdio server. Set manifest_fixture_path to the path to your manifest JSON file, or set it to null and supply manifest_url.

Protocol v2.2 and Compliance Harness v2

This package focuses on handshake, schema, state, and SLA validators for third-party certification. Compliance Harness v2 (identity, streaming, errors, versioning, batch, audit checks against the v2.2 spec) ships with the main asap-protocol library — use from asap.testing.compliance import run_compliance_harness_v2 on an ASGI app. See the changelog for v2.2.0 details.

Programmatic Usage

# Handshake validation (against live agent)
from asap_compliance import ComplianceConfig, validate_handshake

config = ComplianceConfig(agent_url="https://your-agent.example.com")
result = validate_handshake(config)
if result.passed:
    print("Agent is compliant")
else:
    for check in result.checks:
        if not check.passed:
            print(f"FAIL: {check.name} - {check.message}")

# Schema validation (static, for envelope/payload dicts)
from asap_compliance import validate_schema

envelope_dict = {"asap_version": "0.1", "sender": "urn:asap:agent:a", ...}
schema_result = validate_schema(envelope_dict)
if schema_result.passed:
    print("Envelope and payload schema valid")

Development

cd asap-compliance
uv sync
uv run pytest

Metadata

Release files for asap-compliance 1.4.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 asap-compliance 1.4.0
File Size Uploaded Provenance Actions
asap_compliance-1.4.0.tar.gz 130.4 kB Without provenance Details for asap_compliance-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asap-compliance 1.4.0
File Interpreter ABI Platform Actions
asap_compliance-1.4.0-py3-none-any.whl Python 3 none any Details for asap_compliance-1.4.0-py3-none-any.whl

Total release size: 181.8 kB

Release files / asap_compliance-1.4.0.tar.gz

Download URL asap_compliance-1.4.0.tar.gz
Size 130.4 kB
Tags Source
SHA-256 checksum
How to use checksums
67c80534e2513d9d84c0817a36e84a5202ce8eb2688e9a5c593dc847f5fcf10d
BLAKE2b-256 checksum
How to use checksums
4af3ba7093c4d694dd9e7bb9999def74be8c4689a1bce363b87c9d45cc0d41d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / asap_compliance-1.4.0-py3-none-any.whl

Download URL asap_compliance-1.4.0-py3-none-any.whl
Size 51.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03ef126568268684ddc60109c4c7575bf09cfd072d71cee02504927cabf101ef
BLAKE2b-256 checksum
How to use checksums
3eb46a7cae39a8b14cc964052c90c33deb30f5c5f02c5dd1503f854a6c805f23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for asap-compliance 1.4.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.

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