docs: more information on run flow component (#6046)
* edit-tools * more-info-on-edit-tools * component-as-tool-metadata * Apply suggestions from code review Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com> * Fix formatting and clarity in agent tool documentation * clarity-on-tool-and-run-flow --------- Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>
This commit is contained in:
parent
39c4304543
commit
f7db8eecf2
5 changed files with 69 additions and 29 deletions
|
|
@ -9,7 +9,8 @@ The `AgentComponent` is a component for easily creating an AI agent capable of a
|
|||
|
||||
The component contains all of the elements you'll need for creating an agent. Instead of managing LLM models and providers, pick your model and enter your API key. Instead of connecting a **Prompt** component, enter instructions in the component's **Agent Instruction** fields.
|
||||
|
||||
<img src="/img/tool-calling-agent-component.png" alt="Prompt component" style={{display: 'block', margin: 'auto', width: 300}} />
|
||||
|
||||

|
||||
|
||||
Learn how to build a flow starting with the **Tool calling agent** component, and see how it can help you solve problems.
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ The default settings are acceptable for now, so this guide assumes you're using
|
|||
3. Add your **Open AI API Key** to the **Agent** component.
|
||||
4. Add **Chat input** and **Chat output** components to your flow, and connect them to the tool calling agent.
|
||||
|
||||
<img src="/img/tool-calling-agent-add-chat.png" alt="Chat with agent component" style={{display: 'block', margin: 'auto', width: 600}} />
|
||||

|
||||
|
||||
This basic flow enables you to chat with the agent with the **Playground** after you've connected some **Tools**.
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ This component is not in the **Tools** category, but the agent can still use it
|
|||
To enable **Tool Mode** on the component, click **Tool Mode**.
|
||||
The component's fields change dynamically based on the mode it's in.
|
||||
|
||||
<img src="/img/tool-calling-agent-add-tools.png" alt="Chat with agent component" style={{display: 'block', margin: 'auto', width: 600}} />
|
||||

|
||||
|
||||
## Solve problems with the agent
|
||||
|
||||
|
|
@ -53,7 +54,25 @@ Point **API Request** to an online rules document, tell your agent `You are a fu
|
|||
* You need to learn a new software language quickly.
|
||||
Point **API Request** to some docs, tell your agent `You are a knowledgeable software developer who uses the tools at your disposal`, and start learning.
|
||||
|
||||
See what problems you can solve with this flow. As your problem becomes more specialized, add a tool. For example, the [simple agent starter project](/starter-projects-simple-agent) adds a Python REPL component to solve math problems that are too challenging for the calculator.
|
||||
See what problems you can solve with this flow. As your problem becomes more specialized, add a tool. For example, the [math agent tutorial project](/tutorials-math-agent) adds a Python REPL component to solve math problems that are too challenging for the calculator.
|
||||
|
||||
### Edit a tool's metadata
|
||||
|
||||
To edit a tool's metadata, click the **Edit Tools** button in the tool to modify its `name` or `description` metadata. These fields help connected agents understand how to use the tool, without having to modify the agent's prompt instructions.
|
||||
|
||||
For example, the [URL](/components-data#url) component has three tools available when **Tool Mode** is enabled.
|
||||
|
||||
| Tool Name | Description |
|
||||
|-----------|-------------|
|
||||
| `URL-fetch_content` | Use this tool to fetch and retrieve raw content from a URL, including HTML and other structured data. The full response content is returned. |
|
||||
| `URL-fetch_content_text` | Use this tool to fetch and extract clean, readable text content from a webpage. Only plain text content is returned. |
|
||||
| `URL-as_dataframe` | Use this tool to fetch structured data from a URL and convert it into a tabular format. Data is returned in a structured DataFrame table format. |
|
||||
|
||||
A connected agent will have a clear idea of each tool's capabilities based on the `name` and `description` metadata. If you think the agent is using a tool incorrectly, edit a tool's metadata to help it understand the tool better.
|
||||
|
||||
Tool names and descriptions can be edited, but the default tool identifiers cannot be changed. If you want to change the tool identifier, create a custom component.
|
||||
|
||||
To see which tools the agent is using and how it's using them, ask the agent, `What tools are you using to answer my questions?`
|
||||
|
||||
## Use an agent as a tool
|
||||
|
||||
|
|
@ -70,7 +89,11 @@ Add an agent to your problem-solving flow that uses a different OpenAI model for
|
|||
The new agent will use `gpt-4o` for the larger tasks of scraping and searching information that requires large context windows.
|
||||
The problem-solving agent will now use this agent as a tool, with its unique LLM and toolset.
|
||||
|
||||
<img src="/img/tool-calling-agent-as-tool.png" alt="Chat with agent component" style={{display: 'block', margin: 'auto', width: 600}} />
|
||||

|
||||
|
||||
7. The new agent's metadata can be edited to help the problem-solving agent understand how to use it.
|
||||
Click **Edit Tools** to modify the new agent's `name` or `description` metadata so its usage is clear to the problem-solving agent.
|
||||
For example, the default tool name is `Agent`. Edit the name to `Agent-gpt-4o`, and edit the description to `Use the gpt-4o model for complex problem solving`. The problem-solving agent will understand that this is the `gpt-4o` agent, and will use it for tasks requiring a larger context window.
|
||||
|
||||
## Add custom components as tools {#components-as-tools}
|
||||
|
||||
|
|
@ -181,8 +204,9 @@ An agent can use flows that are saved in your workspace as tools with the [Run f
|
|||
1. To add a **Run flow** component, click and drag a **Run flow** component to your workspace.
|
||||
2. Select the flow you want the agent to use as a tool.
|
||||
3. Enable **Tool Mode** in the component.
|
||||
3. Connect the tool output to the agent's tools input.
|
||||
4. Ask the agent, `What tools are you using to answer my questions?`
|
||||
Your flow should be visible in the response.
|
||||
4. Connect the tool output to the agent's tools input.
|
||||
5. To enable tool mode, select a **Flow** in the **Run flow** component, and then click **Tool Mode**.
|
||||
6. Ask the agent, `What tools are you using to answer my questions?`
|
||||
Your flow should be visible in the response as a tool.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ Instead of developers having to create logical statements to direct every possib
|
|||
|
||||
To simplify the development of agents, Langflow created a custom [Tool calling agent](/components-agents#agent-component) component that simplifies configuration and lets developers focus on solving problems with agents.
|
||||
|
||||
<img src="/img/tool-calling-agent-component.png" alt="Prompt component" style={{display: 'block', margin: 'auto', width: 300}} />
|
||||

|
||||
|
||||
To get started, see [Create a problem solving agent](/agents-tool-calling-agent-component).
|
||||
|
|
@ -33,19 +33,23 @@ For more information on this component, see the [tool calling agent documentatio
|
|||
|
||||
### Inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
|----------------------|----------|-------------------------------------------------------------------------------------------------|
|
||||
| agent_llm | Dropdown | The provider of the language model that the agent will use to generate responses. |
|
||||
| system_prompt | String | Initial instructions and context provided to guide the agent's behavior. |
|
||||
| tools | List | List of tools available for the agent to use. |
|
||||
| input_value | String | The input task or question for the agent to process. |
|
||||
| add_current_date_tool| Boolean | If true, adds a tool to the agent that returns the current date. |
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| agent_llm | Dropdown | The provider of the language model that the agent will use to generate responses. Options include OpenAI and other providers, or Custom. |
|
||||
| system_prompt | String | System Prompt: Initial instructions and context provided to guide the agent's behavior. |
|
||||
| tools | List | List of tools available for the agent to use. |
|
||||
| input_value | String | The input task or question for the agent to process. |
|
||||
| add_current_date_tool | Boolean | If true, adds a tool to the agent that returns the current date. |
|
||||
| memory | Memory | Optional memory configuration for maintaining conversation history. |
|
||||
| max_iterations | Integer | Maximum number of iterations the agent can perform. |
|
||||
| handle_parsing_errors | Boolean | Whether to handle parsing errors during agent execution. |
|
||||
| verbose | Boolean | Enables verbose output for detailed logging. |
|
||||
|
||||
### Outputs
|
||||
|
||||
| Name | Type | Description |
|
||||
|----------|---------|-------------------------------------------------|
|
||||
| response | Message | The agent's response to the given input task. |
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| response | Message | The agent's response to the given input task. |
|
||||
|
||||
## CSV Agent
|
||||
|
||||
|
|
|
|||
|
|
@ -177,23 +177,35 @@ This component forwards the input message, unchanged.
|
|||
|
||||
## Run flow
|
||||
|
||||
This component allows you to run a specified flow with given inputs and tweaks.
|
||||
This component allows you to run any flow stored in your Langflow database without opening the flow editor.
|
||||
|
||||
The RunFlowComponent executes a specified flow within a larger workflow. It provides the ability to run a flow with custom inputs and apply tweaks to modify its behavior.
|
||||
The Run Flow component can also be used as a tool when connected to an [Agent](/components-agents). The `name` and `description` metadata that the Agent uses to register the tool are created automatically.
|
||||
|
||||
When you select a flow, the component fetches the flow's graph structure and uses it to generate the inputs and outputs for the Run Flow component.
|
||||
|
||||
To use the Run Flow component as a tool, do the following:
|
||||
1. Add the **Run Flow** component to the [Simple Agent](/starter-projects-simple-agent) flow.
|
||||
2. In the **Flow Name** menu, select the sub-flow you want to run.
|
||||
The appearance of the **Run Flow** component changes to reflect the inputs and outputs of the selected flow.
|
||||
3. On the **Run Flow** component, enable **Tool Mode**.
|
||||
4. Connect the **Run Flow** component to the **Toolset** input of the Agent.
|
||||
Your flow should now look like this:
|
||||

|
||||
5. Run the flow. The Agent uses the Run Flow component as a tool to run the selected sub-flow.
|
||||
|
||||
### Inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
|-------------|--------------|-------------------------------------------------------|
|
||||
| input_value | String | The input value for the flow to process. |
|
||||
| flow_name | Dropdown | The name of the flow to run. |
|
||||
| tweaks | Nested Dict | Tweaks to apply to the flow. |
|
||||
| Name | Type | Description |
|
||||
|-------------------|----------|----------------------------------------------------------------|
|
||||
| flow_name_selected| Dropdown | The name of the flow to run. |
|
||||
| flow_tweak_data | Dict | Dictionary of tweaks to customize the flow's behavior. |
|
||||
| dynamic inputs | Various | Additional inputs that are generated based on the selected flow. |
|
||||
|
||||
### Outputs
|
||||
|
||||
| Name | Type | Description |
|
||||
|-------------|-------------|------------------------------------------------|
|
||||
| run_outputs | List[Data] | The results generated from running the flow. |
|
||||
| Name | Type | Description |
|
||||
|--------------|-------------|---------------------------------------------------------------|
|
||||
| run_outputs | A `List` of types `Data`, `Message,` or `DataFrame` | All outputs are generated from running the flow. |
|
||||
|
||||
## Sub flow
|
||||
|
||||
|
|
|
|||
BIN
docs/static/img/component-run-flow.png
vendored
Normal file
BIN
docs/static/img/component-run-flow.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 347 KiB |
Loading…
Add table
Add a link
Reference in a new issue