Skip to main content

Install

pip install superdialog
Install only the extras you need:
pip install superdialog[livekit]    # LiveKit adapter
pip install superdialog[pipecat]    # PipeCat adapter
pip install superdialog[fastapi]    # FastAPI adapter + uvicorn
pip install superdialog[ws]         # WebSocket runner
pip install superdialog[mcp]        # MCP tool support
pip install superdialog[langchain]  # LangChainAgent

Step 1 - Bootstrap a flow from a prompt

create_dialog_flow makes a one-shot LLM call and returns a JSON-serializable flow graph. The LLM is used only at construction - not at runtime.
import asyncio
from superdialog import create_dialog_flow

async def main():
    flow = await create_dialog_flow(
        prompt="Confirm customer appointment. Ask if Friday 4pm works; offer 5pm as an alternative if not.",
        llm="openai/gpt-5.1",
    )
    flow.save("appointment.json")   # version-control it

asyncio.run(main())
create_dialog_flow is async. From a sync entry point, wrap it in asyncio.run(...).

Step 2 - Build the runtime machine

from superdialog import DialogMachine, Flow

flow = Flow.load("appointment.json")

dialog_machine = DialogMachine(
    flow=flow,
    llm="anthropic/claude-haiku-4-5",   # runtime model - can differ from the build model
)

Step 3 - Run a conversation

import asyncio

async def chat():
    reply = await dialog_machine.turn("Hello, I'm calling about my appointment.")
    print(reply.text)

    reply = await dialog_machine.turn("Friday 4pm works for me.")
    print(reply.text)

asyncio.run(chat())
Or use the bundled CLI - no Python code needed:
superdialog chat appointment.json

Step 4 - Add a tool

from superdialog import DialogMachine, Flow, PythonTool

def lookup_customer(phone_number: str) -> dict:
    """Look up customer record by phone number."""
    return crm.get_by_phone(phone_number)

dialog_machine = DialogMachine(
    flow=Flow.load("appointment.json"),
    llm="anthropic/claude-haiku-4-5",
    tools=[PythonTool.of(lookup_customer)],  # schema inferred from signature + docstring
)
Or use the @tool decorator shorthand:
from superdialog.tools import tool

@tool
def lookup_customer(phone_number: str) -> dict:
    """Look up customer record by phone number."""
    return crm.get_by_phone(phone_number)

dialog_machine = DialogMachine(
    flow=Flow.load("appointment.json"),
    llm="anthropic/claude-haiku-4-5",
    tools=[lookup_customer],  # decorated function is already a PythonTool
)

Step 5 - Deploy anywhere

The same dialog_machine object drops into every host:

LiveKit

Plug in as an Agent(llm=...) plugin

PipeCat

Drop in as a FrameProcessor in your pipeline

FastAPI

Mount a /turn endpoint for text chatbots

Unpod Voice

Connect via WebSocketRunner to Unpod infrastructure

What’s next

Architecture

Understand flows, the machine engine, tools, and sessions

API Reference

Full reference for every class and method

CLI Reference

All superdialog commands

Embedding Guides

Host-specific integration walkthroughs