feat: add interactive mode for agent loop#364
Conversation
Greptile SummaryThis PR re-architects the agent loop to support an interactive (chat-like) mode by introducing an Key design decisions are sound:
Minor items noted:
Confidence Score: 4/5
Important Files Changed
|
9021407 to
d554389
Compare
Re-architects the agent loop to support interactive (chat-like) mode where text-only responses pause execution and wait for user input, while tool-call responses continue looping autonomously. - Add `interactive` flag to LLMConfig (default False, no regression) - Add configurable `waiting_timeout` to AgentState (0 = disabled) - _process_iteration returns None for text-only → agent_loop pauses - Conditional system prompt: interactive allows natural text responses - Skip <meta>Continue the task.</meta> injection in interactive mode - Sub-agents inherit interactive from parent (300s auto-resume timeout) - Root interactive agents wait indefinitely for user input (timeout=0) - TUI sets interactive=True; CLI unchanged (non_interactive=True)
d554389 to
7b09838
Compare
|
@greptileai review again |
Summary
pause execution and wait for user input, while tool-call responses continue looping autonomously
an
interactiveflag that defaults toFalseChanges
New
interactiveflag onLLMConfig— flows through to system prompt (Jinja conditional),LLM message preparation, and the agent loop.
Agent loop behavior (
base_agent.py):_process_iteration()now returnsNonefor text-only responses (no tool calls)None→ enter waiting state (pause for user input)Noneis falsy → loop continues as before (zero regression)System prompt (
system_prompt.jinja) — conditional sections:{% else %}blocks<meta>Continue the task.</meta>injection (llm.py) — skipped in interactive mode sothe agent doesn't auto-continue after text responses.
Configurable
waiting_timeoutonAgentState:0= wait indefinitely for user300sauto-resume so they don't get stuck600sdefault unchangedSub-agents inherit
interactivefrom parent's LLMConfig viaagents_graph_actions.py.TUI sets
interactive=True; CLI remainsinteractive=False.