A Python framework for programming language models with modular code and algorithms that optimize prompts and weights, instead of hand-writing prompts.
SylphAI-Inc/AdalFlow
A PyTorch-style Python library for building LLM workflows such as chatbots, RAG, and agents, with automatic prompt optimization.
- Stars
- 4,224
- Forks
- 389
- Open issues
- 72
- Last commit
- 6 days ago
What is it?
AdalFlow is a Python library for building LLM applications, covering chatbots, retrieval-augmented generation (RAG), and agents. Its API follows PyTorch conventions: pipelines are composed from components, and model providers can be swapped through configuration rather than code changes.
The library includes an optimization layer that treats prompts and few-shot demonstrations as trainable parameters. Developers define a Parameter and pass it to a Generator, then train it with textual gradient descent for instructions or bootstrap few-shot optimization for demonstrations. A Trainer with an AdalComponent interface handles the training and validation loop.
AdalFlow also provides an agent runner with synchronous, asynchronous, and streaming call modes, tool calling, and step history. Human-in-the-loop and tracing are covered in its documentation, and it integrates with MLflow for tracing.
Key features
- 01PyTorch-style components for composing LLM pipelines.
- 02Automatic prompt optimization using textual gradients and few-shot demonstrations.
- 03Model-agnostic configuration to switch between LLM providers.
- 04Agent runner with sync, async, and streaming call modes plus tool calling.
- 05MLflow integration for tracing.
Use cases
- Building RAG question-answering systems over your own documents.
- Creating tool-using agents that call functions and stream progress.
- Automatically tuning prompts for a classification task instead of hand-editing them.
- Prototyping LLM pipelines that can later switch model providers via config.
Quick start
- 1
Install AdalFlow with pip
pip install adalflow - 2
Set your OPENAI_API_KEY environment variable
- 3
Run the Hello World Agent example from the README
Things to know
- The Hello World examples need an OpenAI API key to run.
In collections
Topics
FAQ
- What is AdalFlow?
- A PyTorch-style Python library for building LLM workflows such as chatbots, RAG, and agents, with automatic prompt optimization. AdalFlow is a Python library for building LLM applications, covering chatbots, retrieval-augmented generation (RAG), and agents. Its API follows PyTorch conventions: pipelines are composed from components, and model providers can be swapped through configuration rather than code changes.
- Is AdalFlow free to use? What license does it have?
- AdalFlow is open source under the MIT license. Check the license terms before using it in commercial products.
- Is AdalFlow still maintained?
- Actively maintained. The last commit to AdalFlow was on Nov 1, 2026.
- What can I use AdalFlow for?
- Building RAG question-answering systems over your own documents. Creating tool-using agents that call functions and stream progress. Automatically tuning prompts for a classification task instead of hand-editing them. Prototyping LLM pipelines that can later switch model providers via config.
- How do I install AdalFlow?
- Install AdalFlow with pip: pip install adalflow Set your OPENAI_API_KEY environment variable Run the Hello World Agent example from the README
- Where can I get AdalFlow?
- The source code and installation instructions are on GitHub: https://github.com/SylphAI-Inc/AdalFlow
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A vectorless RAG engine that builds a hierarchical tree index of long documents and lets an LLM reason through it to retrieve answers.
Local, evidence-first memory runtime for AI agents that filters writes, tracks fact changes over time, and explains each recalled result.
A CLI and web workbench that compiles raw documents into an interlinked, LLM-maintained markdown wiki, using PageIndex tree retrieval for long files.
End-to-end training, inference and distillation code for RAG retrieval models, covering embedding, ColBERT and reranker models.
A Python framework for building LLM-powered applications and agents, with standard interfaces for models, embeddings, vector stores and third-party integrations.