DEV Community

Charles
Charles

Posted on Edited on

AI-Team-Team - A generic dynamic multi-agent collaboration framework

With ATT (AI-Team-Team), AIs can freely form teams, define how they interact, how teams collaborate, and create all sorts of incredibly complex hierarchical (or dynamic) relationships.

Believe me, ATT is very interesting.

🛠️ Current Status & Future Plans:

The project is currently a fundamentally complete Python package, through which you can observe some fascinating AI sociological behaviors (it has already helped me brainstorm quite a few great ideas). In the near future, I might launch a simple application for end-users based on ATT.

Many details are still rough around the edges, and some ideas are still being rolled out step by step. However, I personally believe the core concept is highly intriguing, and I warmly welcome your feedback, suggestions, and contributions 👍

If you find this project interesting, please support it with a ⭐️ Star! Thank you so very much! 🙏

👉 Project Repository:https://github.com/AI-Team-Team/AI-Team-Team

🧬 Topology & Lineage Control

  • Tree-like Lineage Spawning: Spawns recursive child agent teams (AgentTeam) at runtime to arbitrary depths, strictly bounded by depth limits to prevent stack overflow.
  • Autonomous Member Configs: Defines dynamic child memberships mapping role presets, custom system instructions, and LLM aliases to shape custom agent personalities.
  • Dynamic Lineage Migration: Permits active teams to request parent-hierarchy migrations, arbitrated by modular strategies with loop/cycle detection and parent notification logs.
  • Hierarchical Topology Map: Injects an ASCII-drawn indented tree map of active teams (displaying purposes, status, and progress metrics in real-time) directly into the agent prompt context.
  • Global Expert Discovery: Automatically appends a directory of all active system experts (names, roles, and profiles) into the agent's identity context to facilitate peer discovery.
  • Shared-Agent Continuity: One Agent may participate in several teams with one identity and complete memory. Invocation-scoped team/discussion context keeps prompts and team-sensitive tools correctly scoped while the agent's own model calls remain serialized.
  • Resilient Failover Routing: Dynamically hot-swaps exhausted or failing model clients. "auto" selects from available bindings; "parent" uses an explicit parent AgentTeam ballot or a Root Agent decision and fails closed.

🧠 ReAct Loops & Execution Engine

  • Bounded ReAct Loops: Executes standard Thought/Action/Observation reasoning cycles, capped by max steps to prevent runaway API tokens.
  • Strict Balanced Action Parser: A character-level scanner handles nested delimiters, quotes, triple quotes, escapes, multiline input, Markdown fences, and Unicode before literal-only argument parsing; malformed or unquoted expressions never execute a tool.
  • Bounded Memory Compression: Automates memory pruning by extracting early conversation turns, calling the agent's LLM to generate a *** HISTORICAL SUMMARY ARCHIVE ***, and retaining a bounded high-fidelity window.
  • Optional Selective Episodic Memory: When explicitly enabled, records one deterministic Agent-owned segment per terminal business turn, queues isolated retrieval-metadata indexing in the background, and lets only that Agent search or temporarily recall its own Memory Cards.
  • LLM Adapter Architecture: Unifies sync, async, and streaming LLM payloads from various providers (Google, OpenAI, Anthropic) into standard LLMResponse and ToolCall formats via the ManagerDefaultClientAdapter.
  • Atomic Token Budget Circuit Breakers: Enforces hard per-model quotas by atomically reserving prompt and maximum output capacity before each request, settling provider usage, refunding unused capacity, and routing failover through the same ledger.

🗳️ Governance & Inter-Team Communication

  • Democratic Voting System: Features an asynchronous voting pipeline to add or remove members, requiring unanimous participation and a $\ge 2/3$ agreement majority.
  • Anonymous Voting: Enforces voter anonymity via cast_vote(..., public=False) which masks voter names as "Anonymous Voter" in the team prompt context.
  • Autonomous AgentTeam Communication: ATTConfig.communication selects permissive, parent-approval, or lineage-approval governance. AgentTeams own requests and agreements; Agents act only from invocation-scoped team authority. No member order or creator identity grants communication authority.

🔒 Context Protection & Safety Gates

  • Token-Bounded File Reading: Limits model-facing reads by the effective model's content-token budget rather than file size or line count, supports exact continuation inside long lines, and rejects stale file cursors.
  • Collaborative DocLib Storage: Equips teams with built-in document libraries. Access is governed by prefix path ACL permissions (READ/WRITE) that inherit recursively downward to subdirectories.
  • Private Agent DocLibs: Gives every registered AI one persistent private workspace (PDL-<agent_id>). Private files follow a shared AI across teams, remain outside team ACLs and prompts, and enter a team library only through an explicit copy/publish tool.
  • Role-Neutral Shared Membership: Adds an active registered Agent to multiple AgentTeams through existing_members or stable existing_member_ids. Each team stores only a membership reference, so joining another team never changes the Agent's identity, role, instructions, model binding, memory, lifecycle, invocation lock, or Private DocLib.
  • Tool Auditor Interception: Registers pre-execution interception hooks to audit, vet, approve, or reject specific tool calls (e.g. database safety query check).

💾 Persistence & Diagnostics

  • Asynchronous SQLite Persistence: Serializes changed topology, memory, DocLib, ACL, and governance records through an exclusive cross-process writer lease with one active and one coalesced pending delta, explicit flush, and transactional restore validation.
  • Supervisory Dialogue Audits: A non-participating 3-AI Supervisory Team executes parallel LLM evaluations (Integrity Auditor, Continuity Auditor, Deadlock Auditor) to review round transcripts, recursively escalating anomalies up the tree lineage.
  • Decoupled Dashboards: Dispatches synchronous or asynchronous runtime callbacks (on_status_change, on_activity_added, on_log_append) in order on an isolated background channel, so slow or failing observers cannot block discussions.

(All the features mentioned above have been substantially implemented.)

Top comments (0)