| 1 | class InterruptAgentFlow(Exception):
|
| 2 | """Raised to interrupt the agent flow and add messages."""
|
| 3 |
|
| 4 | def __init__(self, *messages: dict):
|
| 5 | self.messages = messages
|
| 6 | super().__init__()
|
| 7 |
|
| 8 |
|
| 9 | class Submitted(InterruptAgentFlow):
|
| 10 | """Raised when the agent has completed its task."""
|
| 11 |
|
| 12 |
|
| 13 | class LimitsExceeded(InterruptAgentFlow):
|
| 14 | """Raised when the agent has exceeded its cost or step limit."""
|
| 15 |
|
| 16 |
|
| 17 | class UserInterruption(InterruptAgentFlow):
|
| 18 | """Raised when the user interrupts the agent."""
|
| 19 |
|
| 20 |
|
| 21 | class FormatError(InterruptAgentFlow):
|
| 22 | """Raised when the LM's output is not in the expected format."""
|
| 23 |
|