Dobby SDK for Python
Official Python SDK for the Dobby AI Platform — Home for your AI agents.
Installation
pip install dobby-ai-sdk
Quick Start
from dobby_sdk import DobbyClient
client = DobbyClient(api_key="gk_user_...")
# LLM calls (OpenAI-compatible)
response = client.chat.completions.create(
model="claude-sonnet-4-20250514",
messages=[{"role": "user", "content": "Hello from Dobby!"}],
)
print(response.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Explain AI agents"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
Control Points — inline policy enforcement
Ask Dobby for a policy verdict before your agent runs a risky action, and let
your own code decide what to do. Unlike a gateway, Dobby returns the decision —
your code is the enforcement point (the classic PDP/PEP split; same family as
OPA / Cerbos) — and you report back what you did: honored=True if you stopped,
honored=False if you overrode the deny and proceeded anyway. That honored-vs-
overridden split is the auditable adherence signal — rolled up across your
Org → Tenant → Process layers — that a gateway cannot produce.
from dobby_sdk import DobbyClient, DobbyPolicyDenied
client = DobbyClient(api_key="sk_live_...", org_id="org_...", tenant_id="tenant_...")
try:
# enforce() raises DobbyPolicyDenied if the policy blocks the action.
client.controls.enforce("send_external_email", arguments={"to": addr})
send_external_email(addr) # runs only if the policy allowed it
except DobbyPolicyDenied as denied:
# Your code halts the action — then report the honored stop.
client.controls.report(
denied.verdict.decision_id, honored=True, action_taken="stopped"
)
Prefer to branch yourself instead of catching? Use check(), which returns a
Verdict and never raises on a deny:
verdict = client.controls.check("run_command", arguments={"cmd": cmd})
# verdict.allowed (bool) | verdict.reason | verdict.action | verdict.decision_id
if verdict.allowed:
run_command(cmd) # allowed -> proceed
else:
# The policy said STOP. Your code decides what happens — and reports it honestly:
# A) honor the deny (recommended): stop, report honored=True
client.controls.report(verdict.decision_id, honored=True, action_taken="stopped")
# B) override the deny (your call): proceed anyway, report honored=False
# run_command(cmd)
# client.controls.report(verdict.decision_id, honored=False, action_taken="proceeded")
# honored vs overridden is exactly what the Adherence metric counts.
Task Management
# Create a task
task = client.tasks.create(
title="Review PR #42",
priority="high",
agent_name="dobby-code-reviewer-agent",
)
# List pending tasks
tasks = client.tasks.list(status="pending")
# Approve a task (HITL)
client.approvals.approve(task["id"], comment="Looks good!")
Agent Fleet
# List all agents
agents = client.agents.list()
# Register an external agent
agent = client.agents.register(
display_name="Research Agent",
framework="crewai",
protocol="a2a",
endpoint_url="https://my-agent.example.com",
)
# Pause/resume
client.agents.pause("agent_abc123")
Cost Tracking
# Organization cost summary
costs = client.costs.summary(period="30d")
# Per-agent breakdown
agent_costs = client.costs.by_agent(period="7d")
Async Support
from dobby_sdk import AsyncDobbyClient
async with AsyncDobbyClient(api_key="gk_user_...") as client:
response = await client.chat.completions.create(
model="claude-sonnet-4-20250514",
messages=[{"role": "user", "content": "Hello async!"}],
)
Configuration
client = DobbyClient(
api_key="gk_user_...", # or DOBBY_API_KEY env var
base_url="https://dobby-ai.com", # or DOBBY_BASE_URL
org_id="org_...", # or DOBBY_ORG_ID
tenant_id="tenant_...", # or DOBBY_TENANT_ID
timeout=120.0,
max_retries=2,
)
Error Handling
from dobby_sdk import DobbyAuthError, DobbyRateLimitError, DobbyBudgetExceededError
try:
response = client.chat.completions.create(...)
except DobbyAuthError:
print("Invalid or expired API key")
except DobbyRateLimitError as e:
print(f"Rate limited. Retry after: {e.retry_after}s")
except DobbyBudgetExceededError:
print("Organization budget limit reached")
Metadata
Release files for dobby-ai-sdk 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dobby_ai_sdk-0.4.1.tar.gz | 24.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dobby_ai_sdk-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.0 kB
Release files / dobby_ai_sdk-0.4.1.tar.gz
| Download URL | dobby_ai_sdk-0.4.1.tar.gz |
|---|---|
| Size | 24.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08ca6ef68b2e0c7fa19815595bde31b960a09818678520b470c57111c8b08d79
|
|
BLAKE2b-256 checksum How to use checksums |
32ee03d2ebff7705d2aff9e51e519d9ad9027bc7a7fa3d5d414b069e842483c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 27, 2026.
Transparency logRelease files / dobby_ai_sdk-0.4.1-py3-none-any.whl
| Download URL | dobby_ai_sdk-0.4.1-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7bdf1efa93eaf88c067fa83a94042445f9bb64365bdfa9008c6c5fa6ff9feb7
|
|
BLAKE2b-256 checksum How to use checksums |
948077ac9d127537742eaa21fce33b1bedf15071979a945e0450fe5768924fbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 27, 2026.
Transparency log