Class: Phronomy::Agent::ParallelToolChat
- Inherits:
-
RubyLLM::Chat
- Object
- RubyLLM::Chat
- Phronomy::Agent::ParallelToolChat
- Defined in:
- lib/phronomy/agent/parallel_tool_chat.rb
Overview
RubyLLM::Chat subclass that executes multiple tool calls concurrently.
When the LLM returns more than one tool call in a single response, each tool is dispatched in a dedicated IO thread and all results are collected before being appended to the message history. This preserves a deterministic message order while reducing wall-clock latency when tools are IO-bound (HTTP calls, DB queries, etc.).
Single-tool responses fall through to the standard sequential path via +super+, preserving all existing edge-case behaviour (Tool::Halt, forced_tool_choice, streaming, SuspendSignal, etc.).
This class is used automatically when the agent is running inside an AgentFSM IO thread (i.e. when the +:phronomy_agent_parallel_tools+ thread-local flag is +true+). It is not used for direct synchronous +invoke+ calls so that the streaming callback state remains single-threaded.