Skip to content

Integrate arpahls/rooms as the multi-agent room runtime (replace in-monolith room.py) #18

Description

@rosspeili

Problem

OPSIIE ships an in-process multi-agent room implementation (room.py + /room handling in OPSIIE_0_3_80_XP.py). It works for basic “temporal nexus” sessions but diverges from the official arpahls/rooms framework that ARPA maintains for multi-agent orchestration.

What we have today (bundled)

Area Current behavior
Entry /room nyx, g1: <theme> — regex ^/room\s+([^:]+):\s*(.+)$
Agents opsie (always) + nyx, g1, kronos validated against AGENT_DISPLAY_NAMES
Backends OPSIE → Ollama (get_opsie_response / stream_room_response, hardcoded llama3); others → agentic_network.ask_model (OpenAI/Gemini HTTP)
Turn selection Query all agents, score with MiniLM + length/uniqueness heuristics (_select_best_response)
Memory In-process Chroma collection room_<slug> + conversation_history
Export Optional CSV under outputs/rooms/ on /close
UX Agent-colored terminal output, speak_agent_response for voice; direct address via agent <prompt> prefix

Docs already point to arpahls/rooms as the standalone path (docs/COMMANDS.md, docs/ARCHITECTURE.md, docs/MODULES.md, README Related repos) but there is no code integration—two parallel implementations.

What arpahls/rooms provides

  • Session orchestration: round_robin, argumentative, dynamic (expertise-weighted routing)
  • LiteLLM routing (ollama/llama3, commercial APIs, local-first)
  • @AgentName forced turns, PASS mechanic, optional global orchestrator, human-in-the-loop
  • Pydantic agent/session config, custom Python inference per agent
  • Timestamped RAM history → Markdown / CSV export (tested via pytest + CI)

Goal

Use arpahls/rooms as the room engine inside OPSIIE while preserving the familiar operator surface:

  • Keep /room <agents>: <theme> and /close (or document a deliberate alias).
  • Keep OPSIIE terminal colors and voice (speak_agent_response, agent voice IDs).
  • Map authenticated user identity from kun.py (call_name, optional is_current_user) into the rooms user profile.

Avoid long-term duplication of orchestration logic in room.py.

Proposed integration (phased)

Phase 1 — Adapter behind existing /room UX (MVP)

  1. Add rooms as an optional dependency (pip install from Git tag or PyPI if published) in requirements.txt (or requirements-rooms.txt extra).
  2. Add opsie_rooms_adapter.py (name TBD) that:
    • Parses the existing /room command into a rooms session config (topic, agent list, turn mode default dynamic).
    • Registers each OPSIE agent as a custom_function (or LiteLLM model string where keys exist in .env):
      • opsie → wrapper around get_opsie_response / Ollama chat (same stack as main loop).
      • nyx / g1 / kronos → wrapper around ask_model(..., suppress_output=True) so existing API keys and personas stay in agentic_network.py.
    • Reuses get_agent_description() / get_agent_display_names() for personas and expertise lists.
  3. Replace current_room = Room(...) with a thin OpsieRoomSession facade that delegates turns to rooms.session.Session and returns {agent, response} for the main loop to print/speak.
  4. On /close, call rooms storage export (MD/CSV) and keep writing under outputs/rooms/ if we want path compatibility.

Phase 2 — Feature parity + cleanup

  • Adopt @AgentName addressing in room mode (document alongside legacy agent <prompt> or migrate).
  • Expose session type / turn limit via optional flags: /room dynamic nyx, g1: topic or rooms.yaml.
  • Remove MiniLM load from room.py (saves boot cost) once dynamic routing lives in rooms.
  • Fix duplicate logging: today get_best_response already calls add_conversation, but handle_user_query may add again—align with single source of truth in the adapter.
  • Deprecate room.py with a migration note in docs/COMMANDS.md.

Phase 3 — Optional deeper coupling

  • Shared .env / config for Ollama model names (see configurable Ollama issue) passed into LiteLLM as ollama/<model>.
  • Optional bridge: append room transcript snippets to global mnemonic / Chroma (off by default; rooms is RAM-first by design).
  • Document when to use OPSIIE /room vs standalone python cli.py from arpahls/rooms.

Non-goals (initially)

  • Replacing agentic_network.py or /ask live agents.
  • Forcing all OPSIE operators to install commercial API keys for room mode (OPSIE-only + local Ollama path should remain viable).

Acceptance criteria

  • /room nyx, g1: <theme> starts a session backed by arpahls/rooms, not room.Room.
  • At least opsie + one remote agent work in one session with correct personas.
  • /close ends room mode and offers export (MD or CSV) without breaking OPSIIE main convo.
  • Voice and terminal colors still work for room lines.
  • docs/COMMANDS.md, docs/ARCHITECTURE.md, docs/MODULES.md, README updated; room.py marked deprecated or removed.
  • Dependencies and setup documented (LiteLLM, local Ollama, API keys per agent).

Open questions

  1. Dependency packaging: git submodule vs pip install git+https://github.com/arpahls/rooms@<tag>?
  2. Kronos in rooms: currently limited in ask_model for non-live—skip in v1 or stub with clear message?
  3. Chroma per room: drop in favor of rooms RAM history, or optional sync layer?
  4. Config file: rooms.yaml at repo root vs env-only for v1?

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or capabilityhelp wantedExtra attention or design input is needed
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions