Skip to main content

Orion Python SDK

Python 3.10+ SDK backed by an in-process abi3 PyO3 module. The supported API is intentionally small: Agent, provider models such as OpenAI, typed results, lifecycle events, and SDK errors.

import asyncio
from dataclasses import dataclass

from orion_sdk import Agent, OpenAI


@dataclass(frozen=True, slots=True)
class WeatherResult:
    city: str
    temperature_c: int


@dataclass(frozen=True, slots=True)
class WeatherAnswer:
    city: str
    temperature_c: int
    summary: str


async def get_weather(city: str) -> WeatherResult:
    """Get the current weather for a city."""
    return WeatherResult(city, 31)


async def main() -> None:
    agent = Agent(
        model=OpenAI("gpt-5-mini"),
        tools=[get_weather],
        output=WeatherAnswer,
        instructions="Use the weather tool.",
    )

    result = await agent.run("What is the weather in Delhi?")
    print(result.output.summary)


if __name__ == "__main__":
    asyncio.run(main())

Function annotations and docstrings define the tool contract. The SDK derives schemas internally; Rust validates tool arguments and terminal structured output; result.output is already the configured Python type.

Use agent.stream(...) for ordered lifecycle events followed by one typed AgentResult. Registry, runner, codec, raw-schema, adapter, model-reference, protocol, and native-session APIs are internal and unsupported for application use.

OrionError exposes the stable Rust error category and retry metadata without requiring access to runtime internals:

from orion_sdk import Agent, ErrorCode, OrionError


async def run_weather(agent: Agent[WeatherAnswer]) -> None:
    try:
        result = await agent.run("What is the weather in Delhi?")
        print(result.output.summary)
    except OrionError as error:
        if error.code is ErrorCode.RATE_LIMITED and error.retryable:
            print(f"retry after {error.retry_after_ms} ms")
        raise

Cancelling the calling task still raises asyncio.CancelledError; Orion does not replace structured task cancellation with a generic SDK error.

See the complete weather application.

Install for local development

python3.10 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip maturin
cd sdks/python
maturin develop --release
cd ../..
python -m examples.python.weather_agent.main

The example calls an OpenAI-compatible endpoint and requires OPENAI_API_KEY. To build a distributable wheel without installing it, run:

cd sdks/python
uvx maturin build --release --locked

Download files

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

Source Distribution

orion_agent_sdk-0.0.1.tar.gz (42.9 kB view details)

Uploaded Source

Built Distributions

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

orion_agent_sdk-0.0.1-cp310-abi3-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

orion_agent_sdk-0.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

orion_agent_sdk-0.0.1-cp310-abi3-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file orion_agent_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: orion_agent_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 42.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for orion_agent_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3cb18899adeb4a58bd3c7aa9ccffb3c0a58c84ae207ecf6b260667ff03e0f255
MD5 7d0342ac59e2c52030a578b2eab0a23e
BLAKE2b-256 5b3830c398caf440b62fb0a6e848e2f88d174eb3d02c866d7cb8d48505d15fa1

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_agent_sdk-0.0.1.tar.gz:

Publisher: release.yml on GtechGovind/orion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orion_agent_sdk-0.0.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for orion_agent_sdk-0.0.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fd1bc0605a68a3822562b24fcb5e532c8ed61e361c188cab7135b638ee212b89
MD5 591c517592c11b96403751c309b8a654
BLAKE2b-256 95b8696f497778548cd1f52ee1ece2420d749754751b4e47fb0b94d4007a921c

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_agent_sdk-0.0.1-cp310-abi3-win_amd64.whl:

Publisher: release.yml on GtechGovind/orion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orion_agent_sdk-0.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for orion_agent_sdk-0.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 985ce895e6a3f954c3ad5375abbdb9bc664e21abb003095ef0d99996fad741bf
MD5 9cb68eca5d58d1ac57464763f42603f2
BLAKE2b-256 9dab65603de301b498e5c8e29a064811ca02cc0286adf837b4874279d4db55f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_agent_sdk-0.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on GtechGovind/orion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orion_agent_sdk-0.0.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for orion_agent_sdk-0.0.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edbbfb0ff2484b1bd7f28b648fb0d5e3e3d6d3178fe0bfec24d0adcc5066ed20
MD5 6ec7037e6af0922fa68259c041411dd0
BLAKE2b-256 edd2a23ba14976315cf64ac9b71fc31265a300c8774ab375e5b63bf55aab1236

See more details on using hashes here.

Provenance

The following attestation bundles were made for orion_agent_sdk-0.0.1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on GtechGovind/orion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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