Skip to main content

Python bindings for Starweaver

Project description

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

Project details


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.4.1.tar.gz (978.5 kB view details)

Uploaded Source

Built Distributions

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

starweaver-0.4.1-cp313-cp313-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.13Windows x86-64

starweaver-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

starweaver-0.4.1-cp313-cp313-macosx_11_0_arm64.whl (12.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

starweaver-0.4.1-cp313-cp313-macosx_10_12_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

starweaver-0.4.1-cp312-cp312-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.12Windows x86-64

starweaver-0.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

starweaver-0.4.1-cp312-cp312-macosx_11_0_arm64.whl (12.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

starweaver-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

starweaver-0.4.1-cp311-cp311-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.11Windows x86-64

starweaver-0.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

starweaver-0.4.1-cp311-cp311-macosx_11_0_arm64.whl (12.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

starweaver-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: starweaver-0.4.1.tar.gz
  • Upload date:
  • Size: 978.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1.tar.gz
Algorithm Hash digest
SHA256 73d1575bf5dbc04c82a12fed7a1afb4478a3d42596197ff75bdb732aa73466c2
MD5 1d8bc868e7ea50180bffbfe767e541da
BLAKE2b-256 f4a780b8a902e7d9eeb2b264e15d9bf95a491b10c5760cdeee506cdaafbde2d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cefb037f0ca0627acd27411324f4b56451c0103c69cb93037ed0450290a26500
MD5 925e7b8ecc96fc089c046c7409a83c0f
BLAKE2b-256 a192e836d14bd669abc92fa1100b986ca9208639a435048e2a6fab564199c60b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 13.7 MB
  • Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15b492e80824a9a4083762adcce2cc28163505540c93fb4f46767fb9e3dcb2fd
MD5 a7d5768a822a5428c427f72e82de682a
BLAKE2b-256 a1057a70b571561ac85c1fbd5352ac91d3f6825d169e5798ea4afff4eb4cffca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e251b9d83b9766998a01f39b4a3b849a863acfbc3dcc040293bdf51078c5ab9
MD5 946978e390b79f7ffd598fed0efffd58
BLAKE2b-256 dea80d0965c176be7e874d4d6f0c5b8bae46bd0c6e15ac99822f6057e21e9a2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp313-cp313-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 13.0 MB
  • Tags: CPython 3.13, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2ed32eb85bbd506a60efd2cbfee55fb73c0db638251a061a08d33d46c17813fc
MD5 3d12c09091079712618ca3256e65d2c4
BLAKE2b-256 32f8d9b295d4d4be86ab6fe77eade0384eb2599074fdf74608afc7c78ba1dca5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3ff0fa861a4e36d1465fee10a55ac77c8e7fdd63374163c27437d0bd78345e5c
MD5 65a04ec05c495e4220ff12cb0bf5ce2e
BLAKE2b-256 36475c799a2e3e840f90280bd2e58b3c1f638484a8d7bdae3016b5c6da8f2557

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 13.7 MB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e771d39c5a89894861941d9fcfc2bd22f3dbea4a458a807e1a69ae58f628ecf5
MD5 dcb29d8075ff78431973646cbdee6913
BLAKE2b-256 3c9f3eb1bf5119e6c28ed21e0634d32dd7d36f04591a64ae25a8381bfc903a52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5074dcd9e2cfca7b114dd199d8e944a23c9689629120cd14647b8b7d326a4073
MD5 20fd17a62d40a0587a681a9a59697685
BLAKE2b-256 c9e2bdb2557bcfbcec3fd7ff57474435e2cf4633a9b792b7224735ba9233ae2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 13.0 MB
  • Tags: CPython 3.12, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bd687c70f98832a870dfd952a348bfaa0efad9c19239a32625022ba229c2659a
MD5 a85418c440f4e4a6ee01c00059fba082
BLAKE2b-256 b2e1f3868c4e9e10a9c242c1e9080f0f30d86822e106c6016a0e88a161a8febe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a524b331eeeaf5c39d8f3ff8ab5dd645be482f56aee12a5f3b9254631c2c5d33
MD5 cc58b7c61f0de932ba75e900685d5a5a
BLAKE2b-256 baf32e77e262354b6b3c656893bdfca5f070b235f1ec907865de177e92f6ebe2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 13.7 MB
  • Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cb1e6c294cf3457f8526ae491d1e5043c81637f70ba698542740c1295777fb6e
MD5 257abf76277f70ecfa75f42a88ed4fef
BLAKE2b-256 c936a1a287f16ba58023dd5203898b7d1f2ce7195981355f65b085843dc0a336

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.11, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5b88a0e71dd9d2b75fb4b2f3358cb034af0605715c86a4896cf8e795e83eda1
MD5 061ae5cbc28d05fbb39b368e9d54808c
BLAKE2b-256 9ac6d208327dfb73b76d197691f4473881a8217916358fc45a41e64cb4493e7d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starweaver-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 13.0 MB
  • Tags: CPython 3.11, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","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.4.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 08fedbb294785d7e89b1e91c6c2ac4cfca6e8f1dc087f24a0a8da5320f61d3df
MD5 ddeacfd356d9a10bde955c2b52c4f103
BLAKE2b-256 fdf5e585f6ac36c896c35ac8fb92aa58d5619a5e0e7359b028ad8c1f3d26a106

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page