Code examples for the PromptRails SDKs — Python, JavaScript/TypeScript, and Go.
API v2 — these examples target the v2 SDKs (Python
0.9.0, JavaScript0.9.0, Go0.7.0). Agents are nowagentorworkflowonly; model/sampling live on the agent version; thecosts,scores,media,templates,sessionsanddashboardresources were removed (usetraces.get_summaryfor cost/usage).
⚠️ Unreleased dependency pins: the examples reference the published package specs (promptrails>=0.9.0,@promptrails/sdk@^0.9.0, and afeat/api-v2pseudo-version of the go-sdk). Those v2 SDKs are not on PyPI/npm yet, so until they publish you must resolve them from the local sibling checkouts to run the examples (uv--with-editable,npm link,go get @feat/api-v2) — see each per-language README. Nothing in the manifests points at a local path; the pins/lockfiles reconcile automatically once the SDKs publish and the Go pseudo-version is repinned to its tag.
- A PromptRails account and API key
- Set your API key as an environment variable:
export PROMPTRAILS_API_KEY="pr_key_..."| Example | Python | JavaScript | Go |
|---|---|---|---|
| Basic — Client setup and configuration | View | View | View |
Agents — Create, execute, and manage agent / workflow agents |
View | View | View |
| Prompts — Content-only prompt templates & versioning | View | View | View |
| Chat — Multi-turn conversations | View | View | View |
| Streaming — Live SSE events for chat turns and executions | View | View | View |
| Traces — Tracing, span trees, and usage summaries | View | View | View |
| Executions — History, execution tree, and the approval inbox | View | View | View |
Costs — Usage & cost aggregates via traces.get_summary |
View | View | View |
| MCP Tools — External tool integrations | View | View | View |
| Agent Triggers — Event-driven agent execution | View | View | View |
| A2A — Agent-to-Agent communication | View | View | View |
| Assets — Manage stored assets | View | View | View |
These are the target published versions. Until they ship, the examples resolve the unreleased SDKs locally (see the
⚠️ note above and the per-language READMEs).
Python:
pip install "promptrails>=0.9.0"JavaScript/TypeScript:
npm install @promptrails/sdk@^0.9.0Go:
go get github.com/promptrails/go-sdk@v0.7.0