Error is a value object returned by invoke_agent when the agent completed its work but could not produce the desired result. It is not an exception — it is returned alongside successful results.
result =await obj.invoke_agent("some prompt")ifisinstance(result, Error):print(f"Agent failed: {result.message}")else:print(f"Result: {result}")
Distinction from Exceptions
Error
Exception
Meaning
Task failed
API failed
Who
The agent
The framework
When
Agent reasoned but couldn't satisfy the request
Internal workflow broke
Return
Returned as value
Raised with raise
Examples
"Could not determine...", "Insufficient info..."
RuntimeError, ToolSchemaError
Constructor
Error(message:str)->None
Parameter
Type
Description
message
str
Human-readable explanation of why the agent could not produce the result.