From 4082eee79fdb769a3d242f0a79ad5d9b46619f3d Mon Sep 17 00:00:00 2001 From: Zachary Huang <33015448+zachary62@users.noreply.github.com> Date: Fri, 14 Mar 2025 22:03:05 -0400 Subject: [PATCH 1/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ba65d4..1b09d9c 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Current LLM frameworks are bloated... You only need 100 lines for LLM Framework! -- Want to learn **Agent Coding**? Check out [my YouTube](https://www.youtube.com/@ZacharyLLM?sub_confirmation=1)! +- Want to learn **Agent Coding**? Check out [my YouTube](https://www.youtube.com/@ZacharyLLM?sub_confirmation=1)! Read this [Guide](https://the-pocket.github.io/PocketFlow/guide.html)! - Want to build your own LLM App? Start with [this template](https://github.com/The-Pocket/PocketFlow-Template-Python)! From e52d2057690594c6e94cae0ebb8ee339f23325dc Mon Sep 17 00:00:00 2001 From: Zachary Huang <33015448+zachary62@users.noreply.github.com> Date: Sat, 15 Mar 2025 00:48:07 -0400 Subject: [PATCH 2/7] Update guide.md --- docs/guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 2187201..8de0f2d 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -26,7 +26,7 @@ Agentic Coding should be a collaboration between Human System Design and Agent I - suitable for routine tasks that require common sense (e.g., filling out forms, replying to emails). - suitable for creative tasks where all inputs are provided (e.g., building slides, writing SQL). - **NOT** suitable for tasks that are highly ambiguous and require complex info (e.g., building a startup). - - > **If a human can’t solve it, an LLM can’t automate it!** Before building an LLM system, thoroughly understand the problem by manually solving example inputs to develop intuition. + - > **If Humans can’t specify it, AI Agents can’t automate it!** Before building an LLM system, thoroughly understand the problem by manually solving example inputs to develop intuition. {: .best-practice } @@ -109,4 +109,4 @@ my_project/ - It’s recommended to dedicate one Python file to each API call, for example `call_llm.py` or `search_web.py`. - Each file should also include a `main()` function to try that API call - **`flow.py`**: Implements the system's flow, starting with node definitions followed by the overall structure. -- **`main.py`**: Serves as the project’s entry point. \ No newline at end of file +- **`main.py`**: Serves as the project’s entry point. From 4a8ad825a5087e595aa8a3acddc2aff667912059 Mon Sep 17 00:00:00 2001 From: Zachary Huang <33015448+zachary62@users.noreply.github.com> Date: Sat, 15 Mar 2025 02:00:27 -0400 Subject: [PATCH 3/7] Update communication.md --- docs/core_abstraction/communication.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/core_abstraction/communication.md b/docs/core_abstraction/communication.md index 85c0276..6288c9c 100644 --- a/docs/core_abstraction/communication.md +++ b/docs/core_abstraction/communication.md @@ -7,9 +7,9 @@ nav_order: 3 # Communication -Nodes and Flows **communicate** in two ways: +Nodes and Flows **communicate** in 2 ways: -1. **Shared Store (recommended)** +1. **Shared Store (for almost all the cases)** - A global data structure (often an in-mem dict) that all nodes can read and write by `prep()` and `post()`. - Great for data results, large content, or anything multiple nodes need. @@ -21,7 +21,7 @@ Nodes and Flows **communicate** in two ways: If you know memory management, think of the **Shared Store** like a **heap** (shared by all function calls), and **Params** like a **stack** (assigned by the caller). -> Use `Shared Store` for almost all cases. It's flexible and easy to manage. It separates *Data Schema* from *Compute Logic*, making the code easier to maintain. `Params` is more a syntax sugar for [Batch](./batch.md). +> **Separation of Concerns:** Use `Shared Store` for almost all cases to separate *Data Schema* from *Compute Logic*! This approach is both flexible and easy to manage, resulting in more maintainable code. `Params` is more a syntax sugar for [Batch](./batch.md). {: .best-practice } --- @@ -123,4 +123,4 @@ flow = Flow(start=node) # 5) Set Flow params (overwrites node params) flow.set_params({"filename": "doc2.txt"}) flow.run(shared) # The node summarizes doc2, not doc1 -``` \ No newline at end of file +``` From 6a3412b20712f7e1cf11a276d71e0822792745a4 Mon Sep 17 00:00:00 2001 From: Zachary Huang <33015448+zachary62@users.noreply.github.com> Date: Sat, 15 Mar 2025 02:07:14 -0400 Subject: [PATCH 4/7] Update communication.md --- docs/core_abstraction/communication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core_abstraction/communication.md b/docs/core_abstraction/communication.md index 6288c9c..d86ac9f 100644 --- a/docs/core_abstraction/communication.md +++ b/docs/core_abstraction/communication.md @@ -11,7 +11,7 @@ Nodes and Flows **communicate** in 2 ways: 1. **Shared Store (for almost all the cases)** - - A global data structure (often an in-mem dict) that all nodes can read and write by `prep()` and `post()`. + - A global data structure (often an in-mem dict) that all nodes can read ( `prep()`) and write (`post()`). - Great for data results, large content, or anything multiple nodes need. - You shall design the data structure and populate it ahead. From a9c379252b0ae001705224d4bdbb9b1e14717e8e Mon Sep 17 00:00:00 2001 From: Zachary Huang <33015448+zachary62@users.noreply.github.com> Date: Sat, 15 Mar 2025 15:23:41 -0400 Subject: [PATCH 5/7] Update communication.md --- docs/core_abstraction/communication.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core_abstraction/communication.md b/docs/core_abstraction/communication.md index d86ac9f..9f3c785 100644 --- a/docs/core_abstraction/communication.md +++ b/docs/core_abstraction/communication.md @@ -14,6 +14,9 @@ Nodes and Flows **communicate** in 2 ways: - A global data structure (often an in-mem dict) that all nodes can read ( `prep()`) and write (`post()`). - Great for data results, large content, or anything multiple nodes need. - You shall design the data structure and populate it ahead. + + - > **Separation of Concerns:** Use `Shared Store` for almost all cases to separate *Data Schema* from *Compute Logic*! This approach is both flexible and easy to manage, resulting in more maintainable code. `Params` is more a syntax sugar for [Batch](./batch.md). + {: .best-practice } 2. **Params (only for [Batch](./batch.md))** - Each node has a local, ephemeral `params` dict passed in by the **parent Flow**, used as an identifier for tasks. Parameter keys and values shall be **immutable**. @@ -21,9 +24,6 @@ Nodes and Flows **communicate** in 2 ways: If you know memory management, think of the **Shared Store** like a **heap** (shared by all function calls), and **Params** like a **stack** (assigned by the caller). -> **Separation of Concerns:** Use `Shared Store` for almost all cases to separate *Data Schema* from *Compute Logic*! This approach is both flexible and easy to manage, resulting in more maintainable code. `Params` is more a syntax sugar for [Batch](./batch.md). -{: .best-practice } - --- ## 1. Shared Store From ccf776bc0cb7a7b1ab0a5644c0da1ebaf6a9d956 Mon Sep 17 00:00:00 2001 From: Zachary Huang <33015448+zachary62@users.noreply.github.com> Date: Sun, 16 Mar 2025 01:01:34 -0400 Subject: [PATCH 6/7] Update guide.md --- docs/guide.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 8de0f2d..9cc1a06 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -68,11 +68,12 @@ Agentic Coding should be a collaboration between Human System Design and Agent I 5. **Implementation**: Implement the initial nodes and flows based on the design. + - 🎉 If you’ve reached this step, humans have finished the design. Now *Agentic Coding* begins! - **“Keep it simple, stupid!”** Avoid complex features and full-scale type checking. - **FAIL FAST**! Avoid `try` logic so you can quickly identify any weak points in the system. - Add logging throughout the code to facilitate debugging. -6. **Optimization**: +7. **Optimization**: - **Use Intuition**: For a quick initial evaluation, human intuition is often a good start. - **Redesign Flow (Back to Step 3)**: Consider breaking down tasks further, introducing agentic decisions, or better managing input contexts. - If your flow design is already solid, move on to micro-optimizations: @@ -84,7 +85,7 @@ Agentic Coding should be a collaboration between Human System Design and Agent I >
{: .best-practice } -7. **Reliability** +8. **Reliability** - **Node Retries**: Add checks in the node `exec` to ensure outputs meet requirements, and consider increasing `max_retries` and `wait` times. - **Logging and Visualization**: Maintain logs of all attempts and visualize node results for easier debugging. - **Self-Evaluation**: Add a separate node (powered by an LLM) to review outputs when results are uncertain. From e1b0aefd6a376d747d860e660eaf73e24f9be8ca Mon Sep 17 00:00:00 2001 From: Zachary Huang <33015448+zachary62@users.noreply.github.com> Date: Sun, 16 Mar 2025 01:49:09 -0400 Subject: [PATCH 7/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1b09d9c..a089038 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ Current LLM frameworks are bloated... You only need 100 lines for LLM Framework! | App Name | Difficulty | Topics | Human Design | Agent Code | | :-------------: | :-------------: | :---------------------: | :---: | :---: | +| [Build Cursor with Cursor](https://github.com/The-Pocket/Tutorial-Cursor)
We’ll reach the singularity soon ... | ★★★
*Advanced* | [Agent](https://the-pocket.github.io/PocketFlow/design_pattern/agent.html) | [Design Doc](https://github.com/The-Pocket/Tutorial-Cursor/blob/main/docs/design.md) | [Flow Code](https://github.com/The-Pocket/Tutorial-Cursor/blob/main/flow.py) | [Ask AI Paul Graham](https://github.com/The-Pocket/Tutorial-YC-Partner)
Ask AI Paul Graham, in case you don't get in | ★★☆
*Medium* | [RAG](https://the-pocket.github.io/PocketFlow/design_pattern/rag.html)
[Map Reduce](https://the-pocket.github.io/PocketFlow/design_pattern/mapreduce.html)
[TTS](https://the-pocket.github.io/PocketFlow/utility_function/text_to_speech.html) | [Design Doc](https://github.com/The-Pocket/Tutorial-AI-Paul-Graham/blob/main/docs/design.md) | [Flow Code](https://github.com/The-Pocket/Tutorial-AI-Paul-Graham/blob/main/flow.py) | [Youtube Summarizer](https://github.com/The-Pocket/Tutorial-Youtube-Made-Simple)
Explain YouTube Videos to you like you're 5 | ★☆☆
*Beginner* | [Map Reduce](https://the-pocket.github.io/PocketFlow/design_pattern/mapreduce.html) | [Design Doc](https://github.com/The-Pocket/Tutorial-Youtube-Made-Simple/blob/main/docs/design.md) | [Flow Code](https://github.com/The-Pocket/Tutorial-Youtube-Made-Simple/blob/main/flow.py) | [Cold Opener Generator](https://github.com/The-Pocket/Tutorial-Cold-Email-Personalization)
Instant icebreakers that turn cold leads hot | ★☆☆
*Beginner* | [Map Reduce](https://the-pocket.github.io/PocketFlow/design_pattern/mapreduce.html)
[Web Search](https://the-pocket.github.io/PocketFlow/utility_function/websearch.html) | [Design Doc](https://github.com/The-Pocket/Tutorial-Cold-Email-Personalization/blob/master/docs/design.md) | [Flow Code](https://github.com/The-Pocket/Tutorial-Cold-Email-Personalization/blob/master/flow.py)