Skip to content

Commit 057810b

Browse files
chore: remove max_steps callback
1 parent 6455010 commit 057810b

8 files changed

Lines changed: 2 additions & 108 deletions

File tree

docs/11_callbacks.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,7 @@ with ComputerAgent(callbacks=[TimingCallback()]) as agent:
7575

7676
## Built-in Callbacks
7777

78-
### `MaxStepsCallback`
79-
80-
Terminates the agentic loop after a maximum number of steps. Raises `MaxStepsReachedError` when the limit is reached.
81-
82-
```python
83-
from askui import ComputerAgent, MaxStepsCallback
84-
85-
with ComputerAgent(callbacks=[MaxStepsCallback(max_steps=10)]) as agent:
86-
agent.act("Open the settings menu")
87-
```
78+
(we will add built-in callbacks at a later stage)
8879

8980
## Multiple Callbacks
9081

src/askui/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from .agent_base import Agent
1111
from .agent_settings import AgentSettings
12-
from .callbacks import ConversationCallback, MaxStepsCallback
12+
from .callbacks import ConversationCallback
1313
from .computer_agent import ComputerAgent, VisionAgent
1414
from .locators import Locator
1515
from .models import (
@@ -31,7 +31,6 @@
3131
ToolUseBlockParam,
3232
UrlImageSourceParam,
3333
)
34-
from .models.exceptions import MaxStepsReachedError
3534
from .models.shared.settings import (
3635
DEFAULT_GET_RESOLUTION,
3736
DEFAULT_LOCATE_RESOLUTION,
@@ -82,8 +81,6 @@
8281
"ConfigurableRetry",
8382
"ContentBlockParam",
8483
"ConversationCallback",
85-
"MaxStepsCallback",
86-
"MaxStepsReachedError",
8784
"DEFAULT_GET_RESOLUTION",
8885
"DEFAULT_LOCATE_RESOLUTION",
8986
"GetSettings",

src/askui/callbacks/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from .conversation_callback import ConversationCallback
2-
from .max_steps_callback import MaxStepsCallback
32
from .usage_tracking_callback import UsageTrackingCallback
43

54
__all__ = [
65
"ConversationCallback",
7-
"MaxStepsCallback",
86
"UsageTrackingCallback",
97
]

src/askui/callbacks/max_steps_callback.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/askui/models/exceptions.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,6 @@ def __init__(self, max_tokens: int, message: str | None = None):
147147
super().__init__(error_msg)
148148

149149

150-
class MaxStepsReachedError(AutomationError):
151-
"""Exception raised when the agent reaches the maximum number of steps.
152-
153-
Args:
154-
max_steps (int): The maximum step limit that was reached.
155-
message (str, optional): Custom error message. If not provided, a default
156-
message will be generated.
157-
"""
158-
159-
def __init__(self, max_steps: int, message: str | None = None):
160-
self.max_steps = max_steps
161-
error_msg = (
162-
f"Agent stopped due to reaching maximum step limit of {max_steps} steps"
163-
if message is None
164-
else message
165-
)
166-
super().__init__(error_msg)
167-
168-
169150
class ModelRefusalError(AutomationError):
170151
"""Exception raised when the model refuses to process the request.
171152

tests/unit/models/__init__.py

Whitespace-only changes.

tests/unit/models/shared/__init__.py

Whitespace-only changes.

tests/unit/models/shared/test_max_steps_callback.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)