Skip to main content

Starweaver Python

starweaver is the in-process Python SDK and binding package for Starweaver. It keeps the Rust runtime as the canonical agent loop while exposing Python ergonomics for agents, tools, models, sessions, streams, resources, media, and deterministic tests.

Python tools are injected directly as native Starweaver runtime tools. They do not use MCP, stdio, or another binary protocol.

Supported Python versions are CPython 3.11 through 3.13. Local development and single-version CI jobs default to Python 3.13.

Quickstart

import asyncio

from starweaver import create_agent, tool
from starweaver.testing import TestModel


@tool
async def add(left: int, right: int) -> dict[str, int]:
    return {"total": left + right}


async def main() -> None:
    model = TestModel.responses(
        [
            TestModel.tool_call_response(
                [{"id": "call_add", "name": "add", "arguments": {"left": 2, "right": 3}}]
            ),
            {"text": "done"},
        ]
    )
    result = await create_agent(model=model, tools=[add]).run("Add two numbers")
    print(result.output)


asyncio.run(main())

Core Surfaces

  • create_agent() builds a Python facade over the Rust runtime.
  • @tool, raw callables, and BaseTool register in-process tools.
  • Independent tool calls run in parallel by default; use sequential=True for ordered side effects.
  • Toolset, ToolSearchToolset, and ToolProxyToolset compose grouped tools.
  • ProviderModel, TestModel, and FunctionModel cover production providers, deterministic scripts, and callback-backed tests.
  • OutputSchema, OutputPolicy, validators, and output functions handle final output.
  • AgentSession and SessionArchive preserve reusable session state.
  • EnvironmentProvider, ResourceRef, SkillRegistry, and MediaUploader expose environment, resource, skill, and media boundaries.

Stream Boundary

run_stream() currently returns AgentRun, an async iterator over canonical StreamEvent records plus a Python facade for recv(), join(), result(), status(), recoverable_state(), interrupt(), active messages, steering, and streamed HITL helpers. The stable portable contract is the canonical StreamEvent.raw record sequence and collected run result. Python live-control ergonomics are the current facade, not a separately frozen live-handle protocol.

AgentStream remains a compatibility alias for AgentRun.

Documentation

Start with docs/python-sdk.md in the repository. The Python docs are organized by feature:

  • docs/python/agents.md
  • docs/python/tools.md
  • docs/python/toolsets.md
  • docs/python/models.md
  • docs/python/output.md
  • docs/python/sessions-streams.md
  • docs/python/environments-skills.md
  • docs/python/media.md
  • docs/python/testing.md
  • docs/python/examples.md
  • docs/python/stability.md

Runnable examples live in examples/python/.

Validation

From the repository root:

make py-sync
make py-lint
make py-rust-check
make py-test
make py-wheel-smoke
make py-check

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

starweaver-0.9.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

starweaver-0.9.0-cp313-cp313-win_amd64.whl (14.5 MB view details)

Uploaded CPython 3.13Windows x86-64

starweaver-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

starweaver-0.9.0-cp313-cp313-macosx_11_0_arm64.whl (14.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

starweaver-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl (14.6 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

starweaver-0.9.0-cp312-cp312-win_amd64.whl (14.5 MB view details)

Uploaded CPython 3.12Windows x86-64

starweaver-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

starweaver-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (14.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

starweaver-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl (14.6 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

starweaver-0.9.0-cp311-cp311-win_amd64.whl (14.5 MB view details)

Uploaded CPython 3.11Windows x86-64

starweaver-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

starweaver-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (14.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

starweaver-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl (14.6 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file starweaver-0.9.0.tar.gz.

File metadata

  • Download URL: starweaver-0.9.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0.tar.gz
Algorithm Hash digest
SHA256 5e08b690a97752d4582f47e39f25952867f2b0368de8a055dd5af69647d11e09
MD5 e419623f7d4c39d159cc3c507776daec
BLAKE2b-256 b157089913f098de7681909b67b148580705599c7d4871b2e9880731f070c8cb

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 14.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 586b67a2f74fd09d34aabcc0c9656067d100e8c90dfbc8a4c0f92e470209d285
MD5 e93798793189bfa406510a51ff5da754
BLAKE2b-256 f9ab9dc9940cebba877717dee5df03ff3a5ac8201bbaa9b84b94c709e316e593

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 15.4 MB
  • Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8372e91decf6402fd4ee5bb33272ed19ccec1b4c264dcaac2476daa548b1aab7
MD5 a76ece918829740c52cb5a8d36826325
BLAKE2b-256 4d3ae8ac3ee21b1dc6462d2af9f2c95b775ccfdaa1dde9d804fe7bc376dc8c2a

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 14.1 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e617eec71ba9452aecdad02e25f69ec0f47e2a5457c3b6974f71ca6bbf1087e5
MD5 76618a9770e08cba7f9bb8ab3f5c72d5
BLAKE2b-256 9a88beb28dee470fac7509e96030dfbe7f1afb7cac9ac0852d4f3930e7995e34

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 14.6 MB
  • Tags: CPython 3.13, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 35422cf1456655e5947db0eb0b6da9667f87955abfa6aa7f6b279ee740ef0ef7
MD5 c15a19d35ed30cafe5d06e6afd37f4a7
BLAKE2b-256 9666e1dc2a4b21af3620b68e0345bbb2556069b39658ce5e8af799d370b04d60

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 14.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f9be8ef544b29436a7c36c8185fc07e9bde62eec60d9faad08e82d2dd8cb82ad
MD5 0ae748049009fd891606446f487b48d6
BLAKE2b-256 a20e186cc8fb6d3617f601770580d520434c2fac4fb210fe3e939d41aa9f4238

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 15.4 MB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4dcda36e105dc01c59fa94e320d7ac0ff43fffd656b729b4291b584e167985c
MD5 445da36fed985df2f6b1a6ca1691735c
BLAKE2b-256 6f694a0d42ecef7e8fa8903b9143d7c451cced5f2fe1c2f2369800789bdcd978

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 14.1 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6890ed2af4f342eb88b3c59e24ac320dcd01433247887892359e4759875a95f0
MD5 5e97d843dab1d8262ea48a29ead8ded0
BLAKE2b-256 a2405fb98b8982d43928edcdc90ccaaddf94c52e64f027f10ffa89958d88a8c4

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 14.6 MB
  • Tags: CPython 3.12, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2734079ef6b0e7246b74aaf4984796ca685e4cca746e6f32e454ce7c28ef66b0
MD5 9eda8be895f86fcd0b6525dccaa87199
BLAKE2b-256 d962ac042776aecc394abae26ab4be6da8a19821fcf050ca78338e78e1978b8e

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 14.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c1df823c1e351756c0ec26bd556164860f00aeea965b1bee91339aa8e3f1276b
MD5 e849ed2f92486de0575484f7434b06c9
BLAKE2b-256 0b2c0e067f07a847be472a78c0c3ec42df4eb3bc2fc0ad4e9c48fd67140836a5

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 15.4 MB
  • Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc8b44558fc255ae6ee9d82b355804c0245ce86a0c8ecdcccfed3500fe27a7e8
MD5 f2c04fa93b6036b45af58b2812fed1b0
BLAKE2b-256 da7c435da8d81e2e172975111e54df34b1b0bb5949c7c84c90fa3d4f44141d5a

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 14.1 MB
  • Tags: CPython 3.11, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eaea6e2d5eb713bfaf4af72ae0a49b28a2b16dcc65e38de3fff3ef4ac0318880
MD5 322f8c4a063e33a46dd090d662c8c561
BLAKE2b-256 70dbe74f1a3e7904278890c17a95291bc82e053a309eca7946a2856bd4a6d456

See more details on using hashes here.

File details

Details for the file starweaver-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: starweaver-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 14.6 MB
  • Tags: CPython 3.11, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starweaver-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f66d239aee1ab7b8002665cf313e52fad3fc21f3721e10381f19e64d8bd508dd
MD5 3bdc49bb0f653d1513050024e7e758b5
BLAKE2b-256 e11205c5178ced125b0401367ba1df4eed828abaa0c8ae07a9921bdf2a76a649

See more details on using hashes here.

Release history Release notifications | RSS feed

0.15.0

13 files

0.14.0

13 files

0.13.0

13 files

0.12.0

13 files

0.11.0

13 files

0.10.0

13 files

This release

0.9.0 This release

13 files

0.8.1

13 files

0.8.0

13 files

0.7.0

13 files

0.6.0

13 files

0.5.1

13 files

0.5.0

13 files

0.4.1

13 files

0.4.0

13 files

0.3.0

13 files

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