Dakora Python SDK
Centralized prompt management with versioning, execution tracking, and analytics for production LLM applications.
Installation
pip install dakora
Quick Start
from dakora import Dakora
dakora = Dakora(api_key="dk_proj_...")
# Render versioned prompts
result = await dakora.prompts.render("greeting", {"name": "Alice"})
print(result.text) # "Hello Alice! How can I help you today?"
# Use with agents (automatic tracking)
message = result.to_message()
response = await agent.run(message)
# Query execution history & analytics
executions = await dakora.executions.list(
agent_id="support-bot"
)
All executions automatically tracked when using with dakora-agents.
Why Dakora?
- Centralized Prompts - Version control, A/B testing, instant updates without code deploys
- Automatic Tracking - Tokens, cost, latency tracked via OpenTelemetry
- Template Linkage - Know exactly which prompts are used in production
- Built-in Analytics - Query execution history by agent, session, template, cost
Template Management
# List prompts
prompts = await dakora.prompts.list(project_id="proj-123")
# Render with inputs
result = await dakora.prompts.render(
prompt_id="support-response",
inputs={"ticket": "...", "user": "Alice"}
)
# Version and metadata included
print(result.version) # "2.1.0"
print(result.prompt_id) # "support-response"
# Convert to agent message (auto-tracking)
message = result.to_message()
Execution Analytics
# Filter by agent, session, template
executions = await dakora.executions.list(
agent_id="support-bot", # Specific agent
session_id="session-789", # User conversation
prompt_id="greeting" # Template used
)
# Calculate costs
total_cost = sum(e["cost_usd"] for e in executions)
# Get full details
execution = await dakora.executions.get(execution_id="trace-456")
print(execution["conversation_history"])
print(execution["templates_used"])
Agent Integration
Automatic execution tracking with Microsoft Agent Framework:
pip install dakora[maf]
from dakora_agents.maf import DakoraIntegration
middleware = DakoraIntegration.setup(dakora)
client = AzureOpenAIChatClient(..., middleware=[middleware])
# Every agent call automatically tracked:
# - Tokens (input/output)
# - Cost ($)
# - Latency (ms)
# - Template linkage
# - Conversation history
Advanced Usage
Pagination:
result = await dakora.executions.list(
limit=50,
offset=100,
include_metadata=True
)
print(f"Showing {len(result['executions'])} of {result['total']}")
Singleton pattern:
# config.py
from dakora import Dakora
dakora = Dakora() # Uses DAKORA_API_KEY env var
# anywhere.py
from myapp.config import dakora
result = await dakora.prompts.render("greeting", {"name": "Alice"})
Environment variables:
DAKORA_API_KEY=dk_proj_...
DAKORA_BASE_URL=http://localhost:8000 # Optional
FastAPI example:
from fastapi import FastAPI
from dakora import Dakora
dakora = Dakora()
app = FastAPI()
@app.get("/greet/{name}")
async def greet(name: str):
result = await dakora.prompts.render("greeting", {"name": name})
return {"message": result.text}
Development
cd packages/client-python
pip install -e .
Metadata
Release files for dakora 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dakora-0.2.0.tar.gz | 17.5 kB | Without provenance | Details for dakora-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dakora-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dakora-0.2.0-py3-none-any.whl |
Total release size: 36.6 kB
Release files / dakora-0.2.0.tar.gz
| Download URL | dakora-0.2.0.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
854dde38ed0e9ab84f2718a1ccc67befc66eb6a22b19438e218bfe94e443c5b4
|
|
BLAKE2b-256 checksum How to use checksums |
491ff0e243b49e37b6b22b3f8faed4ee8b6adb643e1ac112c9506602a228f06f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.4
|
Release files / dakora-0.2.0-py3-none-any.whl
| Download URL | dakora-0.2.0-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f9481090d092858cd3ff6872a3a16c383f7a2781d1b0654d6265b7f886c5d96
|
|
BLAKE2b-256 checksum How to use checksums |
ffb123c7d3211fb4b9e1ef06695f59ea093dd30af1ddd0550f8a214c54da371d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.4
|
Security for dakora 0.2.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.