[loop-generated] [refactor] Break up run_agentic_loop() — 215 lines, too complex #504

Closed
opened 2026-03-19 23:09:58 +00:00 by Timmy · 0 comments
Owner

File: src/timmy/agentic_loop.py:103

run_agentic_loop() is 215 lines long — by far the largest function in the codebase. This makes it hard to test, debug, and reason about.

Suggested approach:

  • Extract tool-calling logic into _execute_tool_call()
  • Extract response parsing into _parse_response()
  • Extract loop iteration into _run_iteration()
  • Extract result assembly into _assemble_result()

Acceptance criteria:

  • run_agentic_loop() is under 50 lines
  • Each extracted function is independently testable
  • All existing tests still pass
  • No behavior changes

Files: src/timmy/agentic_loop.py

**File:** `src/timmy/agentic_loop.py:103` `run_agentic_loop()` is 215 lines long — by far the largest function in the codebase. This makes it hard to test, debug, and reason about. **Suggested approach:** - Extract tool-calling logic into `_execute_tool_call()` - Extract response parsing into `_parse_response()` - Extract loop iteration into `_run_iteration()` - Extract result assembly into `_assemble_result()` **Acceptance criteria:** - `run_agentic_loop()` is under 50 lines - Each extracted function is independently testable - All existing tests still pass - No behavior changes **Files:** `src/timmy/agentic_loop.py`
Timmy closed this issue 2026-03-19 23:15:39 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#504