Python SDK
Courier SDK
Develop robust and reliable programmatic agents with our simple-to-use agent SDK that manages agent loops.
Write once. Run either place.
You should not rewrite an agent because the model moved from a token API to a Mac on your desk. Courier SDK is the same Model, Agent, and Operator — two runtimes.
from courier_os import Model, Agent, Operator
Same Python. Two runtimes.
API mode
Point at Courier Cloud, OpenAI, or any OpenAI-compatible base URL. No binary, no license — an API key.
pip install courier-os
Local mode
Load an MLX model on Apple Silicon you own. Same agent code. Unlimited usage, air-gapped.
Contact for License
What ships in the package
Python agents you can actually ship: tools, a tool loop, a session that can grow mid-run, and a one-shot relay.
Model, Agent, Operator
Agent is one model turn — you handle tool_calls. Operator runs the loop until the model finishes.
@tools.tool
Typed tools you own. Decorate a function; the SDK ships the OpenAI tool schema.
Session + mid-loop register
Pass a Session and tools=session.tools, then event.register_tool from an intercept. New tools hit the next Operator iteration.
relay()
One-shot HTTP path: model, messages, tools, api_key, base_url. Same surface as Agent without the object graph.
Multimodal
OpenAI-shaped image and audio content parts on both paths. Local omni models extract media before inference.
courier-os[local]
Optional courier-os-binary on Apple Silicon. Same Model, Agent, and Operator — air-gapped MLX.
# pip install courier-os # or contact for local inference license # Apple Silicon from courier_os import Model, Agent, Operator, tools @tools.tool def get_weather(city: str) -> dict: return {"city": city, "temp_f": 72} model = Model("gpt-4o", api_key="…", base_url="https://api.openai.com/v1") # model = Model("mlx-community/…", mode="local") agent = Agent(model, tools=[get_weather]) out = Operator(agent).run([{"role": "user", "content": "Weather in Denver?"}]) print(out.content)
Full README, dual-mode table, Session intercepts, and multimodal examples on PyPI.