Skip to main content

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):

  1. 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) as GOOGLE_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 \n as the literal two-character escape inside the JSON string, not a real newline. Never commit this value.

  2. Grant the service account the roles/aiplatform.user role on the project (IAM console), and enable the Vertex AI API:

    gcloud services enable aiplatform.googleapis.com --project=YOUR_PROJECT_ID
    
  3. That's it — VertexAIProvider picks up GOOGLE_APPLICATION_CREDENTIALS_JSON itself when credentials isn'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: scopes is required here — a service-account credential (whether from GOOGLE_APPLICATION_CREDENTIALS_JSON or a key file) has no implicit scope; omitting it fails with invalid_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

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)

Source distribution for dobby-sdk 0.2.17
File Size Uploaded
dobby_sdk-0.2.17.tar.gz 105.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dobby-sdk 0.2.17
File Interpreter ABI Platform
dobby_sdk-0.2.17-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.2.17 This release

2 release files

0.2.15

2 release files

0.2.14

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release 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