mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-13 08:15:21 +02:00
36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
|
|
"""Dograh SDK — typed builder for voice-AI workflows.
|
||
|
|
|
||
|
|
Runtime SDK: fetches the spec catalog from the Dograh backend at session
|
||
|
|
start and validates every `Workflow.add()` call against it. LLMs don't
|
||
|
|
need to import per-node-type classes — the `type` argument is a string
|
||
|
|
keyed against the fetched spec catalog.
|
||
|
|
|
||
|
|
from dograh_sdk import DograhClient, Workflow
|
||
|
|
|
||
|
|
with DograhClient(base_url="http://localhost:8000", api_key=...) as client:
|
||
|
|
wf = Workflow(client=client, name="loan_qualification")
|
||
|
|
start = wf.add(type="startCall", name="greeting", prompt="...")
|
||
|
|
qualify = wf.add(type="agentNode", name="qualify", prompt="...")
|
||
|
|
wf.edge(start, qualify, label="interested", condition="...")
|
||
|
|
client.save_workflow(workflow_id=123, workflow=wf)
|
||
|
|
|
||
|
|
For typed IDE autocomplete, generate per-node dataclasses via the SDK
|
||
|
|
codegen (Phase 6) — the runtime and typed SDKs share this same core.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from .client import DograhClient
|
||
|
|
from .errors import ApiError, DograhSdkError, SpecMismatchError, ValidationError
|
||
|
|
from .typed._base import TypedNode
|
||
|
|
from .workflow import NodeRef, Workflow
|
||
|
|
|
||
|
|
__all__ = [
|
||
|
|
"ApiError",
|
||
|
|
"DograhClient",
|
||
|
|
"DograhSdkError",
|
||
|
|
"NodeRef",
|
||
|
|
"SpecMismatchError",
|
||
|
|
"TypedNode",
|
||
|
|
"ValidationError",
|
||
|
|
"Workflow",
|
||
|
|
]
|