Official Python SDK for the PromptRails API
Project description
PromptRails Python SDK
Official Python SDK for PromptRails — the AI agent orchestration platform.
The SDK has two independent parts:
- API client — manage agents, prompts, executions, and more.
- Tracing (
promptrails.tracing) — send spans to PromptRails from any code, without managing your prompts/agents on the platform.
Installation
pip install promptrails
Quick Start
API client
from promptrails import PromptRails
client = PromptRails(api_key="pr_key_...")
result = client.agents.execute("agent-id", input={"query": "Summarise this week's sales"})
print(result.output)
client.close()
Async (AsyncPromptRails) and context-manager usage are also supported — see the
API client guide.
Tracing
from promptrails.tracing import Tracer
tracer = Tracer(api_key="pr_...")
with tracer.span("agent-run", kind="agent") as root:
root.set_input({"q": "weather?"})
with tracer.span("llm-call", kind="llm") as llm:
llm.set_model("gpt-4o").set_usage(prompt_tokens=120, completion_tokens=30)
tracer.flush()
See the tracing guide for decorators, manual spans, span kinds, and configuration. LangChain, OpenAI, and OpenTelemetry can be auto-instrumented — see integrations.
Documentation
- API client — resources, error handling, media studio, configuration
- Tracing — spans, decorators, batching, configuration
- Integrations — LangChain, OpenAI, OpenTelemetry
Contributing
pip install -e ".[dev]" # install dev dependencies
ruff check . # lint
ruff format . # format
pytest tests/ -v # test
License
MIT
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
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 promptrails-0.6.0.tar.gz.
File metadata
- Download URL: promptrails-0.6.0.tar.gz
- Upload date:
- Size: 39.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef8acdb62c117d3c21040a84a2acb747252f8f59fd64457aadf8b0068741907f
|
|
| MD5 |
64f97c749c701be17864230b036828c1
|
|
| BLAKE2b-256 |
3ebfc0ad52f9cf57ad267628fa1f07504257a2d20bbd0fa62c79c9eca87c0ad9
|
File details
Details for the file promptrails-0.6.0-py3-none-any.whl.
File metadata
- Download URL: promptrails-0.6.0-py3-none-any.whl
- Upload date:
- Size: 51.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e18f9bc765668480f98fcec0c6d3089055ec0263970e3178b4cda6077d8c681b
|
|
| MD5 |
1f1a375a53a8b5e4fc33038836cef748
|
|
| BLAKE2b-256 |
006e3c5d1fdc525616426cd75c23ebae2570b4f7b5c9a825ec759edece800eac
|