
Node Details
-
Name:
xmlAgent
- Type: XMLAgent
- Category: [[Agents]]
- Version: 2.0
Parameters
-
Tools (Required)
- Type: Tool[]
- Description: A list of tools that the agent can use to perform tasks or gather information.
-
Memory (Required)
- Type: BaseChatMemory
- Description: The memory component used to store and retrieve conversation history.
-
Chat Model (Required)
- Type: BaseChatModel
- Description: The chat model used for generating responses and making decisions. Should be capable of XML-structured output.
-
System Message (Optional)
- Type: string
- Default: A predefined message instructing the agent on XML usage and tool execution.
- Description: Custom instructions for the agent’s behavior and XML formatting.
- Additional Params: true
-
Input Moderation (Optional)
- Type: Moderation[]
- Description: Moderation tools to detect and prevent harmful input.
-
Max Iterations (Optional)
- Type: number
- Description: The maximum number of iterations the agent will perform for a single input.
- Additional Params: true
Input
- A string containing the user’s message or query.
Output
-
An object containing:
-
text
: The agent’s response to the user’s input -
sourceDocuments
: (optional) Any source documents used in formulating the response -
usedTools
: (optional) A list of tools used by the agent during processing
-
How It Works
- The agent is initialized with the provided tools, chat model, memory, and optional parameters.
- It receives a user input, which is first checked by any specified moderation tools.
-
The agent processes the input using the following steps:
- Analyzes the query and determines if tool use is necessary
- If needed, selects and executes tools using XML-structured commands
- Reasons about the tool outputs and formulates a response
- Generates the final answer in XML format
- The XML-structured response is parsed and returned along with any used tools or source documents.
- The conversation history is updated in the memory for future context.
Use Cases
- Complex query resolution requiring structured reasoning
- Task execution with clear step-by-step breakdowns
- Data analysis and reporting with structured output
- API interaction and structured data manipulation
- Scenarios requiring clear separation of reasoning steps and final answers
Special Features
- XML-Structured Reasoning: Uses XML format for clear, structured thought processes and tool usage.
- Tool Integration: Can use a variety of tools, calling them with XML-formatted inputs.
- Memory Management: Maintains conversation history for contextual understanding.
- Moderation: Can implement input moderation to ensure safe interactions.
- Flexible Iteration Control: Allows setting a maximum number of reasoning-action cycles.
Notes
- The agent is optimized for language models that excel at XML formatting, such as Anthropic’s Claude.
- The system message can be customized to tailor the agent’s behavior and XML usage patterns.
- XML structure allows for clear separation of thought processes, tool usage, and final answers.
-
The agent uses specific XML tags like
<tool>
,<tool_input>
,<observation>
, and<final_answer>
for structured interactions. - This agent is particularly effective for tasks that benefit from step-by-step reasoning and clear output structure.