Skip to content

Commit e8841ac

Browse files
committed
Integrate stat tracker into Terminus2 agent
- Add timing for initial setup (t2/setup) - tracks tmux session initialization - Add timing for LLM requests (t2/llm_request) - tracks expensive API calls - Remove TODO comment now that tracker is actively used - All tests pass (8/8), no functional changes Resolves TODO in terminus2_agent.py:146
1 parent 519e893 commit e8841ac

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/ares/code_agents/terminus2/terminus2_agent.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ class Terminus2Agent(code_agent_base.CodeAgent):
143143

144144
container: containers.Container
145145
llm_client: llm_clients.LLMClient
146-
# TODO: Actually use the stat tracker in the agent.
147146
tracker: stat_tracker.StatTracker = dataclasses.field(default_factory=stat_tracker.NullStatTracker)
148147
parser_format: Literal["json", "xml"] = "json"
149148
max_turns: int = 1_000_000 # Match terminal-bench reference (effectively unlimited)
@@ -489,7 +488,8 @@ async def run(self, task: str) -> None:
489488
self._original_instruction = task # Store for summarization
490489

491490
# Initialize tmux session to capture initial terminal state
492-
await self._ensure_tmux_session()
491+
with self.tracker.timeit("t2/setup"):
492+
await self._ensure_tmux_session()
493493

494494
# Capture initial terminal state using incremental output
495495
# First call returns "Current Terminal Screen:\n{visible}" automatically
@@ -680,9 +680,10 @@ async def _query_llm(self) -> response.LLMResponse:
680680
)
681681

682682
try:
683-
response = await self.llm_client(
684-
request.LLMRequest(messages=self._messages, system_prompt=self._system_prompt)
685-
)
683+
with self.tracker.timeit("t2/llm_request"):
684+
response = await self.llm_client(
685+
request.LLMRequest(messages=self._messages, system_prompt=self._system_prompt)
686+
)
686687
_LOGGER.debug("[%d] Received LLM response", id(self))
687688
return response
688689

0 commit comments

Comments
 (0)