Replies: 4 comments 9 replies
-
I found a similar unsolved discussion that might be relevant to your question: Request for Integrating AgentExecutor Functionality into LangGraph Reasoner Node for Python REPL Queries [1]. To create a LangGraph agent that processes a DataFrame (
Here's a basic outline of how you can set this up: from langgraph.prebuilt import create_react_agent
from langchain_core.tools import Tool
from langchain_experimental.utilities import PythonAstREPLTool
# Define the Python REPL tool
repl_tool = PythonAstREPLTool(
locals={"df": df},
name="python_repl",
description="Runs Python code and returns the output of the final line",
)
# Define other tools if needed
tools = [repl_tool, retriever_tool]
# Create the LangGraph agent
langgraph_agent_executor = create_react_agent(llm, tools)
# Define the workflow
def process_input(input_data):
messages = langgraph_agent_executor.invoke({"messages": [("human", input_data)]})
return messages["messages"][-1].content
# Example usage
input_data = "Your input here"
output = process_input(input_data)
print(output) This setup uses the |
Beta Was this translation helpful? Give feedback.
-
@dosu. I a getting this error |
Beta Was this translation helpful? Give feedback.
-
@dosu Is it possible to build LangGraph with multiple agents that use the same PythonAstREPLTool but operate on different datasets? If so, could you provide a sample code snippet demonstrating this? |
Beta Was this translation helpful? Give feedback.
-
@dosu... validation error. Can you help me?ValidationError Traceback (most recent call last) File ~\AppData\Roaming\Python\Python312\site-packages\langgraph\pregel_init_.py:1290, in Pregel.stream(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug, subgraphs) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I like to move my simple langchain agent_executor to LangGraph Agent. Code I used for Agent_Executor is above cell. Based on this example, can you help me in creating a single LangGraph agent to take the df dataframe and produce the output based on Human 'Input'?
System Info
Name: langgraph
Version: 0.2.27
Beta Was this translation helpful? Give feedback.
All reactions