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]"

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 two OpenAI-compatible providers:

  • OpenAIChatCompletionsProvider
  • OpenAIResponsesProvider

For most third-party OpenAI-compatible gateways, start with OpenAIChatCompletionsProvider. It is usually the more portable option.

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.0b1
  4. Push the tag
git tag v0.2.0b1
git push origin v0.2.0b1

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.0b1.tar.gz (33.7 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.0b1-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file runlet-0.2.0b1.tar.gz.

File metadata

  • Download URL: runlet-0.2.0b1.tar.gz
  • Upload date:
  • Size: 33.7 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.0b1.tar.gz
Algorithm Hash digest
SHA256 86c36e4344088a615397b466a1c0d0203e14b32f1f9a800e651f16c7f9e2d561
MD5 4e48f720ee38d981e69d105c2720fc7c
BLAKE2b-256 1a285c757dcb19ed2aa2dcb7ff17f55157e7fb5b97279eba946575c0204f643d

See more details on using hashes here.

Provenance

The following attestation bundles were made for runlet-0.2.0b1.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.0b1-py3-none-any.whl.

File metadata

  • Download URL: runlet-0.2.0b1-py3-none-any.whl
  • Upload date:
  • Size: 22.1 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.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b0e4b1151c2f5138082345c7bc8330eca61ad7c2dc63a8b67a4689455be77a8
MD5 16045dfe323ccdc8449e752450db44a2
BLAKE2b-256 85604494562590de0cd54de3d4f2e591f38d5cb5fee0a0a6697d0a4d182c617c

See more details on using hashes here.

Provenance

The following attestation bundles were made for runlet-0.2.0b1-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