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.3

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.3
File Size Uploaded Provenance Actions
agentspec_sdk-0.7.3.tar.gz 45.3 kB Without provenance Details for agentspec_sdk-0.7.3.tar.gz

Built distribution (wheel)

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

Total release size: 74.2 kB

Release files / agentspec_sdk-0.7.3.tar.gz

Download URL agentspec_sdk-0.7.3.tar.gz
Size 45.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e2f677606f621081b6ac4177a408fb833e918eab87b9ba1f3864184b40fa61b2
BLAKE2b-256 checksum
How to use checksums
e5b41e90c4b9bc02c53d05e0d2aa3323b4276a37bd4c4221a5fadb91f1dc066a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL agentspec_sdk-0.7.3-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca80790dca38a08bd0a8dc4da919d5d5303dbb3ea974061ecad2e6e7c70ff75e
BLAKE2b-256 checksum
How to use checksums
66b4675f6582c676fb23d350b154d92941055dc6ee81b6c87e80db8d8c129e5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for agentspec-sdk 0.7.3

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