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.0.tar.gz (43.0 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.0-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: promptrails-0.9.0.tar.gz
  • Upload date:
  • Size: 43.0 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.0.tar.gz
Algorithm Hash digest
SHA256 6895404e5525190f72eded006193cf8d371d71a1574e4bd87ab1a9b7054c3c86
MD5 8df9233aed4fb2a0f46f8bf0e508f7f1
BLAKE2b-256 76eeabf22f66cff006538cbc00a44d5d42e099f41beae8424cce57e38fe818f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: promptrails-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 49.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8888b28eaa59ad122f8fcd5bb1b047f8ee5f9f4302c27d9b5d7bbeb2baa707c
MD5 0ea225a775b8b2a02481a15bd0b74a0f
BLAKE2b-256 0db72b1060bb74f51b0a83b3cfa7a8625bf73bfde6d7635e1f2c3574f8c66a71

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.1

2 files

This release

0.9.0 This release

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