Skip to main content

agentspec-sdk

Python runtime SDK for AgentSpec: serves GET /agentspec/health and pushes state to the control plane from an agent described by agent.yaml.

pip install agentspec-sdk
from agentspec_sdk import AgentSpecReporter

reporter = AgentSpecReporter.from_yaml("agent.yaml")

# WSGI app answering GET /agentspec/health with the TypeScript HealthReport keys
# (agentName, checks[].latencyMs), so the sidecar sees the SDK. Mount it in your framework.
app = reporter.wsgi_app()

Mount the app so the full request path is /agentspec/health. At the root it answers that path directly. Under a prefix, the dispatcher moves the prefix into SCRIPT_NAME; the app compares SCRIPT_NAME + PATH_INFO, so mounting it at /agentspec (for example DispatcherMiddleware(fallback, {"/agentspec": reporter.wsgi_app()})) serves /agentspec/health too.

Evidence points

The SDK is the Python runtime SDK of ADR-0038: framework-agnostic, the same evidence points and record shapes as @agentspec/sdk/runtime in TypeScript. Create the reporter first, then wrap the operations the rules are about:

import agentspec_sdk
from agentspec_sdk import AgentSpecReporter

reporter = AgentSpecReporter.from_yaml("agent.yaml")


@agentspec_sdk.guardrail("input")      # SEC-LLM-01; "output" for SEC-LLM-02
def run_input_guardrails(text: str) -> str:
    return text


@agentspec_sdk.tool("search-web")      # TOOL-01
def search_web(query: str) -> list[str]:
    return []


reporter.start_push_mode()  # heartbeat to the sidecar on loopback, with each evidence point's state and records
Helper Contract name Wraps
guardrail("input" | "output") guardrail A guardrail function (decorator) or block (with)
tool(name) tool A local tool function
mcp_client(session, server) mcpClient A stdio MCP client session
memory_write(backend) memoryWrite A LangGraph checkpointer or Store: scrubs, applies the TTL, audits
vector_store(client, namespace=None) vectorStore A vector store client
structured_logging(logger=None) logging The logger's stream handlers: JSON lines

Each applicable evidence point is reported fired, wired or not_wired; not_wired never passes. See the runtime SDK concept page and the evidence wiring guide.

The distribution is agentspec-sdk and the import is agentspec_sdk. The PyPI name agentspec belongs to an unrelated project.

Metadata

Release files for agentspec-sdk 0.7.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 agentspec-sdk 0.7.0
File Size Uploaded Provenance Actions
agentspec_sdk-0.7.0.tar.gz 45.0 kB Without provenance Details for agentspec_sdk-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentspec-sdk 0.7.0
File Interpreter ABI Platform Actions
agentspec_sdk-0.7.0-py3-none-any.whl Python 3 none any Details for agentspec_sdk-0.7.0-py3-none-any.whl

Total release size: 73.8 kB

Release files / agentspec_sdk-0.7.0.tar.gz

Download URL agentspec_sdk-0.7.0.tar.gz
Size 45.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ab0777b6bbefa132a18e37bc8cfbdc913b3a3172b638779da3b133792116fc9a
BLAKE2b-256 checksum
How to use checksums
cdb2bec4e28247c63364b8fe41f262eb784bdda01abf552bf5d056275e6fee02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / agentspec_sdk-0.7.0-py3-none-any.whl

Download URL agentspec_sdk-0.7.0-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4f189da43f75b9229b6394c7667ac1ecf23d65e9a2d8e6f71633370b72eb5a2
BLAKE2b-256 checksum
How to use checksums
d8d751d5729d893fca7694378665b4259998607b4e2972d9fc6201438feeb748
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for agentspec-sdk 0.7.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