Official Python SDK for the Plumr API.
Project description
plumr
Official Python SDK for the Plumr API.
pip install plumr
# or
uv add plumr
poetry add plumr
Requires Python 3.9+. One runtime dep: httpx.
Usage
Streaming
from plumr import Plumr
client = Plumr(api_key="plm_live_...")
for event in client.run(input="Write a haiku about Mars."):
if event.type == "llm.delta":
print(event.text, end="", flush=True)
elif event.type == "step.end":
print(f"\n✓ {event.nodeId} ({event.durationMs}ms)")
One-shot
result = client.run_once(input="Write a haiku about Mars.")
print(result.output)
Override plum settings per call
If your plum has API-bound fields (e.g. the orchestrator's model is
bound to params.model), swap them at call time:
result = client.run_once(
input="Hello",
params={"model": "claude-opus-4-7"},
)
Async
import asyncio
from plumr import AsyncPlumr
async def main():
async with AsyncPlumr(api_key="plm_live_...") as client:
async for event in client.run(input="hello"):
if event.type == "llm.delta":
print(event.text, end="", flush=True)
asyncio.run(main())
Configuration
Plumr(
api_key="plm_live_...",
base_url="https://app.plumr.studio", # optional — for self-hosted
timeout=300.0, # seconds; long for streaming
)
Event reference
run() yields strongly-typed dataclasses — use event.type for
exhaustive matches:
event.type |
Class | Fields |
|---|---|---|
run.start |
RunStartEvent |
startedAt |
step.start |
StepStartEvent |
nodeId, nodeType, label, input |
step.end |
StepEndEvent |
nodeId, output, durationMs, error |
llm.start |
LlmStartEvent |
nodeId, provider, model |
llm.delta |
LlmDeltaEvent |
nodeId, text |
llm.end |
LlmEndEvent |
nodeId, promptTokens, completionTokens |
tool.call |
ToolCallEvent |
nodeId, label, note? |
run.end |
RunEndEvent |
runId, status, output, error, durationMs |
Errors
from plumr import PlumrError
try:
client.run_once(input="…")
except PlumrError as e:
print(e.status, e.body)
Examples
examples/basic.py— minimal streaming scriptexamples/fastapi/— FastAPI proxy that re-streams Plumr events to a browser (coming soon)
Develop
pip install -e ".[dev]"
pytest
ruff check
mypy plumr
License
MIT
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 plumr-0.1.0.tar.gz.
File metadata
- Download URL: plumr-0.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a4168d5d432764812e68ab2e6598ca3faf6e635f0c48f7cba505047579ebf34
|
|
| MD5 |
ca4d5b519b49f328283c3cec99df6c7d
|
|
| BLAKE2b-256 |
b780b32898ed133ff1316b163de95cd216eee3919ef4f3da1c43528285c4523b
|
Provenance
The following attestation bundles were made for plumr-0.1.0.tar.gz:
Publisher:
python-publish.yml on Plumr-org/sdks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plumr-0.1.0.tar.gz -
Subject digest:
8a4168d5d432764812e68ab2e6598ca3faf6e635f0c48f7cba505047579ebf34 - Sigstore transparency entry: 1416809938
- Sigstore integration time:
-
Permalink:
Plumr-org/sdks@eb0f8fda8ec47c13c6adfccfe90a060c5df508c2 -
Branch / Tag:
refs/tags/python-v0.1.0 - Owner: https://github.com/Plumr-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@eb0f8fda8ec47c13c6adfccfe90a060c5df508c2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file plumr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: plumr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.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 |
9e8ac5097a57310d3b821491162ed75d589672a37e29b431cf4fae39ba708855
|
|
| MD5 |
ea65a7bf0cfb7285012479ea5e7e8fc4
|
|
| BLAKE2b-256 |
33cd88779310b79ad90939a168fcdd9de9ac75006219ab4db1e2f4495b832691
|
Provenance
The following attestation bundles were made for plumr-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on Plumr-org/sdks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plumr-0.1.0-py3-none-any.whl -
Subject digest:
9e8ac5097a57310d3b821491162ed75d589672a37e29b431cf4fae39ba708855 - Sigstore transparency entry: 1416809969
- Sigstore integration time:
-
Permalink:
Plumr-org/sdks@eb0f8fda8ec47c13c6adfccfe90a060c5df508c2 -
Branch / Tag:
refs/tags/python-v0.1.0 - Owner: https://github.com/Plumr-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@eb0f8fda8ec47c13c6adfccfe90a060c5df508c2 -
Trigger Event:
push
-
Statement type: