Python SDK¶
The Strahl Python SDK provides a typed client for the Strahl API, message parsing for OpenAI and Anthropic transcript formats, and a decorator-based tool registration API.
- Install:
pip install strahl - Requires: Python 3.10+
- Dependency:
httpx - Source: github.com/strahl-labs/strahl-client
Quickstart¶
import os
import strahl
from strahl import Label
strahl.set_api_key(os.environ["STRAHL_API_KEY"])
strahl.set_role_labels({
"user": Label(source={"user"}, visibility={"user"}),
"assistant": Label(source={"assistant"}, visibility={"user"}),
})
@strahl.tool(
requires=Label(source={"user"}, visibility={"user"}),
produces=Label(source={"email-tool"}, visibility={"user"}),
)
def send_email(to: str, subject: str, body: str) -> str:
...
analysis = strahl.analyze(messages)
analysis.raise_if_denied()
In this section¶
- Getting Started — installation, first analysis, where to call
analyze() - Concepts — labels, policies, tag sets, how analysis works
- Guides — prompt injection defense, multi-tenant isolation, provider formats
- Reference — full API reference