Skip to content

OpenAIToolsAgent

⚠️ DEPRECATION WARNING

This component is deprecated and will be removed in a future version of Nappai. Please migrate to the recommended alternative components.

This component acts as a smart assistant within your Nappai workflow. It connects an OpenAI language model to a set of external tools and conversation memory. When you give it a task or question, it automatically figures out what tools to use, plans how to complete the task, and generates a clear response. It keeps track of the conversation history so your workflow flows smoothly from one step to the next.

How it Works

This component works like a digital brain that connects to OpenAI’s servers. You provide a question or task, and the component uses an AI model to understand it. It then checks the tools you have connected to it (like a calculator, a database, or a web search) and decides which ones are needed. It automatically calls those tools, reads the results, and combines them to give you a final answer. Throughout this process, it remembers previous messages in your conversation so it can answer follow-up questions accurately.

Connection & Credentials

This component requires configuring a credential in the Nappai panel before interacting with the external service:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the type specified for this component and fill in the required fields (API Keys, tokens, etc.).
  3. In your workflow, select the saved credential in the Credential input field of this node.

Inputs

Chat History: Stores previous conversation turns to keep the agent’s responses consistent and context-aware. Model: The OpenAI language model that powers the agent’s reasoning, text generation, and tool selection. Tools: External functions or APIs the agent can use to perform specific actions like searching, calculating, or fetching data. Disable Streaming: When enabled, the agent waits to finish its entire thought process before showing the result. Handle Parse Errors: Automatically fixes or manages formatting mistakes in the agent’s output to prevent workflow breaks. Input: The main message, question, or task you want the agent to process. Max Iterations: Sets the maximum number of steps the agent can take to complete a complex task before stopping. System Prompt: Background instructions that define how the agent should behave, its tone, and its operational rules. Prompt: The template for the user’s question or task. This field must include the {input} placeholder to work correctly. Verbose: When turned on, shows detailed logs of the agent’s internal steps for easier debugging and transparency.

Outputs

  • Agent: The executable workflow node that connects the prompt, tools, and model. Type: AgentExecutor (método: build_agent)
  • Response: The final text or structured answer generated by the agent. Type: Message (método: message_response)

Output Data Example (JSON)json

{ “content”: “Based on the data retrieved, the total revenue for Q3 is $1.2M. The primary drivers were enterprise subscriptions and new partnerships.”, “metadata”: { “status”: “completed”, “tokens_used”: 145, “tools_called”: [“calculate_revenue”, “search_database”], “conversation_turn”: 3 } }

Connectivity

This component typically connects to:

  • Previous Nodes: The Input field connects to text outputs from prompts, previous agents, or user messages to start the conversation flow.
  • Tool Libraries: The Tools field connects to external tool nodes (like calculators, API fetchers, or database readers) that the agent can call automatically.
  • Output Nodes: The Response output usually connects to Chat Output nodes for dashboard display, or Save To File nodes to store the AI’s final answer for reporting.
  • Chat History: Links to memory nodes or previous conversation nodes to maintain context across multiple workflow steps.

Usage Example

Imagine you are building a customer support workflow in Nappai. You drag the OpenAIToolsAgent into your canvas.

  1. In the Model field, you select your preferred OpenAI model.
  2. In the Tools field, you connect a “Database Search” tool and a “Calculator” tool.
  3. In the Prompt field, you write: Answer the following question using the available tools. Only give the final answer: {input}
  4. You connect a “User Message” node to the Input field. When a user types “How many orders were placed in October?”, the agent automatically checks the database, calculates the total, and outputs a clear answer. If they follow up with “What was the average order value?”, the agent uses the Chat History to remember the first question and provides a complete answer.

Tips and Best Practices

  • Keep prompts short and direct to help the AI make faster, more accurate decisions.
  • Use streaming by default to see results appear in real-time as the agent works.
  • Only connect tools that the agent actually needs to avoid unnecessary processing.
  • Test your prompts with simple questions first before scaling to complex multi-step tasks.

Security Considerations

All text sent to this component, including prompts and conversation history, is processed through OpenAI’s API. To keep your data safe, avoid pasting personally identifiable information (PII), financial details, or internal company secrets into the prompt fields. Ensure your workflow complies with your organization’s data privacy policies and only grant the agent access to tools that are necessary for its specific task.

Important Notes

🔒 Sensitive data handling 🟡 All prompt content is sent to OpenAI’s API. Avoid including personal, financial, or other sensitive information unless you have ensured compliance with your organization’s data‑handling policies.

⚠️ Prompt must include an ‘input’ placeholder 🟡 The component requires that the user prompt template contains the key ‘input’. If it is missing, the component will raise a ValueError and stop running. Make sure to include {input} in your prompt.

📋 Provide a compatible Language Model 🟡 You must supply a LanguageModel or ToolEnabledLanguageModel instance as the ‘llm’ input. The model will be used to drive the agent’s responses.

📋 Add tools as BaseToolkit, BaseTool, or Tool objects 🟡 If the agent should use external tools, provide them as BaseToolkit, BaseTool, or Tool instances. The component will automatically extract usable tools from these objects.

💡 Use concise system and user prompts 🟢 Keep the system prompt short and clear (the default is “You are a helpful assistant”). For the user prompt, use a simple template that only references {input}; avoid complex logic that could confuse the agent.

⚙️ Optional chat history input 🟢 You can supply previous chat turns via the ‘chat_history’ input. Provide a list of Data objects representing past messages to give the agent context.