Skip to main content

staal

Staal is the programming language for agents: the code an agent runs to send messages, move money and change records. Its compiler refuses a program that could act without a capability, use a model's answer unchecked, let untrusted text instruct a model, or exceed its declared model budget, and its runtime journals every action, so a resumed run replays what finished and never sends an action in doubt again blind.

This package installs the staalc compiler and runtime, and a Python interface to it. No Rust toolchain is needed.

pip install staal
staalc check program.staal
staalc run program.staal

From Python, through Staal's C interface. Your app decides the policy (here, a refund limit per customer tier) and Staal enforces it:

import staal
lib = staal.Library()          # the library installed with this package
limit = 500 if customer["tier"] == "gold" else 50
out = lib.run("refund.staal", {
    "entry": "main",
    "inputs": {"complaint": complaint},
    "grants": {"pay": {"cap": "payments.refund", "each": {"amount": str(limit), "currency": "USD"}}},
    "model": {"provider": "anthropic", "model": "claude-sonnet-5-5", "api_key": {"env": "ANTHROPIC_API_KEY"}},
}, journal="refund.journal")
if out["status"] == "done":
    print(out["result"])

Every call returns the JSON object described in include/staal.h, as a dict. staalc build also needs a C compiler (cc) to link executables.

As a tool. staal.Tool makes a program a tool an agent can call many times, with what one run cannot keep alone: quotas across calls (calls and money per window, each run holding its worst case until it settles), once (the same operation called again is the same run), and recovery (a run a crash interrupted is finished when the journal directory is next opened, by this process or another). Grants are fixed, or computed by your app for each call from a context it passes:

refund = staal.Tool("refund.staal", name="refund_order",
                    description="Refund part of an order.",
                    grants=lambda customer: {"pay": {"cap": "payments.refund", "uses": 1,
                                                     "each": {"amount": LIMITS[customer["tier"]], "currency": "USD"}}},
                    journals="runs", quota={"window": "1h", "money": {"amount": "1000.00", "currency": "USD"}})
r = refund({"order": "4417", "amount": {"amount": "35.00", "currency": "USD"}}, context=customer)
# r.status: "done", "failed", "stopped", "in_progress" or "not_run"; r.text, r.value, r.run

The arguments are only ever inputs: a grant is never an argument, and the model never sees one. An app serving several tenants or users from one directory also gives scope=lambda customer: customer["tenant_id"], from its own records: once keys are then held per scope, and a run's status is given only in its scope (refund.status(run, context=customer)). Inputs that only the app may give, such as the customer a call is for, are app_inputs={"customer": lambda customer: customer["id"]}: they are left out of the schema a model sees, and a call whose arguments name one is refused. One process uses a journal directory at a time (an OS lock; another process waits five seconds, then is refused), so give each worker process its own directory, whose quotas are then its own, or send the calls through one process. The tool's other settings (quota, once, deadline, model, net, secrets, engine) are those of a tool in staalc mcp's manifest (docs/MCP.md).

Agent frameworks. staal.openai_agents.function_tool(tool) gives an OpenAI Agents SDK tool (pip install "staal[openai-agents]"), whose grants come from the run's context; staal.langgraph.structured_tool(tool) gives a LangChain tool for LangGraph (pip install "staal[langgraph]"), with the context taken from config["configurable"]["staal_context"]. staal.claude_agent_sdk.mcp_server(tools, context=customer) serves tools to the Claude Agent SDK as an in-process MCP server, one per session (pip install "staal[claude-agent-sdk]"), and allowed_tools(name, tools) gives their names for allowed_tools. staal.google_adk.adk_tool(tool) gives a Google ADK tool (pip install "staal[google-adk]"), whose context is the session's state under "staal_context", set by the app when it creates the session. A refusal goes back to the model as the tool's output (as an error where the framework has a way to say so), the broker's message included. Each is tested through the framework's own agent loop (openai-agents 0.24.0, langgraph 1.2.16, claude-agent-sdk 0.2.168, whose loop runs in the Claude Code CLI it bundles, against a local stand-in for the Messages API, and google-adk 2.12.0), and once a week against each framework's latest release; the examples are in examples/frameworks.

Platforms. Python 3.8 or newer, on Linux (x86_64 and arm64, glibc 2.28 or newer) and macOS (Apple Silicon, macOS 11 or newer; Intel, macOS 10.12 or newer), from 0.24.0. Version 0.23.0 has Linux x86_64 and macOS 15 wheels only. Elsewhere, build from source.

Status. A preview: tested on all four platforms above, with no independent security review yet. The tutorial takes about an hour.

Licence. Apache-2.0 WITH LLVM-exception. The package contains staalc and its Rust dependencies, whose licences are in LICENSE-THIRD-PARTY.txt.

Metadata

Release files for staal 0.29.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for staal 0.29.0
File Actions
staal-0.29.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for staal-0.29.0-py3-none-manylinux_2_28_x86_64.whl
staal-0.29.0-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for staal-0.29.0-py3-none-manylinux_2_28_aarch64.whl
staal-0.29.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for staal-0.29.0-py3-none-macosx_11_0_arm64.whl
staal-0.29.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for staal-0.29.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 122.7 MB

Release files / staal-0.29.0-py3-none-manylinux_2_28_x86_64.whl

Download URL staal-0.29.0-py3-none-manylinux_2_28_x86_64.whl
Size 34.9 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
0d3c2e8f36e1e39e0854fe490e42ff6141f5b43586826ac1718a56833813a1b9
BLAKE2b-256 checksum
How to use checksums
8f4184a099aa50d2cdfc9febf1ab4685217f7d2fb98c2e9980efc69fbe49d9dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / staal-0.29.0-py3-none-manylinux_2_28_aarch64.whl

Download URL staal-0.29.0-py3-none-manylinux_2_28_aarch64.whl
Size 32.3 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
ac8a7472258c5faf403e8e5c4b465146824b2dcc8a0f1ed528bd2def784e01e9
BLAKE2b-256 checksum
How to use checksums
c0b6f7699ddd8f25ad3b27d784b08931c4eb66fc76767435f52cd8bce3f4a4f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / staal-0.29.0-py3-none-macosx_11_0_arm64.whl

Download URL staal-0.29.0-py3-none-macosx_11_0_arm64.whl
Size 26.7 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cb1b4619df73aa674a921b0c2b46a764636bb740d1cd17d50ea698afa18ce1d4
BLAKE2b-256 checksum
How to use checksums
c51a73ff899e0b45cc3a0de323c7c45d4c5e700abb07c16573ae2ca7cf5d92e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / staal-0.29.0-py3-none-macosx_10_12_x86_64.whl

Download URL staal-0.29.0-py3-none-macosx_10_12_x86_64.whl
Size 28.9 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8f11b4e7049b962f6491e29207bf78afbb57bf49bde4bb337241fb15eb2a89af
BLAKE2b-256 checksum
How to use checksums
3f8a5858ab993aff00d2ea33d3371c754c4b6c10b16ee6e9154b2617b9510ade
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for staal 0.29.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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for staal-0.29.0-py3-none-manylinux_2_28_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

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