This article explains how to use an Agent as a Node within AgentRunner. This powerful feature allows you to reuse existing agents as components within other agents, promoting modularity, readability, and efficiency in your agent development workflow. By encapsulating complex processes into reusable nodes, you can simplify your agent designs and streamline your development process. This is particularly useful when dealing with repetitive tasks or intricate logic that can be isolated and reused across multiple agents.
Understanding Agent as a Node
The Agent as a Node feature in AgentRunner allows you to embed an entire agent you've built as a single node within another agent's flow. This enables you to create modular and reusable components, making your agent designs more manageable and efficient. The concept is similar to using functions or subroutines in programming, where you encapsulate a specific piece of logic into a reusable unit. This approach not only simplifies the main agent's flow but also promotes code reuse and maintainability. Using Agent as a Node is a great way to make the display more readable whenever you need the same process in your agent repeatedly or if you have a very complicated process.
Key Concepts
Inputs: The public inputs of the original agent become the inputs of the node. The names of these inputs remain consistent with the original agent's input node names.
Outputs: The output(s) of the node will be the same as the original agent’s final outputs.
Naming: The initial name of the node will be the name you gave to the flow you want to use as a node. You can rename the node to something more descriptive. It is worth using a name that describes the node’s function. There is no character limit in renaming.
Agent Tab: In the node editor, in the control tab, you can change between the agent versions in the node editor with the “Agent Tab” dropdown.
Benefits of Using Agent as a Node
Modularity: Break down complex agents into smaller, manageable components.
Reusability: Reuse existing agents in multiple flows, saving time and effort.
Readability: Improve the clarity and understandability of your agent designs.
Maintainability: Easily update and maintain reusable components without affecting the entire agent.
Efficiency: Streamline your development process by leveraging pre-built and tested agents.
Simplified Display: This is a great way to make the display more readable whenever you need the same process in your agent repeatedly or if you have a very complicated process.
Implementing Agent as a Node
To effectively use an agent as a node, follow these steps. Ensure you have the necessary permissions (Owner or Developer role) and that the agent you intend to use as a node is located in the same folder as the agent you are working in.
Step-by-Step Guide
Locate the Target Agent: Ensure the agent you want to use as a node is in the same folder as the agent you’re currently working on. This is a prerequisite for the Agent as a Node feature to function correctly.
Insert the Agent as a Node: In your current agent's flow, add the agent's node.
Configure the Node:
Rename the Node: Give the node a descriptive name that reflects its function within the flow.
Select Agent Version: Use the "Agent Tab" dropdown in the node editor (specifically, in the control tab) to choose the specific version of the agent you want to use. This allows you to manage updates and ensure compatibility. You can switch between the versions of the original agent on the node in the node editor.
Connect Inputs and Outputs: Connect the inputs of the node to the appropriate data sources within your current agent. Similarly, connect the outputs of the node to the next steps in your flow. The inputs of the node will be the public inputs of your original agent. The inputs’ names will be the same as you name your public input nodes. The agent as a Node can have a single or multiple outputs too. The output or outputs will be named the same as the original agent’s outputs.
Test the Node: You can test your node individually.
Error Handling: If the node agent fails, the error is displayed on the agent you are using currently. The error is displayed on the agent you are using currently.
Monitoring Node Performance
AgentRunner provides tools to monitor the performance and execution history of your Agent as a Node. The history tab can be accessed in the node editor, where you can inspect the history of the runs of the node. It contains the run time, the person who ran it, and a button to see the details and results of each run.
Run Time: Displays the duration of each execution of the node.
User: Identifies the user who initiated the run.
Details Button: Clicking this button shows the inputs and outputs of the node for that specific run. The inputs and the output of the node.
Additional Considerations and Best Practices
When working with Agents as Nodes, keep the following points in mind to ensure optimal performance and maintainability:
Version Control and Updates
When the original agent that's used as a node is updated, you can switch between the versions of the original agent on the node in the node editor. This ensures that you have control over when and how updates are applied to your agent flows.
Error Handling
If an Agent used as a Node is deleted or becomes unavailable, the node will have an error, and you’ll have to replace it.
Security
There are no specific security considerations when using Agents as Nodes regarding data privacy and access control. The prompt of the other node isn’t going to be shown.
Performance Impact
Using Agents as Nodes does not significantly impact performance compared to having all the logic within a single agent. No.
Agent Types and Restrictions
There are no restrictions on the types of Agents that can be used as nodes; any agent can be used. This flexibility allows you to integrate a wide range of functionalities and integrations into your agent flows.
Overall Agent's Version Control and Deployment
Using an Agent as a Node does not affect the overall agent's version control or deployment process in any way.