Agent Communication and Coordination
Table of Contents
- Introduction
- Project Structure
- Core Components
- Architecture Overview
- Detailed Component Analysis
- Dependency Analysis
- Performance Considerations
- Troubleshooting Guide
- Conclusion
- Appendices
Introduction
This document describes the agent communication patterns and coordination mechanisms in the multi-agent system. It focuses on:
- BaseAgentHelper common functionality for message formatting, response parsing, and error handling
- Tool registry system enabling dynamic tool injection and agent capability expansion
- Inter-agent messaging protocols: request-response, broadcast, and collaborative workflows
- Coordination strategies for concurrent execution and resource sharing
- Examples of collaboration patterns, conflict resolution, and workflow branching
- Integration with external tools and APIs via standardized interfaces
Project Structure
The multi-agent system spans two primary areas:
- A Python-based chat agent framework under bi-chat with specialized agents and orchestration utilities
- A B-MAD agent configuration and workflow system under _bmad for agent composition and lifecycle
Diagram sources
- [bi_chat/src/agents/base_agent.py]
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/conversation_manager.py]
- [bi-chat/bi_chat/src/agents/data_agent.py]
- [bi-chat/bi_chat/src/agents/general_agent.py]
- [bi-chat/bi_chat/src/agents/knowledge_agent.py]
- [bi-chat/bi_chat/src/agents/report_agent.py]
- [bi-chat/bi_chat/src/agents/summary_agent.py]
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
- [bi-chat/bi_chat/src/agents/tool_base.py]
- [_bmad/_config/agent-manifest.csv]
- [_bmad/bmb/workflows/agent/data/agent-compilation.md]
Section sources
Core Components
- Base Agent: Provides foundational capabilities for message formatting, response parsing, and error handling
- Manager Agent: Coordinates agent interactions, orchestrates workflows, and manages shared resources
- Conversation Manager: Handles conversational context, turn-taking, and session persistence
- Specialized Agents: Data, General, Knowledge, Report, Summary, Calculation, Optimization agents tailored for domain tasks
- Tool Registry and Executor: Dynamic tool injection, capability expansion, and standardized API integration
- B-MAD Agent Manifest and Workflows: Structured agent definitions, templates, and compilation/validation artifacts
Section sources
- [bi-chat/bi_chat/src/agents/base_agent.py]
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/conversation_manager.py]
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
- [_bmad/bmb/workflows/agent/data/agent-compilation.md]
Architecture Overview
The system employs a layered architecture:
- Orchestration Layer: Manager Agent and Conversation Manager coordinate agent activities
- Execution Layer: Specialized agents perform domain-specific tasks
- Tool Layer: Tool Registry and Executor enable dynamic capability expansion
- Configuration Layer: B-MAD manifests and workflows define agent composition and lifecycle
Diagram sources
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/conversation_manager.py]
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
Detailed Component Analysis
Base Agent Helper
The Base Agent encapsulates common functionality for:
- Message formatting: Ensures consistent input/output structures for downstream processing
- Response parsing: Extracts structured data from model outputs
- Error handling: Centralizes error propagation and recovery strategies
Diagram sources
- [bi-chat/bi_chat/src/agents/base_agent.py]
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/conversation_manager.py]
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
Section sources
Tool Registry System
The tool registry enables dynamic tool injection and standardized integration:
- Tool registration: Adds tools with metadata and capabilities
- Tool resolution: Selects appropriate tools per task
- Tool execution: Executes tools with validated parameters and captures results
- Standardized interfaces: Ensures compatibility across external APIs
Diagram sources
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
- [bi-chat/bi_chat/src/agents/tool_base.py]
Section sources
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
- [bi-chat/bi_chat/src/agents/tool_base.py]
Inter-Agent Messaging Protocols
- Request-Response: Manager Agent dispatches structured tasks; agents return formatted responses
- Broadcast: Manager Agent can broadcast updates to specialized agents for awareness
- Collaborative Workflows: Multi-step orchestration with intermediate context updates
Diagram sources
Section sources
Coordination Strategies for Concurrent Execution
- Resource Sharing: Shared conversation context and tool registries
- Conflict Resolution: Manager Agent resolves conflicting requests and prioritizes tasks
- Workflow Branching: Decision points route tasks to appropriate agents based on intent and context
Diagram sources
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/clarification_guard.py]
- [bi-chat/bi_chat/src/agents/complex_task_handler.py]
Section sources
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/clarification_guard.py]
- [bi-chat/bi_chat/src/agents/complex_task_handler.py]
Agent Collaboration Patterns and Examples
- Data Analysis Collaboration: Data Agent prepares insights; Report Agent composes reports; Summary Agent extracts key takeaways
- Knowledge Retrieval: Knowledge Agent cross-references documents; General Agent synthesizes answers
- Calculation and Optimization: Calculation Agent performs computations; Optimization Agent refines solutions iteratively
Diagram sources
- [bi-chat/bi_chat/src/agents/general_agent.py]
- [bi-chat/bi_chat/src/agents/knowledge_agent.py]
- [bi-chat/bi_chat/src/agents/data_agent.py]
- [bi-chat/bi_chat/src/agents/report_agent.py]
- [bi-chat/bi_chat/src/agents/summary_agent.py]
Section sources
- [bi-chat/bi_chat/src/agents/general_agent.py]
- [bi-chat/bi_chat/src/agents/knowledge_agent.py]
- [bi-chat/bi_chat/src/agents/data_agent.py]
- [bi-chat/bi_chat/src/agents/report_agent.py]
- [bi-chat/bi_chat/src/agents/summary_agent.py]
B-MAD Agent Configuration and Workflows
- Agent Manifest: Defines agent capabilities, roles, and dependencies
- Workflows and Templates: Provide structured patterns for agent creation, validation, and compilation
- Validation Artifacts: Ensure agent correctness and consistency across environments
Diagram sources
- [_bmad/_config/agent-manifest.csv]
- [_bmad/bmb/workflows/agent/data/agent-compilation.md]
- [_bmad/bmb/workflows/agent/data/simple-agent-validation.md]
- [_bmad/bmb/workflows/agent/data/module-agent-validation.md]
- [_bmad/bmb/workflows/agent/templates/simple-agent.template.md]
- [_bmad/bmb/workflows/agent/templates/expert-agent-template/expert-agent.template.md]
Section sources
- [_bmad/_config/agent-manifest.csv]
- [_bmad/bmb/workflows/agent/data/agent-compilation.md]
- [_bmad/bmb/workflows/agent/data/understanding-agent-types.md]
- [_bmad/bmb/workflows/agent/templates/agent-plan.template.md]
Dependency Analysis
The system exhibits clear separation of concerns:
- Manager Agent depends on Conversation Manager, Tool Registry, and specialized agents
- Tool Registry depends on Tool Base and Tool Executor
- Specialized agents depend on Base Agent and optional tools
- B-MAD configuration influences agent composition and capabilities
Diagram sources
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/conversation_manager.py]
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
- [bi-chat/bi_chat/src/agents/tool_base.py]
- [bi-chat/bi_chat/src/agents/base_agent.py]
- [_bmad/_config/agent-manifest.csv]
- [_bmad/bmb/workflows/agent/data/agent-compilation.md]
Section sources
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/tool_registry.py]
- [bi-chat/bi_chat/src/agents/tool_executor.py]
- [bi-chat/bi_chat/src/agents/tool_base.py]
- [_bmad/_config/agent-manifest.csv]
Performance Considerations
- Asynchronous tool execution reduces latency for long-running operations
- Caching of conversation context minimizes repeated computation
- Batch tool execution consolidates network calls and improves throughput
- Modular agent design allows selective activation to reduce overhead
Troubleshooting Guide
Common issues and resolutions:
- Tool execution failures: Validate tool schema and parameters; check tool availability in registry
- Conversation drift: Ensure Conversation Manager updates context consistently after each agent turn
- Agent conflicts: Use Manager Agent conflict resolution to prioritize and sequence tasks
- Parsing errors: Verify Base Agent response parsing logic aligns with model output format
Section sources
- [bi-chat/bi_chat/src/agents/tool_executor.py]
- [bi-chat/bi_chat/src/agents/conversation_manager.py]
- [bi-chat/bi_chat/src/agents/manager_agent.py]
- [bi-chat/bi_chat/src/agents/base_agent.py]
Conclusion
The multi-agent system integrates orchestration, specialized execution, and dynamic tooling through a cohesive architecture. The Base Agent provides foundational capabilities, the Manager Agent coordinates interactions, and the Tool Registry expands agent capabilities. B-MAD configuration ensures scalable composition and validation. Together, these components enable robust collaboration, conflict resolution, and efficient resource sharing across concurrent agent execution.
Appendices
- Prompt templates for data analysis tasks are available for agent customization and reuse
- Agent templates and workflows provide reusable patterns for rapid agent development
Section sources