Summary
Every agent turn rebuilds the entire session pipeline from scratch:
[argent-runtime] Using ArgentSessionManager for session
[argent-runtime] Using ArgentSettingsManager
[argent-runtime] Using createArgentAgentSession (tools=113)
Combined with the 113-tool registry construction, this accounts for ~5.5 seconds of pre-I/O wall-clock per turn (gateway tony-stark phase async_io_started=5509ms). Within a single ongoing conversation, none of this should change between turns — the same session, same settings, same tools.
Repro
Run two consecutive turns in the Argent TUI. Tail ~/.argent/logs/gateway.log for the [tony-stark] phase lines. Observe that async_io_started, tools_created, pre_session, session_created all hover around 5.5s on both turns even though the conversation, settings, and tool list have not changed.
Proposed fix
Cache the session-pipeline state keyed by (sessionId, agentId, settingsRevision, toolRegistryHash):
- First turn of a session: build everything as today (~5.5s).
- Subsequent turns: reuse the cached session manager, settings manager, agent session, and tool registry. Expected pre-I/O time: <100ms.
- Cache invalidation: bump on settings change, tool registry change (e.g. operator enables a new toolkit), or explicit session reset.
Acceptance criteria
Related
🤖 Filed from a live perf investigation.
Summary
Every agent turn rebuilds the entire session pipeline from scratch:
Combined with the 113-tool registry construction, this accounts for ~5.5 seconds of pre-I/O wall-clock per turn (gateway
tony-starkphaseasync_io_started=5509ms). Within a single ongoing conversation, none of this should change between turns — the same session, same settings, same tools.Repro
Run two consecutive turns in the Argent TUI. Tail
~/.argent/logs/gateway.logfor the[tony-stark]phase lines. Observe thatasync_io_started,tools_created,pre_session,session_createdall hover around 5.5s on both turns even though the conversation, settings, and tool list have not changed.Proposed fix
Cache the session-pipeline state keyed by
(sessionId, agentId, settingsRevision, toolRegistryHash):Acceptance criteria
tony-starktelemetry showsasync_io_started < 200mson the 2nd+ turn of a session under no-change conditions.Related
🤖 Filed from a live perf investigation.