A tiny observable runtime for Python agents.
Project description
Runlet
Runlet is a small, provider-neutral Python agent runtime library.
It is designed for applications that want explicit control over model calls, tool execution, context budgeting, and structured observability without adopting a large framework.
When to use Runlet
Runlet is a good fit when you want to:
- embed agent execution inside an existing Python application
- keep model providers behind adapters
- enforce context preparation before model calls
- stream model output while still executing tools inside the runtime loop
- observe runs through structured events
- build your own application-level conversation, memory, or state policies
When not to use Runlet
Runlet is not trying to be:
- a hosted agent platform
- a web framework
- a graph workflow engine
- a UI or trace viewer
- a full memory framework
If you want a batteries-included platform with orchestration, persistence, and application scaffolding built in, Runlet is intentionally narrower than that.
Quickstart
Install Runlet:
pip install runlet
Install the OpenAI optional dependency:
pip install "runlet[openai]"
Install the Anthropic optional dependency:
pip install "runlet[anthropic]"
If you prefer .env based local development:
pip install python-dotenv
Example .env:
OPENAI_API_KEY=your-api-key
OPENAI_BASE_URL=https://your-endpoint.example/v1
OPENAI_MODEL=qwen-plus
Minimal example:
import asyncio
import os
from dotenv import load_dotenv
from runlet import Agent, Runtime
from runlet.providers import OpenAIChatCompletionsProvider
async def main() -> None:
load_dotenv()
provider = OpenAIChatCompletionsProvider(
model=os.environ.get("OPENAI_MODEL", "gpt-4o-mini"),
api_key=os.environ["OPENAI_API_KEY"],
base_url=os.environ.get("OPENAI_BASE_URL"),
)
agent = Agent(
name="assistant",
instructions="Be concise and helpful.",
model=provider,
)
result = await Runtime().run(agent, "用一句中文介绍 Runlet。")
print(result.output)
asyncio.run(main())
Core capabilities
- provider-neutral runtime loop
- async model execution
- streaming text output
- runtime-managed streaming tool execution
- request-level provider options
- structured runtime events
- hook points around model and tool execution
- lightweight state store primitives
Documentation
Start here:
- Installation
- First Agent
- OpenAI Chat Completions
- Anthropic Messages
- OpenAI Responses
- Streaming
- Tool Calling
- Full Example
Guides:
Concepts:
Project background:
Providers
Runlet currently includes three built-in providers:
OpenAIChatCompletionsProviderOpenAIResponsesProviderAnthropicMessagesProvider
For most third-party OpenAI-compatible gateways, start with
OpenAIChatCompletionsProvider. It is usually the more portable option.
For Anthropic's official API, use AnthropicMessagesProvider.
Project status
Runlet is currently in beta. The API may still evolve before a stable 0.x release.
Development
Run the test suite:
PYTHONPATH=src python3 -m unittest discover tests
Run type checking:
pyright
Release
Runlet publishes to PyPI from Git tags through GitHub Actions.
Typical release flow:
- Update the version in
pyproject.toml - Merge to
main - Create a tag such as
v0.2.0b2 - Push the tag
git tag v0.2.0b2
git push origin v0.2.0b2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runlet-0.2.0b2.tar.gz.
File metadata
- Download URL: runlet-0.2.0b2.tar.gz
- Upload date:
- Size: 37.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4659d966b3b53133eace8699cac77b943498140ca6e93b25d99b8360cc70b963
|
|
| MD5 |
cec59924c34077debddc8caf35637272
|
|
| BLAKE2b-256 |
a04e338c07f51960ebc22c5e35a454ef18a8f26328bad032104bb20b6571fdd1
|
Provenance
The following attestation bundles were made for runlet-0.2.0b2.tar.gz:
Publisher:
publish.yml on DMIAOCHEN/runlet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
runlet-0.2.0b2.tar.gz -
Subject digest:
4659d966b3b53133eace8699cac77b943498140ca6e93b25d99b8360cc70b963 - Sigstore transparency entry: 1982673733
- Sigstore integration time:
-
Permalink:
DMIAOCHEN/runlet@c0b9628a517e9d8cac104282921b20c3cea712a6 -
Branch / Tag:
refs/tags/v0.2.0b2 - Owner: https://github.com/DMIAOCHEN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c0b9628a517e9d8cac104282921b20c3cea712a6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file runlet-0.2.0b2-py3-none-any.whl.
File metadata
- Download URL: runlet-0.2.0b2-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7746a3d8fa603e2a5c8bc91dbc9fa065843a509459e985577036b3e6381addd
|
|
| MD5 |
d0479e8cf900151c8477f3c54ad1a3e5
|
|
| BLAKE2b-256 |
3540143122ea9036e88005b8fbc10d46cd9e2c3f81fcd6f619e16a670d49ca6d
|
Provenance
The following attestation bundles were made for runlet-0.2.0b2-py3-none-any.whl:
Publisher:
publish.yml on DMIAOCHEN/runlet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
runlet-0.2.0b2-py3-none-any.whl -
Subject digest:
d7746a3d8fa603e2a5c8bc91dbc9fa065843a509459e985577036b3e6381addd - Sigstore transparency entry: 1982673869
- Sigstore integration time:
-
Permalink:
DMIAOCHEN/runlet@c0b9628a517e9d8cac104282921b20c3cea712a6 -
Branch / Tag:
refs/tags/v0.2.0b2 - Owner: https://github.com/DMIAOCHEN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c0b9628a517e9d8cac104282921b20c3cea712a6 -
Trigger Event:
push
-
Statement type: