Spaces:
Sleeping
Sleeping
Daniel Amendoeira
commited on
Update agent.py
Browse files
agent.py
CHANGED
@@ -98,9 +98,9 @@ builder.add_edge("environment", "llm_call") # after running the tools go back t
|
|
98 |
gaia_agent = builder.compile() # converts my builder into a runnable agent by using gaia_agent.invoke()
|
99 |
|
100 |
# Call the Agent
|
101 |
-
def
|
102 |
input_state = {"messages": [HumanMessage(content=question)]} # prepare the initial user message
|
103 |
-
result = gaia_agent.invoke(input_state, {"recursion_limit": 30}) #
|
104 |
final_response = result["messages"][-1].content
|
105 |
|
106 |
try:
|
|
|
98 |
gaia_agent = builder.compile() # converts my builder into a runnable agent by using gaia_agent.invoke()
|
99 |
|
100 |
# Call the Agent
|
101 |
+
def agent_run(question: str):
|
102 |
input_state = {"messages": [HumanMessage(content=question)]} # prepare the initial user message
|
103 |
+
result = gaia_agent.invoke(input_state, {"recursion_limit": 30}) # prevents infinite looping when the LLM keeps calling tools over and over
|
104 |
final_response = result["messages"][-1].content
|
105 |
|
106 |
try:
|