mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-07-29 02:33:33 +00:00
Introduce a /stop API handler (api/stop.py) and its DOX to cancel an AgentContext run without deleting the context; it clears pause state, progress and logs an info step. Add tests for stopping behavior, chat working animation, and sidebar timestamp/spacing (tests/*). Update helpers/git._format_git_timestamp to emit UTC timestamps without a timezone suffix and add a test for it. Implement stop-related UI/UX: input-store.js gains a stop state, activateSendButton(), and stopAgent() to call /stop; chat-bar-input.html updates the send button markup, aria-label and stop styles. Update sidebar/chat list CSS to add the working-bubble animation, adjust chat row layout and action-button visibility, and left-sidebar/bottom styling (nowrap timestamp). Modify messages.js to hide kvps.finished from display and complete the active process group when finished. Minor welcome-composer and documentation updates to reflect these behaviors.
1.2 KiB
1.2 KiB
stop.py DOX
Purpose
- Own the authenticated WebUI endpoint that stops an active agent run without deleting or resetting its chat context.
Ownership
stop.pyresolves the requested in-memory context and cancels its current process.
Runtime Contracts
Stopderives fromApiHandler, retaining the default authentication and CSRF protections.- Input uses the selected chat ID in
context; the endpoint never creates a missing context. - Stopping cancels the context task through
AgentContext.kill_process(), clears pause state, preserves chat history and queued messages, and does not start another run. - The endpoint clears active progress and logs a terminal
Agent process stopped.info step so the WebUI closes the interrupted process group. - The response contains
message,context, and astoppedboolean indicating whether the context was running when requested.
Work Guidance
- Keep this endpoint aligned with the composer stop-button state and the existing
AgentContexttask lifecycle.
Verification
- Run
pytest tests/test_stop_agent.pyand smoke-test stopping during model streaming and tool execution.
Child DOX Index
No child DOX files.