Dobby SDK
Lightweight multi-provider LLM SDK with streaming and tool support.
Installation
pip install dobby-sdk
# Or from GitHub
pip install git+https://github.com/TYNYBAY/dobby-sdk.git
# With uv
uv add dobby-sdk
Quick Start
from dobby import AgentExecutor, OpenAIProvider
from dobby.types import UserMessagePart, TextPart, TextDeltaEvent
provider = OpenAIProvider(model="gpt-4o", api_key="sk-...")
executor = AgentExecutor(provider="openai", llm=provider)
messages = [UserMessagePart(parts=[TextPart(text="Hello!")])]
async for event in executor.run_stream(messages):
match event:
case TextDeltaEvent(delta=delta):
print(delta, end="")
Vertex AI Credentials Setup
VertexAIProvider authenticates via a google.auth.credentials.Credentials object — no API key needed. Store the service account key as a single env var (works the same locally and in prod, no key file on disk):
-
Download the service account key JSON (GCP Console → IAM & Admin → Service Accounts → Keys), minify it to one line, and add it to your
.env(or your prod secret manager's env injection) asGOOGLE_APPLICATION_CREDENTIALS_JSON:GOOGLE_APPLICATION_CREDENTIALS_JSON='{"type":"service_account","project_id":"...","private_key":"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n", ...}'
Single quotes, one line — keep
\nas the literal two-character escape inside the JSON string, not a real newline. Never commit this value. -
Grant the service account the
roles/aiplatform.userrole on the project (IAM console), and enable the Vertex AI API:gcloud services enable aiplatform.googleapis.com --project=YOUR_PROJECT_ID
-
That's it —
VertexAIProviderpicks upGOOGLE_APPLICATION_CREDENTIALS_JSONitself whencredentialsisn't passed explicitly, no manual credential-building needed:import asyncio from dobby.providers import VertexAIProvider from dobby.types import UserMessagePart, TextPart async def main(): provider = VertexAIProvider( model="meta/llama-3.1-405b-instruct-maas", project="your-project-id", location="us-central1", scopes=["https://www.googleapis.com/auth/cloud-platform"], ) result = await provider.chat([UserMessagePart(parts=[TextPart(text="Hello!")])]) print(result.parts) asyncio.run(main())
uv run --env-file .env python examples/vertexai_example.py
Note:
scopesis required here — a service-account credential (whether fromGOOGLE_APPLICATION_CREDENTIALS_JSONor a key file) has no implicit scope; omitting it fails withinvalid_scope: Invalid OAuth scope or ID token audience provided.
On GCP itself (Cloud Run, GKE, Compute Engine): skip all of the above — attach a service account to the runtime and let ADC resolve it automatically via the metadata server. No key material to manage at all. The env-var approach above is only needed off-GCP (other clouds, local dev without gcloud auth application-default login).
Other auth styles — a service-account key file, service-account impersonation, or plain ADC — are shown as runnable variants in build_provider() in examples/vertexai_example.py, with the full reference in docs/providers/vertexai.md.
Features
- Multi-provider: OpenAI, Azure OpenAI, Anthropic (direct, Azure AI Foundry), Gemini (Developer API), Vertex AI Model Garden
- Streaming: Real-time token streaming with typed events
- Tools: Dataclass-based tools with auto-generated schemas
- Context injection: Pass runtime context to tools via
Injected[T] - Structured output: Pydantic model validation for agent responses
Documentation
See docs/ for detailed documentation:
License
MIT
Metadata
Release files for dobby-sdk 0.2.17
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 |
|---|---|---|---|---|
| dobby_sdk-0.2.17.tar.gz | 105.1 kB | Without provenance | Details for dobby_sdk-0.2.17.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dobby_sdk-0.2.17-py3-none-any.whl | Python 3 | none | any | Details for dobby_sdk-0.2.17-py3-none-any.whl |
Total release size: 185.7 kB
Release files / dobby_sdk-0.2.17.tar.gz
| Download URL | dobby_sdk-0.2.17.tar.gz |
|---|---|
| Size | 105.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbe6b99cff3a15b30cf61632068198b44d40f5f5ec7e233df31379b4d3928503
|
|
BLAKE2b-256 checksum How to use checksums |
1302d5ee1e09eb2b66486cd9c47c9a920c68584a3af1c0754286d96378d3aa79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / dobby_sdk-0.2.17-py3-none-any.whl
| Download URL | dobby_sdk-0.2.17-py3-none-any.whl |
|---|---|
| Size | 80.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fccf845858063feaecffb65847059268c7fb5b52ff47620aaa95f5a315e5786
|
|
BLAKE2b-256 checksum How to use checksums |
5bd56b7ace8e75056598c4c930525a8fae77b5b01e5f055a353e3e81c160ca8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Security for dobby-sdk 0.2.17
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.