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.8.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.8.0
File Size Uploaded Provenance Actions
agentspec_sdk-0.8.0.tar.gz 59.0 kB Without provenance Details for agentspec_sdk-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 97.0 kB

Release files / agentspec_sdk-0.8.0.tar.gz

Download URL agentspec_sdk-0.8.0.tar.gz
Size 59.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9d1d7ada8532a68e9dbca3dad65094d4ac58e98f9bef5b0d1164151a7991a4ea
BLAKE2b-256 checksum
How to use checksums
d3e4ad712cc758b9964e93746e379e08a896c82a606bd6f46ca5a02cab8b1dd1
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.8.0-py3-none-any.whl

Download URL agentspec_sdk-0.8.0-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dff81f4fb237914f81a9f9eb4994b54c82f4d731b734e4cd4ab32c1a36d6112
BLAKE2b-256 checksum
How to use checksums
f38746c1cf79bd59eaff1e2c7767dbedacec020193d214c782f9c4063fd14cfb
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.8.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