Minimalist AI framework in 65 Lines. Enable LLMs to Program Themselves.
Project description
A radically minimalist AI framework (just 200 lines in Python! 🤯)
Build Powerful AI Agents with Minimal Code, Maximum Freedom.
Let Agents build Agents with Zero bloat, dependencies, or vendor lock-in 😮
BrainyFlow is a framework enabling Agentic Coding through powerful abstractions.
It provides a simple interface for building complex AI applications based on nested directed graphs with shared state. It enables both humans and AI assistants to collaborate effectively on designing and implementing AI systems.
Features
- Brain-Easy 🧠: Intuitive for both humans and AI assistants
- Minimalist Design ✨: Core abstractions in just (you heard it right!) 200 lines of code
- Freedom 🔓: Zero bloat, dependencies, or vendor lock-in
- Composable 🧩: Build complex systems from simple, reusable components
- Powerful 🦾: Supports everything you love—(Multi-)Agents, Workflow, RAG, and more
- Agentic-Coding 🤖: Designed for AI-assisted development
- Universal 🌈: Works with any LLM provider or API
- Polyglot 🌍:
Python and
Typescript are both supported
Documentation
Our documentation is inclusive, suitable for both biological and synthetic minds.
Start by selecting your condition - or perhaps the one you've been conditioned to believe:
>> I'm Carbon-Based 🐥 <<
>> I'm Silicon-Based 🤖 <<
Why Brainy Flow?
Current LLM frameworks are bloated... You actually only need 200 lines for a robust LLM Framework!
| Abstraction | App-Specific Wrappers | Vendor-Specific Wrappers | Lines | Size | |
|---|---|---|---|---|---|
| LangChain | Agent, Chain | Many (e.g., QA, Summarization) |
Many (e.g., OpenAI, Pinecone, etc.) |
405K | +166MB |
| CrewAI | Agent, Chain | Many (e.g., FileReadTool, SerperDevTool) |
Many (e.g., OpenAI, Anthropic, Pinecone, etc.) |
18K | +173MB |
| SmolAgent | Agent | Some (e.g., CodeAgent, VisitWebTool) |
Some (e.g., DuckDuckGo, Hugging Face, etc.) |
8K | +198MB |
| LangGraph | Agent, Graph | Some (e.g., Semantic Search) |
Some (e.g., PostgresStore, SqliteSaver, etc.) |
37K | +51MB |
| AutoGen | Agent | Some (e.g., Tool Agent, Chat Agent) |
Many [Optional] (e.g., OpenAI, Pinecone, etc.) |
7K (core-only) |
+26MB (core-only) |
| BrainyFlow |
Graph | None | None | 300 | few KB |
| BrainyFlow |
Graph | None | None | 200 | few KB |
How does BrainyFlow work?
The single file in Python or
Typescript capture the core abstraction of LLM frameworks: Graph!
- Node handles simple (LLM) tasks with a clear lifecycle (
prep→exec→post). - Flow connects nodes through Actions (labeled edges), orchestrating execution.
- Memory manages shared (
global) and isolated (local) state, enabling communication between nodes.
From there, it's easy to implement all popular design patterns:
- Agent autonomously makes decisions based on context.
- Workflow chains multiple tasks into sequential pipelines.
- RAG integrates data retrieval with generation.
- Map Reduce splits data tasks into Map and Reduce steps.
- Structured Output formats outputs consistently.
- Multi-Agents coordinate multiple agents.
Tutorials
| Name | Difficulty | Description |
|---|---|---|
| Chat | ☆☆☆ Dummy |
A basic chat bot with conversation history |
| RAG | ☆☆☆ Dummy |
A simple Retrieval-augmented Generation process |
| Workflow | ☆☆☆ Dummy |
A writing workflow that outlines, writes content, and applies styling |
| Map-Reduce | ☆☆☆ Dummy |
A resume qualification processor using map-reduce pattern for batch evaluation |
| Agent | ☆☆☆ Dummy |
A research agent that can search the web and answer questions |
| Streaming | ☆☆☆ Dummy |
A real-time LLM streaming demo with user interrupt capability |
| Multi-Agent | ★☆☆ Beginner |
A Taboo word game for asynchronous communication between two agents |
| Supervisor | ★☆☆ Beginner |
Research agent is getting unreliable... Let's build a supervision process |
| Parallel | ★☆☆ Beginner |
A parallel execution demo that shows 3x speedup |
| Thinking | ★☆☆ Beginner |
Solve complex reasoning problems through Chain-of-Thought |
| Memory | ★☆☆ Beginner |
A chat bot with short-term and long-term memory |
And many more available for all levels! Check them all out!
Quick Start
New to BrainyFlow? Check out our Getting Started guide to build your first flow in no time.
Ready to Build Self-Coding Apps?
Check out Agentic Coding Guidance, the fastest way to develop self-coding LLM projects with BrainyFlow!
Acknowledgement
We would like to extend our deepest gratitude to the creators and contributors of the PocketFlow framework, from which brainyFlow originated as a fork.
Liability Disclaimer
BrainyFlow is provided "as is" without any warranties or guarantees.
We do not take responsibility for how the generated output is used, including but not limited to its accuracy, legality, or any potential consequences arising from its use.
Sponsors
BrainyFlow runs on 200 lines of code and your generosity! 💰
Help us deliver more AI with less code (but maybe more caffeine)
☕
Your support helps keep it minimal, powerful, and dependency-free! 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brainyflow-1.0.0.tar.gz.
File metadata
- Download URL: brainyflow-1.0.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91ecf8f48daba2842c218f3efe5561254f3179bfbada876b08a308228d21c5ae
|
|
| MD5 |
9c6248b50ef94b475843d28f389604af
|
|
| BLAKE2b-256 |
9713ffa31e3f0bd4c419b3a9b7b15f3e7d305a207f7b5e539ab3c6f114e04dda
|
Provenance
The following attestation bundles were made for brainyflow-1.0.0.tar.gz:
Publisher:
python-publish.yml on zvictor/BrainyFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brainyflow-1.0.0.tar.gz -
Subject digest:
91ecf8f48daba2842c218f3efe5561254f3179bfbada876b08a308228d21c5ae - Sigstore transparency entry: 199726015
- Sigstore integration time:
-
Permalink:
zvictor/BrainyFlow@bdd1d481c66ab3083bb6b117809806c8a559a1f9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zvictor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bdd1d481c66ab3083bb6b117809806c8a559a1f9 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file brainyflow-1.0.0-py3-none-any.whl.
File metadata
- Download URL: brainyflow-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fd63ec68aae84f533062f0db6d3ea52f185d2bfa56fa5db4519af682771a111
|
|
| MD5 |
06f6741053e1f9471213b0276f75386f
|
|
| BLAKE2b-256 |
c6af8e05a86b3e7afc79ea0865d54c1698665ea34cd81c64725b87fb394a8bb8
|
Provenance
The following attestation bundles were made for brainyflow-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on zvictor/BrainyFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brainyflow-1.0.0-py3-none-any.whl -
Subject digest:
9fd63ec68aae84f533062f0db6d3ea52f185d2bfa56fa5db4519af682771a111 - Sigstore transparency entry: 199726017
- Sigstore integration time:
-
Permalink:
zvictor/BrainyFlow@bdd1d481c66ab3083bb6b117809806c8a559a1f9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zvictor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bdd1d481c66ab3083bb6b117809806c8a559a1f9 -
Trigger Event:
workflow_dispatch
-
Statement type: