XML Agent
⚠️ DEPRECATION WARNING
This component is deprecated and will be removed in a future version of Nappai. Please migrate to the recommended alternative components.
The XML Agent acts as a smart coordinator for your AI workflows. It connects a Language Model to various external tools, using a strict set of XML-style tags to guide the AI’s thinking process. Instead of guessing, the agent follows a clear “think, act, and verify” loop until it gathers enough information to provide a final answer. This ensures reliable tool usage and structured responses for your automation tasks.
How it Works
The agent works in a continuous loop to solve your request. First, it reads your instructions and the available tools. Then, it uses the connected Language Model to analyze the task and decide if a tool is needed. If it does, it formats the tool request using specific XML tags, runs the tool, and reviews the result. This process repeats until the AI has collected all necessary information, after which it formats the final result inside a <final_answer> tag. All steps are tracked in the background, allowing you to monitor progress without interrupting the workflow.
Inputs
Input Fields
The following fields are available to configure this component:
- Model: The language model that powers the agent’s reasoning and response generation. (Required)
- Tools: External actions or functions the agent can use to gather information or perform tasks.
- Disable Streaming: Controls whether the agent’s responses update in real-time or wait until completion.
- Handle Parse Errors: Automatically manages and recovers from formatting mistakes during tool execution.
- Input: The main task, question, or data you want the agent to process.
- Max Iterations: Sets the maximum number of reasoning and tool-use steps the agent will take before stopping.
- Prompt: Custom instructions that define how the agent should format its thinking and tool usage. (Hidden by default)
- Verbose: Enables detailed logging of the agent’s internal steps for debugging purposes.
Outputs
This component returns two main outputs that you can connect to downstream nodes in your dashboard:
- Agent: The operational instance that processes your input and coordinates tool usage. It acts as a dynamic processor that executes the agent’s logic step-by-step.
- Response: The final text or structured data generated by the agent, containing the completed answer or task result. You can map this output to other nodes to display, store, or further process the information.
Output Data Example (JSON)json
{ “final_answer”: “The requested sales data has been successfully retrieved and summarized.”, “tool_used”: “query_database”, “status”: “completed”, “iterations_used”: 3, “message”: “Successfully processed using XML reasoning chain.” }
Connectivity
Typically, this node connects to:
- Language Model Nodes (via the Model input): Provides the reasoning engine needed to understand instructions and decide when to act.
- Tool Nodes (via the Tools input): Supplies external actions like API calls, database queries, or file operations that the agent can call.
- Output/Display Nodes (via the Response output): Receives the structured final answer to show to users, save to a database, or pass to subsequent workflow steps.
- Logging/Monitoring Nodes (via the Agent output): Tracks execution steps, errors, and tool usage for debugging and audit purposes.
This connection pattern ensures the agent acts as a reliable bridge between your data sources and the final user interface.
Usage Example
Suppose you want to automate a customer support task where agents need to look up order details and generate a reply. Connect a Language Model to the Model input and a Database Search Tool to the Tools input. Place a customer inquiry in the Input field. The XML Agent will automatically decide whether to use the search tool, read the result, and finally output a clear, structured response containing the answer. You can then connect the Response output to a Text Formatter or Email Node to deliver the final result to your team or customers.
Important Notes
🔒 Tool execution may expose sensitive data 🔴 Any tool connected to the agent can be executed. Verify that the tools do not inadvertently reveal or alter sensitive information.
⚠️ Strict XML formatting required 🟡
The agent expects all responses to be wrapped in specific XML tags (
⚠️ Prompt customization is hidden by default 🟢 The prompt template is not visible in the main interface. If you want to modify how the agent prompts the LLM, you must enable the hidden field.
📋 Provide a Language Model 🟡 The component requires you to supply a valid language model. Without an LLM input, the agent cannot generate responses.
📋 Connect at least one Tool 🟡 The XML Agent will only function if you attach one or more tools. If no tools are provided, the agent cannot perform any actions.
ℹ️ Agent outputs XML-wrapped responses 🟢 The assistant will return replies in XML format. If you expect plain text, you will need to extract the content from the tags or add a post‑processor.
💡 Use clear, concise prompts 🟢 Keep your questions simple and to the point. Complex queries can confuse the agent and lead to incorrect tool usage.
Tips and Best Practices
- Always assign a specific LLM to ensure accurate reasoning and reliable tool selection.
- Keep tool descriptions clear and specific so the agent knows exactly when to use them.
- Monitor the agent’s iteration count to prevent infinite loops or excessive API usage.
- Use the hidden Prompt field only if you need advanced control over the agent’s decision-making rules.
- Test tool connections in a safe environment before deploying them in production workflows.
Security Considerations
Since this component executes tools programmatically, ensure that connected tools are restricted to safe, non-destructive operations. Avoid linking tools that handle sensitive personal data without proper access controls or sandboxing. Always verify that the XML formatting rules prevent unintended command injection, and regularly audit tool permissions within the Nappai dashboard to maintain data security.