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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

promptrails-0.9.1.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptrails-0.9.1-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file promptrails-0.9.1.tar.gz.

File metadata

  • Download URL: promptrails-0.9.1.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for promptrails-0.9.1.tar.gz
Algorithm Hash digest
SHA256 d6b73999f78e57f5e3046c9712de8798f27924fae986713e1242f7dc2b2f8365
MD5 5d7a1059e73e4e1dbc9540bfb940ce6b
BLAKE2b-256 0ea4606f7a50ba1ed2663efcb763ac9097593881bfb571d73536bfe887753480

See more details on using hashes here.

File details

Details for the file promptrails-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: promptrails-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 49.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for promptrails-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90a3b46609b69387313dcedce55d10441642c5b0e78ec490c8777caf97481be8
MD5 93be807f297249923c618472977bd699
BLAKE2b-256 b4134ebeb260f2d01976dd6e84e3bc411d212d170e3175217ebeec837ce83d94

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

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