Skip to main content

Yomai

Streaming-first Python framework for serving LLM agents over HTTP.

from yomai import Yomai, tool
from yomai.config import LLMConfig

app = Yomai(llm=LLMConfig(provider="anthropic"))

@tool
async def get_weather(city: str) -> str:
    """Get current weather for a city."""
    return f"72°F and sunny in {city}"

@app.agent("/chat", tools=[get_weather])
async def chat(message: str, session_id: str, tone: str = "plain") -> None:
    # Runs before the LLM loop; extra JSON body fields are passed by name.
    pass

Run:

yomai run

Open the playground at http://localhost:8000/__yomai__.

Production notes

  • Set YOMAI_ENV=production to disable the playground.
  • Set YOMAI_API_KEY to protect agent/workflow routes and production metadata endpoints.
  • Routes can override auth with @app.agent(..., api_key="...") or @app.workflow(..., api_key="...").
  • Session IDs are bearer identifiers; use SignedSessionMiddleware or your own auth for public apps.

Real HTTP/SSE smoke test

# Reads standard provider env vars.
./scripts/http_sse_smoke.sh

Expected SSE events include tool_start, tool_end, chunk, usage, and done.

V2 preview: production runtime

Yomai V2 work adds durable async workflow infrastructure while keeping V1 routes compatible.

from yomai import Yomai
from yomai.config import LLMConfig, MemoryConfig, QueueConfig, RateLimitConfig

app = Yomai(
    llm=LLMConfig(provider="anthropic"),
    memory=MemoryConfig(backend="redis", url="redis://localhost:6379/0"),
    queue=QueueConfig(backend="swiftq", url="redis://localhost:6379/0"),
    rate_limits=RateLimitConfig(requests_per_minute=60, max_concurrent_per_session=3),
)

@app.workflow("/research", mode="async")
async def research(topic: str, runner):
    return {"topic": topic}

Async workflow requests return 202 Accepted with job_id, status_url, and stream_url. Job streams are reconnectable via Last-Event-ID.

Useful endpoints:

  • GET /__yomai__/jobs/{job_id}
  • GET /__yomai__/jobs/{job_id}/stream
  • POST /__yomai__/jobs/{job_id}/cancel
  • GET /__yomai__/metrics

Run a worker for swiftQ-backed workflows:

yomai worker main:app --concurrency 4

Hooks:

@app.on("job.succeeded")
async def on_job_done(event):
    print(event.payload)

Manual Redis/swiftQ smoke script:

uv run python scripts/swiftq_redis_smoke.py worker
uv run python scripts/swiftq_redis_smoke.py web

Testing

from yomai.testing import YomaiTestClient, mock_llm

with mock_llm(["Hello"]):
    client = YomaiTestClient(app)
    text = await client.call("/chat", "Say hello", extra_body={"tone": "friendly"})

Metadata

Release files for yomai 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yomai 0.3.0
File Size Uploaded Provenance
yomai-0.3.0.tar.gz 526.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yomai 0.3.0
File Interpreter ABI Platform
yomai-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 724.0 kB

Release files / yomai-0.3.0.tar.gz

Download URL yomai-0.3.0.tar.gz
Size 526.8 kB
Tags Source
SHA-256 checksum
How to use checksums
45a1d26defcfbe04694e19bd27cbf7ce09d8d13857422763d30b90b26e057bc9
BLAKE2b-256 checksum
How to use checksums
c4cf8690f88c88490aad9932bec71b54849dcb9d543dbf45a9cb37aee60edcdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 14, 2026.

Transparency log

Release files / yomai-0.3.0-py3-none-any.whl

Download URL yomai-0.3.0-py3-none-any.whl
Size 197.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4be85666df8d392c68ead7aabd100504db8181d423ce215b7bd1d48b572d6eb
BLAKE2b-256 checksum
How to use checksums
79e2bf2ca6c0cdb3a1977392288dc1f49866a5cba5a593177e2687cfc44f2c64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 14, 2026.

Transparency log

Security for yomai 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yomai-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page