Python SDK
Dynamiq is an open-source Python orchestration framework for agentic AI and LLM applications — build workflows, agents, and RAG pipelines in code.
dynamiq is the open-source Python framework that powers Dynamiq. You compose nodes (LLMs, agents, tools, retrievers, embedders) into workflows, run them anywhere Python runs, and — when you want managed deployments, tracing, and a visual builder — connect the same code to the Dynamiq platform. The library is Apache 2.0 licensed and published on PyPI.
pip install dynamiqA first taste
An LLM node is a self-contained, runnable unit — connection, model, and prompt in one object:
from dynamiq.nodes.llms import OpenAI
from dynamiq.connections import OpenAI as OpenAIConnection
from dynamiq.prompts import Prompt, Message
llm = OpenAI(
connection=OpenAIConnection(), # reads OPENAI_API_KEY from the environment
model="gpt-4o-mini",
prompt=Prompt(messages=[
Message(role="user", content="Translate the following text into English: {{ text }}"),
]),
)
result = llm.run(input_data={"text": "Hola Mundo!"})
print(result.output["content"])The same run() interface works for a single node, a multi-node workflow, or a full agent — every execution returns a RunnableResult with status, input, and output. See the Quickstart for the workflow and agent versions.
What's in the box
- Workflows, Flows, and Nodes — declare a DAG with
depends_on()and.inputs(); independent nodes run in parallel automatically. See Workflows, Flows & Nodes. - LLM providers — one node interface across OpenAI, Anthropic, Gemini, Bedrock, Mistral, Groq, Ollama, Azure AI, Together AI, and 15+ more in
dynamiq.nodes.llms. See LLM providers. - Agents — a ReAct Agent that plans, calls tools (web search, code sandboxes, HTTP, SQL, MCP servers, other agents), and loops until done; a Graph Orchestrator for custom state machines.
- RAG — converters, splitters, embedders, vector-store writers and retrievers for Pinecone, Qdrant, Weaviate, Chroma, Milvus, pgvector, Elasticsearch, and more. See Build a RAG pipeline.
- Streaming and callbacks — token-level streaming from any LLM or agent node, plus a callback interface for every lifecycle event. See Streaming & callbacks.
- Memory — conversation memory with in-memory, SQLite, PostgreSQL, Qdrant, Pinecone, Weaviate, and DynamoDB backends. See Memory.
- Production plumbing — error handling and retries, caching, checkpoints for resumable runs, mid-run cancellation, and evaluations.
How it relates to the platform
The SDK and the platform share the same execution engine, so nothing you build in code is a dead end:
- Tracing — add one callback handler and every run appears in the platform's trace explorer. See Tracing to Dynamiq.
- YAML — workflows serialize to and load from YAML (
Workflow.from_yaml_file/to_yaml_file), the same declarative format the platform uses. See YAML workflows. - Deploy — the bundled
dynamiqCLI deploys SDK code as a managed service on the platform. See Deploy from the SDK. - Gateway — route LLM calls through the platform's AI Gateway for centralized keys, routing, and usage tracking. See Remote connections and gateway.
Not sure which surface to start with? Read SDK vs Platform.
Installation
Python requirements, pip and Poetry installs, and optional extras.
Quickstart
An LLM workflow in 20 lines, then an agent with a web-search tool.
Workflows, Flows & Nodes
The core abstractions and how the DAG executes.
SDK vs Platform
When to write code, when to use the canvas, and how to combine both.