LoongFlow
LoongFlow: A Thinking & Learning Framework for Expert-Grade AI Agents.
Install / Use
/learn @baidu-baige/LoongFlowREADME
Set Creativity Free! LoongFlow turns your expertise into professional AI productivity.
LoongFlow is an open-source expert-grade Agent development framework.
Enable Agents to think and learn through the PES paradigm, and accumulate experience through iteration.
<p align="center"> <a href="https://github.com/baidu-baige/LoongFlow/stargazers"><img src="https://img.shields.io/github/stars/baidu-baige/LoongFlow?style=social" alt="GitHub stars"></a> <a href="https://arxiv.org/abs/2512.24077"> <img src="https://img.shields.io/badge/cs.AI-2512.24077-B31C1C?logo=arxiv&logoColor=B31C1C" alt="arxiv" /> </a> <a href="https://pypi.org/project/LoongFlow/"> <img src="https://img.shields.io/badge/python-3.12+-blue?logo=python" alt="pypi" /> </a> <a href="./LICENSE"> <img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="license" /> </a> </p>🚀 Quick Start • Examples • Math-Agent • ML-Agent • General-Agent • Discussions
</div> <br/> <table align="center" width="100%" style="border: none; table-layout: fixed;"> <tr> <td width="25%" align="center" style="vertical-align: top; padding: 20px;"> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <h3 style="margin: 0; padding: 0;">💻 <strong>General-Agent</strong></h3> </div> <div align="center" style="margin: 10px 0;"> <img src="https://img.shields.io/badge/AGENT-general_agent-blue" alt="agent Badge" /> </div> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <p align="center"><strong>General Purpose Agent</strong></p> </div> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <p align="center"><strong>Flexible</strong>, <strong>skill-driven</strong> coding tasks from simple apps to bug hunting.</p> </div> </td> <td width="25%" align="center" style="vertical-align: top; padding: 20px;"> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <h3 style="margin: 0; padding: 0;">🚀 <strong>Math-Agent</strong></h3> </div> <div align="center" style="margin: 10px 0;"> <img src="https://img.shields.io/badge/AGENT-math_agent-blue" alt="agent Badge" /> </div> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <p align="center"><strong>Math Problem Agent</strong></p> </div> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <p align="center"><strong>Efficient</strong>, <strong>stable</strong> driving of math algorithm design and continuous evolution.</p> </div> </td> <td width="25%" align="center" style="vertical-align: top; padding: 20px;"> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <h3 style="margin: 0; padding: 0;">🔥 <strong>ML-Agent</strong></h3> </div> <div align="center" style="margin: 10px 0;"> <img src="https://img.shields.io/badge/AGENT-ml_agent-blue" alt="agent Badge" /> </div> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <p align="center"><strong>Machine Learning Agent</strong></p> </div> <div style="height: 60px; display: flex; align-items: center; justify-content: center;"> <p align="center"><strong>Full-process</strong>, <strong>autonomous</strong> construction and continuous evolutionary breakthrough.</p> </div> </td> </tr> </table> <br/>LoongFlow: Inspired by Wang Yangming's "Enlightenment at Longchang".LoongFlow is dedicated to breaking the barrier between Knowing and Doing. We enable wisdom to awaken through the unity of knowledge and action, ensuring that every drop of professional expertise is transformed into powerful AI productivity.
✨ Why LoongFlow?
An expert-grade Agent framework that thinks and learns. It empowers Agents to think like scientists, helping developers rapidly transform their professional expertise into expert-level Agents.
<p align="center"> <img src="./assets/images/loongflow_fr_v1.jpg" alt="LoongFlow Framework" width="80%"/> </p>- Intelligent Thinking: Innovative PES (Planning-Execution-Summary) Paradigm. LoongFlow empowers Agents with structured thinking to tackle long-range complex reasoning challenges. This enables Agents to iterate through high-difficulty tasks with the rigorous mindset of a human scientist.
- Continuous Learning: Innovative Multi-Structure Fusion Memory. By actively generating model reasoning contexts, LoongFlow allows Agents to continuously synthesize experience during task iterations. This results in a "run-and-improve" mechanism, achieving lightweight learning and evolution without heavy retraining.
We believe that the key to designing an expert-level Agent capable of solving complex problems lies in the Agent’s thinking paradigm. The thinking paradigm determines the complexity of problems an Agent can handle and sets the ceiling for its effectiveness. LoongFlow is built specifically for complex tasks requiring long-range reasoning, helping developers rapidly build Agents with domain-expert performance.
Proven Achievements
<div align="center">| Domain | Achievement | Example | | ------------------------------------------------------ |----------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------------------------------------------------------------------ | | Mathematical Challenges (Tao’s & AlphaEvolve sets) | Outperformed the best human results on 11 problems and surpassed AlphaEvolve’s results on 7 problems, achieving the latest SOTA. | Circle Packing | | MLE-bench (Kaggle Challenges) | Achieved medals across all 48 Kaggle competitions, including 26 Gold Medals. | Stanford-Covid-Vaccine |
</div>LoongFlow vs Traditional Agent Approaches:
<table> <tr> <th align="left">Aspect</th> <th align="left">Prompt / Tool-Based Agents</th> <th align="left">OpenEvolve-Style Evolution</th> <th align="left">LoongFlow</th> </tr> <tr> <td><strong>Core Loop</strong></td> <td>Generate → Retry</td> <td>Mutate → Select</td> <td>Plan → Execute → Summary</td> </tr> <tr> <td><strong>Reasoning Depth</strong></td> <td>Shallow</td> <td>Limited</td> <td>Long-horizon, structured</td> </tr> <tr> <td><strong>Learning from Failure</strong></td> <td>❌</td> <td>Partial</td> <td>✅ Explicit reflection</td> </tr> <tr> <td><strong>Experience Reuse</strong></td> <td>❌</td> <td>❌</td> <td>✅ Structured memory</td> </tr> <tr> <td><strong>Stability</strong></td> <td>Fragile</td> <td>Often unstable</td> <td>Stable convergence</td> </tr> <tr> <td><strong>Best Use Case</strong></td> <td>Simple automation</td> <td>Search-heavy tasks</td> <td>Expert-level problem solving</td> </tr> </table>Quick Start
Installation
LoongFlow requires Python 3.12 or higher.
# Install uv/conda and clone repository
uv: https://docs.astral.sh/uv/getting-started/installation/
Miniforge: https://conda-forge.org/download/
# Install with uv
cd LoongFlow
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install -e .
# Install with conda
cd LoongFlow
conda create -n loongflow python=3.12
conda activate loongflow
pip install -e .
Run Examples
Run General Agent
# Config LLM: Edit task_config.yaml or set environment variables
# Supports Anthropic-compatible models
export ANTHROPIC_API_KEY="your-api-key"
export ANTHROPIC_BASE_URL="your-endpoint"
# Run beginner example - TODO list app (5-10 minutes)
./run_general.sh 01_todo_list
# Run intermediate example - File processor with custom skills (10-15 minutes)
./run_general.sh 02_file_processor
# Run advanced example - Bug hunter with security scanning (15-20 minutes)
./run_general.sh 03_bug_hunter
# Run expert example - Circle packing optimization (20-30 minutes)
./run_general.sh 04_circle_packing --background
# Check task log (for background tasks)
tail -f ./agents/general_agent/examples/04_circle_packing/run.log
# Stop background task
./run_general.sh stop 04_circle_packing
# 📖 Complete Tutor
