----------------------
Based on the knowledge sources provided, I can answer your question about timeouts in the agent workflow of LlamaIndex.
The AgentWorkflow in LlamaIndex does indeed have a timeout feature. When you create an AgentWorkflow, you can specify a timeout value in seconds. If the workflow execution exceeds this timeout, a
WorkflowTimeoutError
exception will be raised.
Here's how you can handle and detect a timeout:
- When creating the AgentWorkflow, you can set a timeout:
agent_workflow = AgentWorkflow(
agents=[...],
root_agent="root_agent",
timeout=60 # Timeout in seconds
)
- When running the workflow, you can catch the
WorkflowTimeoutError
exception:
try:
handler = agent_workflow.run(user_msg="Your message here")
response = await handler
except WorkflowTimeoutError:
print("The workflow timed out")
If the workflow times out, it will raise a
WorkflowTimeoutError
with a message indicating that the operation timed out after the specified number of seconds.
It's worth noting that if a timeout occurs, the workflow will attempt to cancel any pending tasks and clean up before raising the exception.
For more detailed information about the AgentWorkflow and its timeout handling, you can refer to the
LlamaIndex API reference for AgentWorkflow.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------