Peteosdocs

Error

from peteos import Error

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")
if isinstance(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.

Properties

Property Type Description
message str The error explanation.

Equality

Error("something broke") == Error("something broke")  # True

Two Error instances are equal when their messages match.