Skip to main content

A tiny observable runtime for Python agents.

Project description

Runlet

PyPI version Python versions CI Docs

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:

Guides:

Concepts:

Project background:

Providers

Runlet currently includes three built-in providers:

  • OpenAIChatCompletionsProvider
  • OpenAIResponsesProvider
  • AnthropicMessagesProvider

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:

  1. Update the version in pyproject.toml
  2. Merge to main
  3. Create a tag such as v0.2.0b2
  4. Push the tag
git tag v0.2.0b2
git push origin v0.2.0b2

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

runlet-0.2.0b2.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

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

runlet-0.2.0b2-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

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

Hashes for runlet-0.2.0b2.tar.gz
Algorithm Hash digest
SHA256 4659d966b3b53133eace8699cac77b943498140ca6e93b25d99b8360cc70b963
MD5 cec59924c34077debddc8caf35637272
BLAKE2b-256 a04e338c07f51960ebc22c5e35a454ef18a8f26328bad032104bb20b6571fdd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for runlet-0.2.0b2.tar.gz:

Publisher: publish.yml on DMIAOCHEN/runlet

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

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

Hashes for runlet-0.2.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 d7746a3d8fa603e2a5c8bc91dbc9fa065843a509459e985577036b3e6381addd
MD5 d0479e8cf900151c8477f3c54ad1a3e5
BLAKE2b-256 3540143122ea9036e88005b8fbc10d46cd9e2c3f81fcd6f619e16a670d49ca6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for runlet-0.2.0b2-py3-none-any.whl:

Publisher: publish.yml on DMIAOCHEN/runlet

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