Skip to main content

Courier OS SDK

The Courier OS SDK offers robust tools for building programmatic agents in Python using OpenAI-compatible APIs or for licensed builders running local agents on Apple Silicon using our proprietary and industry leading infrastructure.

Install: uv add courier-os or pip install courier-os
Import: import courier_os

Dual mode

Mode How Needs binary + license?
API Model("gpt-4o", api_key="…", base_url="…") No
Local Model("mlx-community/…", mode="local") Yes (courier-os[local])
from courier_os import Model, Agent, Operator, tools

@tools.tool
def get_weather(city: str) -> dict:
    """Get weather for a city."""
    return {"city": city, "temp_f": 72}

# Cloud / any OpenAI-compatible endpoint
model = Model("gpt-4o", api_key="…", base_url="https://api.openai.com/v1")

# Or local MLX (requires courier-os-binary on Apple Silicon)
# model = Model("mlx-community/Qwen3.5-2B-MLX-8bit", mode="local")
# if not model.can_load:
#     model = Model("gpt-4o", api_key="…", base_url="…")

agent = Agent(model, tools=[get_weather])
messages = [{"role": "user", "content": "Weather in Denver?"}]

# Agent — one model turn (you handle tool_calls if present)
resp = agent.chat(messages)
if resp.tool_calls:
    messages.append({"role": "assistant", "content": resp.content, "tool_calls": resp.tool_calls})
    messages.extend(agent.call_tools(resp.tool_calls))
    resp = agent.chat(messages)
print(resp.content)

# Operator — auto tool loop until the model finishes
out = Operator(agent).run([{"role": "user", "content": "Weather in Denver?"}])
print(out.content)

Register tools mid-loop

Pass a Session and tools=session.tools, then event.register_tool(...) from an intercept. New tools are available on the next Operator iteration:

from courier_os import Agent, Model, Operator, Session, tools

@tools.tool
def list_tools() -> list[dict]:
    """Discover available tools."""
    return [{
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get weather for a city.",
            "parameters": {
                "type": "object",
                "properties": {"city": {"type": "string"}},
                "required": ["city"],
            },
        },
    }]

@tools.tool
def get_weather(city: str) -> dict:
    """Get weather for a city."""
    return {"city": city, "temp_f": 72}

IMPLS = {"get_weather": get_weather}

def unlock(event):
    for tc in event.tool_calls:
        if tc.name == "list_tools":
            for spec in tc.result or []:
                name = spec["function"]["name"]
                if name in IMPLS:
                    event.register_tool(IMPLS[name])

session = Session.open(tools=[list_tools])
agent = Agent(Model("gpt-4o", api_key="…", base_url="…"), tools=session.tools)
out = Operator(agent, on_intercept=unlock).run(
    [{"role": "user", "content": "List tools, then weather in Denver."}],
    session=session,
    tools=session.tools,
)

HTTP relay

from courier_os import relay

out = relay(
    model="gpt-4o",
    messages=[{"role": "user", "content": "hi"}],
    api_key="…",
    base_url="https://api.openai.com/v1",
    tools=[get_weather],
).response

Multimodal messages

OpenAI-shaped image/audio content parts work on both paths (local omni models extract media before inference):

messages = [{
    "role": "user",
    "content": [
        {"type": "text", "text": "What is in this image?"},
        {"type": "image_url", "image_url": {"url": "data:image/png;base64,…"}},
    ],
}]
Operator(agent).run(messages)

Local runtime

Local inference lives in the proprietary courier-os-binary package (not on public PyPI yet). In this monorepo:

cd playground && uv sync

That editable-installs courier-oscourier-os-binary.

Docs

Download files

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

Source Distribution

courier_os-0.1.3.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

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

courier_os-0.1.3-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file courier_os-0.1.3.tar.gz.

File metadata

  • Download URL: courier_os-0.1.3.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for courier_os-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f128a202f1072f001be4a658768750c69df83584004cb13a0016883f369a3cbc
MD5 450ba48b39e27d0e650aaae52d28bbec
BLAKE2b-256 2e9ff8e9202a080ba273cf24e8a7d5f28e770d42a43ec90ae7ff1f38e0e44439

See more details on using hashes here.

File details

Details for the file courier_os-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: courier_os-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 49.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for courier_os-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 38c2b8e7b7ee52e9af39e8dcd9340028d5b2016bbe1ba85db1c70874fb47e6b0
MD5 9fb16f4e328c4e0bc5e5398083f0b320
BLAKE2b-256 6bada558572354e3f049e93f98f673ab7fafec7f2afc5d7d1b373a43c783fe31

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 Sentry Error logging StatusPage Status page