langgraph/how-tos/create-react-agent-system-prompt/ #1060
Replies: 13 comments 8 replies
-
Is there a way a system prompt can be added to a self-discover model? Also, how does one integrate the human-in-the-loop in self-discover so that the model allows self updates. |
Beta Was this translation helpful? Give feedback.
-
Caught me out the state_modifier was removed see below:
|
Beta Was this translation helpful? Give feedback.
-
I try to use this react agent in a FastAPI server where I create an endpoint with langserve. Problem is data validation. Currently deploying the endpoint with: Is there any documentation on what the data model has to look like for LangGraph if you want to do input validation? |
Beta Was this translation helpful? Give feedback.
-
Is there a way to integrate ReAct agent with StateGraph? |
Beta Was this translation helpful? Give feedback.
-
Why no use of |
Beta Was this translation helpful? Give feedback.
-
What is the difference between 'tool calling agent'? |
Beta Was this translation helpful? Give feedback.
-
I have a simple use of def state_modifier(state: AgentState) -> Sequence[BaseMessage]:
# Track the number of calls to the agent
llm_calls = state.get("llm_calls", 0)
state["llm_calls"] = llm_calls + 1 # problem, this does NOT update state
# Add the adequate system message to the beginning of the messages
messages = list(state.get("messages", []))
content = (
SystemMessages.lg_react_last()
if llm_calls > 0
else SystemMessages.lg_react_first(self.seeq_context)
)
messages.insert(0, SystemMessage(content))
# Return the messages
return messages So my question is how can I mutate the |
Beta Was this translation helpful? Give feedback.
-
Is there a problem here? It should It should be messages_modifier, not state_modifier ? |
Beta Was this translation helpful? Give feedback.
-
How can I control memory size (its summarization or cutting-off messages) in the pre-built agents like this? |
Beta Was this translation helpful? Give feedback.
-
state_modifier seems not modifying the state. def custom_state_modifier(self, state: InvoiceAgentState, config: RunnableConfig) -> Sequence[BaseMessage]:
state["my_key"] = "my value" # <--- This value is not sticky
system_prompt = "You're. a helpful assistant"
messages = state['messages']
return [SystemMessage(content=system_prompt, *messages]
create_react_agent(tools=tools, model=self.llm, state_schema=MyCustomState,state_modifier=custom_state_modifier, checkpointer=MemorySaver(), debug=True) Reason I found is that there is one bug in create_react_agent, under state["messages"] = response
return state |
Beta Was this translation helpful? Give feedback.
-
But this function doesn't perform |
Beta Was this translation helpful? Give feedback.
-
Good morning! what about tools with artifact and react agent? Is there a way to manage pre-built tools like tavily that return artifact and custom tools that use that artifacts? please help! thanks in advance |
Beta Was this translation helpful? Give feedback.
-
Not working, there is no tool in this output. ================================ Human Message ================================= what is the weather in sf? I don't have real-time weather data for San Francisco. For the most up-to-date and accurate information, I recommend checking a reliable weather website or app specifically for San Francisco. They offer the latest details on temperature, precipitation, and other weather conditions. Let me know if you'd like help with anything else! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
langgraph/how-tos/create-react-agent-system-prompt/
Build language agents as graphs
https://langchain-ai.github.io/langgraph/how-tos/create-react-agent-system-prompt/
Beta Was this translation helpful? Give feedback.
All reactions