AdalFlow
A PyTorch-like open-source library to build and auto-optimize LLM workflows, from chatbots and RAG systems to agents, with unified prompt tuning and few-shot learning.
At a Glance
About AdalFlow
AdalFlow is an open-source Python library developed by SylphAI, Inc. that brings PyTorch-style design patterns to the construction and automatic optimization of large language model (LLM) workflows. It is available under the MIT license and powers AdaL CLI, described by the project as a self-evolving coding agent. The library is community-driven and targets AI researchers, product teams, and software engineers building production LLM applications.
What It Is
AdalFlow treats LLM pipelines as auto-differentiable computation graphs, borrowing the Component, Parameter, and Trainer abstractions from PyTorch. Developers define prompts and few-shot demonstrations as Parameter objects, then run a training loop that automatically tunes them against a dataset — without manually rewriting prompts. The library covers the full stack: prompt templating via Jinja2, model-agnostic Generator and Embedder building blocks, retrieval (BM25, FAISS, Qdrant, LanceDB, Postgres), structured output parsing, ReAct agents, streaming, tracing, and LLM evaluation utilities.
Auto-Optimization Architecture
The core differentiator is a unified optimization loop that combines two complementary techniques:
- Textual gradient descent (LLM-AutoDiff): Prompts marked as
PROMPTparameters are updated via LLM-generated gradients, analogous to backpropagation. The underlying research paper, "Auto-Differentiating Any LLM Workflow," was published in January 2025. - Few-shot bootstrap learning: Parameters marked as
DEMOSare optimized via bootstrap sampling, similar to DSPy's approach.
Both can run simultaneously inside a single AdalComponent + Trainer loop, letting developers combine instruction optimization and demonstration selection in one pass.
Model and Integration Coverage
AdalFlow is model-agnostic by design. The ModelClient abstraction provides a unified interface across a wide range of providers, including OpenAI, Anthropic, Azure AI, Google, Groq, Mistral, Cohere, DeepSeek, Fireworks, SambaNova, Together AI, Ollama (local), and Hugging Face Transformers. Optional provider SDKs are installed separately, so the core package stays lightweight. Retriever integrations include FAISS, Qdrant, LanceDB, and PostgreSQL. Tracing integrates with MLflow.
Research Backing
The library is developed in collaboration with the VITA Group at the University of Texas at Austin. Published research includes:
- Auto-Differentiating Any LLM Workflow (arXiv, January 2025) — introduces LLM-AutoDiff and benchmarks it as token-efficient with higher accuracy than DSPy.
- Scaling Textual Gradients via Sampling-Based Momentum (arXiv, December 2025) — introduces Gumbel-Top-k sampling for stable, scalable prompt optimization.
- LAD-VF: LLM-Automatic Differentiation Enables Fine-Tuning-Free Robot Planning (arXiv, September 2025) — extends the framework to robotics planning.
Update: v1.1.3
The latest release is v1.1.3, published on September 25, 2025. The repository was last pushed to in May 2026, indicating active maintenance. Recent additions visible in the documentation include an Agent + Runner architecture with synchronous, asynchronous, and streaming call modes; MCP tool support (mcp_tool module); human-in-the-loop training utilities; and MLflow tracing integration. The GitHub repository reports 4,166 stars and 376 forks as of mid-2026.
Open-Source Deployment Model
AdalFlow is installed via pip install adalflow and runs entirely locally or against any cloud model API the developer configures. There is no hosted service or proprietary backend required. The MIT license allows free use, modification, and redistribution. Community support is available through GitHub Discussions, GitHub Issues, and a Discord server.
Community Discussions
Be the first to start a conversation about AdalFlow
Share your experience with AdalFlow, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully open-source under MIT license, free to use, modify, and distribute.
- Full library access
- All model integrations
- Auto-optimization framework
- Agent and RAG support
- Community support via Discord and GitHub
Capabilities
Key Features
- PyTorch-style Component and Parameter abstractions for LLM pipelines
- Automatic prompt optimization via LLM-AutoDiff (textual gradient descent)
- Few-shot bootstrap learning for demonstration optimization
- Unified AdalComponent and Trainer for combined prompt + demo tuning
- Model-agnostic Generator and Embedder building blocks
- Jinja2-based prompt templating with full developer control
- Structured output parsing with DataClass
- ReAct agent with tool use and function calling
- Agent Runner with sync, async, and streaming call modes
- MCP tool support
- Retrieval integrations: BM25, FAISS, Qdrant, LanceDB, PostgreSQL
- Human-in-the-loop training utilities
- Tracing with MLflow integration
- LLM evaluation utilities (answer match, retriever recall, LLM-as-judge, G-Eval)
- Support for 15+ model providers via unified ModelClient interface
- Local model support via Ollama and Hugging Face Transformers
