Skip to main content

PromptRails Python SDK

PyPI version Python versions License: MIT

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, agent versions, approvals, 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

Metadata

Release files for promptrails 0.9.1

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

Source distribution (sdist)

Source distribution for promptrails 0.9.1
File Size Uploaded Provenance
promptrails-0.9.1.tar.gz 43.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 92.6 kB

Release files / promptrails-0.9.1.tar.gz

Download URL promptrails-0.9.1.tar.gz
Size 43.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d6b73999f78e57f5e3046c9712de8798f27924fae986713e1242f7dc2b2f8365
BLAKE2b-256 checksum
How to use checksums
0ea4606f7a50ba1ed2663efcb763ac9097593881bfb571d73536bfe887753480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / promptrails-0.9.1-py3-none-any.whl

Download URL promptrails-0.9.1-py3-none-any.whl
Size 49.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90a3b46609b69387313dcedce55d10441642c5b0e78ec490c8777caf97481be8
BLAKE2b-256 checksum
How to use checksums
b4134ebeb260f2d01976dd6e84e3bc411d212d170e3175217ebeec837ce83d94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for promptrails 0.9.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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