Errors¶
alloy.errors ¶
AlloyError ¶
Bases: Exception
Base error for Alloy.
CommandError ¶
Bases: AlloyError
Raised when a command fails to produce a valid result.
ToolError ¶
Bases: AlloyError
Raised when a tool contract fails or a tool invocation errors.
ConfigurationError ¶
Bases: AlloyError
Raised when required configuration or provider backends are missing.
ToolLoopLimitExceeded ¶
Bases: CommandError
Raised when the tool-call turn limit is exceeded without a final answer.
Carries additional context for better developer experience.
create_tool_loop_exception ¶
create_tool_loop_exception(*, max_turns, turns_taken, partial_text)
Create a standardized ToolLoopLimitExceeded with contextual details.
Usage¶
from alloy import command, CommandError
@command(output=int)
def compute() -> str:
return "Return 6*7 as a number."
try:
print(compute())
except CommandError as e:
print("Model error:", e)
See also
- Guide → Production: guide/production.md