Kommander supports many conversations running at the same time, but tool calls within one conversation are currently executed sequentially. This keeps the message history deterministic and ensures each tool result is appended before the next model round starts.
Current Behavior
| Scope | Behavior |
|---|---|
| Across conversations | Tool-call streams can run concurrently. The load test starts 100 conversations at once. |
| Within one conversation round | Tool calls emitted in the same model response are executed one after another. |
| Across tool rounds | The final model response waits until all tool results from the current round are appended. |
| Audit writes | Tool audit writes are awaited on the tool-call path. |
| Customer-data checks | Budget, rate-limit, identity, and circuit-breaker checks are performed before connector execution. |
| Connector failures | Repeated failures can open the connector circuit breaker; blocked calls do not reach the connector executor. |
The default maximum tool-call loop is three rounds unless KOMMANDER_MAX_TOOL_ROUNDS is set to another positive integer.
Timing and Feedback
Each registry execution is wrapped by a tool timeout. The current registry timeout is 10 seconds. Long-running tools can emit progress feedback every 2 seconds through the tool-call handler when the caller provides a progress callback.
Customer-data connectors also have their own request limits and circuit-breaker behavior. A connector may fail with timeout, error, or circuit_open depending on whether the registry timeout, outbound request limit, or circuit breaker is the limiting control.
Load-Test Coverage
The load-test plan is maintained in docs/concurrent-tool-call-load-tests.md. Run it with:
yarn test:load:toolsThe suite uses node:test, tsx --test, synthetic OpenAI streams, mocked connector execution, and an in-memory audit-log database stub. It does not require network access or real connector credentials.
Acceptance Thresholds
| Threshold | Expected value |
|---|---|
| Concurrent conversations | 100 complete. |
| Total tool calls | 300 execute and audit-log. |
| P95 tool execution latency | Below 2 seconds. |
| P95 added orchestration overhead | Below 2 seconds. |
| Peak heap growth | Below 64 MiB. |
| Circuit breaker | Circuit-open results are observed after repeated connector failures. |
| Circuit isolation | Once open, blocked calls do not reach the connector executor. |
CPU usage is sampled with process.cpuUsage() for every run.
Known Bottlenecks
The current bottlenecks are intentional documentation of the existing implementation, not target architecture:
- Tool calls inside one conversation are sequential in
streamWithToolCalls. - Audit writes are awaited and can add user-visible latency if MongoDB is slow.
- The final LLM round cannot start until every tool result has been appended.
- Customer-data rate-limit and budget checks are awaited for each tool call.
If realistic connector delays cause the load test to fail, inspect those areas before relaxing latency targets.