Langgraph React Agent
The Langgraph React Agent is a smart, automated assistant designed to handle complex tasks within your Nappai workflows. It uses a “Reasoning + Acting” (ReAct) approach, meaning it doesn’t just give you a single answer instantly. Instead, it breaks down your request into steps, thinks about the best way to solve it, uses available tools (like calculators or search engines) to gather information, and then provides a final, well-researched answer.
Think of this agent as a helpful employee who reads your instructions, checks necessary resources, and reports back with a complete solution rather than just a quick guess.
How it Works
This component acts as the “brain” of your automation workflow. Here is a simple explanation of how it processes your requests:
- Receives Instructions: You provide a task (Input) and give it access to specific tools (Tools).
- Thinks and Plans: The agent analyzes your request and decides what information is missing.
- Acts: If it needs more data, it uses one of the connected tools (e.g., a web search or a database query).
- Reviews: It looks at the result from the tool and decides if it has enough information or needs to perform another action.
- Delivers: Once the task is complete, it provides a final response that you can use in the next steps of your workflow.
This cycle repeats until the problem is solved or a set limit of steps is reached, ensuring thorough and accurate results.
Connection & Credentials
This component does not require direct API key configuration within the node itself, as credentials are typically managed at the system level or passed through connected tools. However, ensure that the LanggraphBaseComponentV2 library is installed and properly configured in your Nappai environment for this agent to initialize correctly.
Inputs
The following fields are available to configure this component. Each field may be visible in different operations:
-
Model: The language model to use for the agent.
- Visible in: Build Agent
-
Tools: A list of tools that the agent can use to perform actions.
- Visible in: Build Agent
-
State custom schema: Define additional fields for the agent’s internal state. This allows the agent to manage custom information throughout its execution. Provide a JSON schema with the fields you want to add.
- Visible in: Build Agent
-
Agent Description: Useful description when using the agent as tool or child of supervisor schema.
- Visible in: Build Agent
-
Agent Name: The name of the executor to use.
- Visible in: Build Agent
-
Input: The initial input message for the agent to start the conversation.
- Visible in: Build Agent
-
Max Iterations: The maximum number of iterations to run the agent for.
- Visible in: Build Agent
-
Memory top message: The number of messages to pass to the agent as context. for pass all messages use -1
- Visible in: Build Agent
-
Structured Output Schema: Define a schema to structure the agent’s final output. When a schema is provided, the agent will be forced to respond in a structured JSON format that conforms to this schema. This is useful for obtaining predictable, machine-readable output.
- Visible in: Build Agent
-
System Prompt: System prompt for the agent.
- Visible in: Build Agent
-
Use short term memory: Enable the checkpointer to save the agent’s state at each step, allowing for stateful conversations.
- Visible in: Build Agent
-
Stream: Enable streaming to receive the agent’s response as it is being generated.
- Visible in: Build Agent
-
User Prompt: User prompt for the agent.
- Visible in: Build Agent
-
Tool Name: The name of the tool that will be used when this component is connected as a tool. This name will be displayed to the agent when it selects tools to use.
- Visible in: Build Agent
-
Tool Description: A detailed description of what this tool does. This description will help the agent understand when and how to use this tool effectively.
- Visible in: Build Agent
-
Tools arguments metadata: Defines the arguments metadata for the tools.
- Visible in: Build Agent
Outputs
This component produces a structured result that can be passed to other parts of your workflow.
- Agent: The compiled graph representation of the agent, ready for execution.
- Response: The final message or answer generated by the agent after completing its task.
- Tool: The agent packaged as a tool that can be used by other supervisor agents.
Output Data Example (JSON)json
{ “response”: { “content”: “Based on the search results, the total revenue for Q3 was $1.2M. I have compiled the attached report.”, “type”: “text”, “metadata”: { “iterations_used”: 3, “tools_used”: [“search_web”, “data_exporter”] } } }
Connectivity
This component is typically the central processor in a data analysis or automation workflow.
- Connect TO: The Input or User Prompt fields of this agent are usually connected to the Output of a Data Fetcher, API Call, or Text Input component.
- Connect FROM: The Response output is usually connected to a Data Validator, Email Sender, or Database Writer to finalize the action.
- Tool Usage: When used as a child agent, this component connects its Tool output to the Tools input of a Supervisor Agent or a parent orchestrator.
Usage Example
Scenario: Analyzing Sales Data
- Input: You connect a Sales Database Reader to the Input of this agent.
- Tools: You add a Calculator tool and a Web Search tool to the Tools input.
- Prompt: In the User Prompt, you type: “Calculate the average monthly sales and compare them to last year’s industry average.”
- Execution: The agent retrieves the data, uses the Calculator to find averages, uses Web Search to find industry benchmarks, and reasons through the comparison.
- Result: The Response output provides a clear summary like: “The average monthly sales are $50k, which is 10% higher than the industry average of $45k.”
Important Notes
⚠️ Development Release 🔴 This component is marked as a development build. It may contain bugs or incomplete features, so use it with caution and avoid relying on it for production deployments.
💡 Quick Start with Prebuilt Agent 🟢 If you need a ready‑to‑use Langgraph react Agent with minimal setup, this component is ideal. Just provide the standard base inputs and you’ll have a working agent.
📋 Prerequisite Dependency 🟡 Make sure the LanggraphBaseComponentV2 library is installed and properly configured before using this component. Missing dependencies will prevent it from initializing.
ℹ️ Inherited Base Behavior 🟢 The component does not add any new behavior beyond what is defined in LanggraphAgentBaseV2. It simply exposes the same set of inputs and functionality.
⚙️ No Additional Configuration Needed 🟢 Because it uses the base component’s input set, there are no extra configuration parameters to set. Just provide the inputs required by LanggraphAgentBaseV2.
Tips and Best Practices
- Use Memory Wisely: If you are running a multi-step conversation, enable Use short term memory to ensure the agent remembers previous steps.
- Limit Iterations: Set Max Iterations to a reasonable number (e.g., 10-20) to prevent the agent from getting stuck in infinite loops if it can’t solve the problem.
- Define Clear Tools: The more clearly you describe your Tools and their Tool Description, the better the agent will understand when and how to use them.
- Structured Output: For automated data processing, use the Structured Output Schema to force the agent to return data in a specific JSON format, making it easier for subsequent components to read.
Security Considerations
- Credential Management: Ensure that any tools connected to this agent are configured with appropriate access levels. Avoid giving the agent broad administrative access unless necessary.
- Input Validation: Since this agent processes user prompts, be cautious about injecting sensitive data directly into the User Prompt unless the underlying model and tools are secure.