mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
* refactor: carve out extraction panel * refactor: create spec versions for node types * refactor: create a GenericNode and remove custom nodes * feat: add python and typescript sdk * add dograh sdk * fix: fetch draft workflow definition over published one * fix: fix routes of SDKs to use code gen * chore: remove doclink dependency to reduce image size * chore: format files * chore: bump pipecat * feat: let mcp fetch archived workflows on demand * chore: fix tests * feat: add sdk documentation * chore: change banner and add badge
35 lines
1.3 KiB
Python
35 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",
|
|
]
|