Skip to content

Feat/agent collaboration#2937

Open
afjcjsbx wants to merge 10 commits into
sipeed:mainfrom
afjcjsbx:feat/agent-collaboration
Open

Feat/agent collaboration#2937
afjcjsbx wants to merge 10 commits into
sipeed:mainfrom
afjcjsbx:feat/agent-collaboration

Conversation

@afjcjsbx
Copy link
Copy Markdown
Collaborator

@afjcjsbx afjcjsbx commented May 24, 2026

📝 Description

This PR introduces a first-class internal Agent Collaboration Bus for PicoClaw.

It adds durable inter-agent communication with:

  • per-agent mailboxes
  • collaboration threads with isolated session history
  • structured message envelopes and delivery state
  • permission-aware routing between agents
  • runtime observability events for message flow
  • new internal tools: agent_request, agent_reply, and agent_inbox

It also routes synchronous delegate calls through the new collaboration runtime when available, while keeping existing multi-agent primitives backward-compatible.

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

Issue: #2929

📚 Technical Context (Skip for Docs)

  • Reference URL: [Task] Add first-class agent-to-agent communication for cooperative workflows #2929
  • Reasoning: The existing delegate / spawn / subagent flow worked well for one-shot delegation, but it did not provide a durable peer-to-peer communication layer between agents. This PR adds a collaboration bus scoped by target_agent_id + thread_id, persists mailbox/thread state, isolates collaboration history from user-facing sessions, enforces communication permissions, and emits runtime events for observability.

🧪 Test Environment

  • Hardware:
  • OS:
  • Model/Provider:
  • Channels:

📸 Evidence (Optional)

Click to view Logs/Screenshots

Validated with targeted tests and linting, including:

  • go test ./pkg/collab ./pkg/config ./pkg/tools ./pkg/agent -run 'TestStore_PersistsThreadsMessagesAndMailboxes|TestCollaborationBus_|TestCollaborationSessionAliases_|TestDelegateTool_Execute_UsesCollaborationRuntimeWhenConfigured|TestAgentConfig_FullParse|TestAgentRegistry_CanCollaborate_RequiresSendAndReceive|TestAgentRegistry_CommunicationDefaults' -count=1
  • golangci-lint run -E govet -E unused ./... --build-tags=goolm,stdjson

Key coverage includes:

  • durable mailbox/thread persistence
  • permission enforcement (allow_send_to / allow_receive_from)
  • explicit replies and async durable replies
  • thread isolation and anti-hijack checks
  • closed-thread rejection
  • delegate migration to the collaboration bus
  • formatting/lint cleanup for the new code paths

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant