-
Notifications
You must be signed in to change notification settings - Fork 92
M5: Multi-Session Concurrency for API Server #654
Copy link
Copy link
Open
Labels
domain:surfacesAgent UI, Telegram, WhatsApp, Slack/Discord, mobileAgent UI, Telegram, WhatsApp, Slack/Discord, mobileenhancementNew feature or requestNew feature or requesttrack:consumer-appHermes-competitor consumer product — mobile-first, voice + messaging + memory + skillsHermes-competitor consumer product — mobile-first, voice + messaging + memory + skills
Metadata
Metadata
Assignees
Labels
domain:surfacesAgent UI, Telegram, WhatsApp, Slack/Discord, mobileAgent UI, Telegram, WhatsApp, Slack/Discord, mobileenhancementNew feature or requestNew feature or requesttrack:consumer-appHermes-competitor consumer product — mobile-first, voice + messaging + memory + skillsHermes-competitor consumer product — mobile-first, voice + messaging + memory + skills
Priority: P1 — Required for multi-user deployments
Effort: Large (7-10 days)
Problem
GAIA's API server can only handle one chat request at a time. The UI server enforces this with
chat_semaphore = asyncio.Semaphore(1). The OpenAI API server creates a single agent instance per model. Root cause:_TOOL_REGISTRYinsrc/gaia/agents/base/tools.pyis a global dict. Concurrent agents registering tools corrupt each other's state.Deliverable
Support N concurrent chat sessions without tool registry corruption.
Approach options (choose one)
_TOOL_REGISTRYfrom module-level global to an instance attribute on each Agent. Tools are registered per-agent, not globally. Cleanest fix but touches the core agent architecture.Files to change
src/gaia/agents/base/tools.py— make_TOOL_REGISTRYinstance-scoped or copyablesrc/gaia/agents/base/agent.py— agent instantiation changessrc/gaia/api/openai_server.py— agent pool or per-request instantiationsrc/gaia/ui/server.py— remove or increasechat_semaphoreAcceptance criteria
/v1/chat/completionsrequests complete without errorsContext
Full milestone plan:
docs/plans/webapp-integration.md