From d06fe20a018f0c5c0ee0099cc1024e6013c23b60 Mon Sep 17 00:00:00 2001 From: zachary62 Date: Thu, 13 Mar 2025 19:03:25 -0400 Subject: [PATCH] update agent --- docs/design_pattern/agent.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/design_pattern/agent.md b/docs/design_pattern/agent.md index a931abe..2a5b518 100644 --- a/docs/design_pattern/agent.md +++ b/docs/design_pattern/agent.md @@ -11,19 +11,19 @@ Agent is a powerful design pattern in which nodes can take dynamic actions based The core of building **high-performance** and **reliable** agents boils down to: -1. **Context Management:** Provide *relevant, minimal context* so that agents can understand the problem. For example, rather than including an entire chat history or entire files, use a [Workflow](./workflow.md) that includes only the most relevant information. This is because, even if LLMs have larger contexts, they can exhibit the ["lost in the middle"](https://arxiv.org/abs/2307.03172) phenomenon, focusing primarily on the middle portion of the input. +1. **Context Management:** Provide *relevant, minimal context.* For example, rather than including an entire chat history, use [RAG](./rag.md) to retrieve only the most relevant parts. Even if LLMs have larger context windows, they can exhibit the ["lost in the middle"](https://arxiv.org/abs/2307.03172), often focusing on the start and end portions of the context while disregarding the middle. -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., with a search string) or be programmable (e.g., through SQL queries). +2. **Action Space:** Define *a well-structured and unambiguous* set of actions. Avoid overlapping actions like `read_databases` and `read_csvs`. Instead, unify data sources (e.g., import CSVs into a database) and design a single action. That action can be parameterized (e.g., a search string) or made programmable (e.g., SQL queries).
- +
-To implement an agent: +Agent Implementation Steps: -1. Implement the nodes that provide context and perform actions. -2. Connect these nodes with an agent node, using [branching](../core_abstraction/flow.md) to direct the flow to other action nodes. -3. Implement the agent node, with an example prompt template that looks like this: +1. **Context and Action:** Implement nodes that supply context and perform actions. +2. **Branching:** Connect action nodes with an agent node, using [branching](../core_abstraction/flow.md) to direct the flow to other action nodes, and potentially loop back. +3. **Agent Node:** Provide a prompt—for example: ```python """