diff --git a/README.md b/README.md index 6cf621e..0c4d536 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Docs](https://img.shields.io/badge/docs-latest-blue)](https://the-pocket.github.io/PocketFlow/)
- +

@@ -67,7 +67,7 @@ From there, it’s easy to implement popular design patterns like ([Multi-](http
- +

diff --git a/assets/claude_project.gif b/assets/claude_project.gif deleted file mode 100644 index 4431549..0000000 Binary files a/assets/claude_project.gif and /dev/null differ diff --git a/assets/paradigm.png b/assets/design.png similarity index 100% rename from assets/paradigm.png rename to assets/design.png diff --git a/assets/gpt_store.gif b/assets/gpt_store.gif deleted file mode 100644 index 4427c4f..0000000 Binary files a/assets/gpt_store.gif and /dev/null differ diff --git a/assets/minillmflow.jpg b/assets/meme.jpg similarity index 100% rename from assets/minillmflow.jpg rename to assets/meme.jpg diff --git a/assets/youtube.png b/assets/youtube.png index 0c50a07..97ca28b 100644 Binary files a/assets/youtube.png and b/assets/youtube.png differ diff --git a/docs/agent.md b/docs/agent.md index e3d2b85..b376336 100644 --- a/docs/agent.md +++ b/docs/agent.md @@ -7,10 +7,24 @@ nav_order: 6 # Agent -For many tasks, we need agents that take dynamic and recursive actions based on the inputs they receive. -You can create these agents as **Nodes** connected by *Actions* in a directed graph using [Flow](./flow.md). +Agent is a powerful design pattern, where node can take dynamic actions based on the context it receives. +To express an agent, create a Node (the agent) with [branching](./flow.md) to other nodes (Actions). +### Best Practice + +The core of build **performant** and **reliable** agents boils down to: + +1. **Context Management** + Provide *clear, relevant context* so agents can understand the problem. + E.g., Rather than dumping an entire chat history or entire files, use a [Workflow](./decomp.md) that filters out and includes only the most relevant information. + +2. **Action Space** + Define *a well-structured, unambiguous, and easy-to-use* set of actions. + For instance, avoid creating overlapping actions like `read_databases` and `read_csvs`. + Instead, unify data sources (e.g., move CSVs into a database) and design a single action. + The action can be parameterized (e.g., string for search) or programmable (e.g., SQL queries). + ### Example: Search Agent This agent: diff --git a/docs/decomp.md b/docs/decomp.md index 879b756..b98087d 100644 --- a/docs/decomp.md +++ b/docs/decomp.md @@ -5,9 +5,19 @@ parent: "Design" nav_order: 2 --- -# Task Decomposition +# Workflow -Many real-world tasks are too complex for one LLM call. The solution is to decompose them into multiple calls as a [Flow](./flow.md) of Nodes. +Many real-world tasks are too complex for one LLM call. The solution is to decompose them into a [chain](./flow.md) of multiple Nodes. + +### Best Practice + +You don't want to make each task **too coarse**, because it may be *too complex for one LLM call*. + +You don't want to make each task **too granular**, because then *the LLM call doesn't have enough context* and results are *not consistent across nodes*. + +You usually need multiple *iterations* to find the *sweet spot*. + +If the task has too many *edge cases*, consider using [Agents](./agent.md). ### Example: Article Writing diff --git a/docs/index.md b/docs/index.md index c3b1cbe..f9f4f3e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -51,7 +51,7 @@ We model the LLM workflow as a **Nested Directed Graph**: ## Design Patterns - [Structured Output](./structure.md) -- [Task Decomposition](./decomp.md) +- [Workflow](./decomp.md) - [Map Reduce](./mapreduce.md) - [RAG](./rag.md) - [Chat Memory](./memory.md) diff --git a/docs/multi_agent.md b/docs/multi_agent.md index 4358e0e..86c469e 100644 --- a/docs/multi_agent.md +++ b/docs/multi_agent.md @@ -10,6 +10,9 @@ nav_order: 7 Multiple [Agents](./flow.md) can work together by handling subtasks and communicating the progress. Communication between agents is typically implemented using message queues in shared storage. +### Best Practice + +Most of time, you don't need Multi-Agents. Start with a simple solution first. ### Example Agent Communication: Message Queue