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(api_key="<agent token>")  # heartbeat 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.5.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.5.0
File Size Uploaded Provenance Actions
agentspec_sdk-0.5.0.tar.gz 39.6 kB Without provenance Details for agentspec_sdk-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 65.2 kB

Release files / agentspec_sdk-0.5.0.tar.gz

Download URL agentspec_sdk-0.5.0.tar.gz
Size 39.6 kB
Tags Source
SHA-256 checksum
How to use checksums
15f371d3680f93007127118b1a23967ac8a12b130832b1112e21eb03936c2c73
BLAKE2b-256 checksum
How to use checksums
78fe676560521bc289060f088842f49e697f8cdf7496349368e77478107848e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

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

Download URL agentspec_sdk-0.5.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbaf9f1484d76a52a824ab8cfaab94f4e7965f87205062537f4839deafd0399d
BLAKE2b-256 checksum
How to use checksums
a5b63dd0ef4daa3bb5512b56758e13bff53aa8b93dc3c90d3be8491162350764
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

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