Skip to content

Integrate stat tracker into Terminus2 agent#83

Open
sarvanithin wants to merge 4 commits intowithmartian:mainfrom
sarvanithin:feat/terminus2-stat-tracker
Open

Integrate stat tracker into Terminus2 agent#83
sarvanithin wants to merge 4 commits intowithmartian:mainfrom
sarvanithin:feat/terminus2-stat-tracker

Conversation

@sarvanithin
Copy link
Contributor

Adds performance monitoring to the Terminus2 agent by integrating the stat tracker for key operations. Tracks setup time and LLM request latency. All tests pass. Resolves TODO in terminus2_agent.py line 146.

- Add RequestConverter[RequestType] Protocol for bidirectional conversion
- Implement ChatCompletionConverter, ResponsesConverter, and MessagesConverter
- Update LLMRequest methods to delegate to converters for better modularity
- All existing tests pass (55/55), fully backward compatible
- No changes required to calling code (chat_completions_compatible.py, etc.)

Addresses issue withmartian#65: Improves abstraction and extensibility of LLMRequest conversion logic while maintaining 100% backward compatibility.
- Add stdout and stderr fields to ExecResult dataclass
- Keep output property for backward compatibility (returns stdout + stderr)
- Update DaytonaContainer and DockerContainer implementations
- Update MockContainer and all test mocks
- All tests pass (21/21), fully backward compatible

Resolves container execution output TODO in containers.py:11
- Update _render_timeout_template to use Jinja2.Template instead of str.format()
- Convert _TIMEOUT_TEMPLATE to use Jinja2 syntax ({{ variable }} instead of {variable})
- Add docstring to _render_timeout_template function
- Improves consistency with other template rendering functions
- Tested and verified correct rendering

Resolves TODO in mini_swe_agent.py:109
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant