Skip to content

Agent Communication and Coordination

**Referenced Files in This Document** - [[bi_chat/src/agents/base_agent.py]](file/bi-chat/bi-chat/src/agents/base-agent.py) - [[bi_chat/src/agents/bi_agent.py]](file/bi-chat/bi-chat/src/agents/bi-agent.py) - [[bi_chat/src/agents/data_agent.py]](file/bi-chat/bi-chat/src/agents/data-agent.py) - [[bi-chat/bi_chat/src/agents/manager_agent.py]](file/bi-chat/bi-chat/src/agents/manager-agent.py) - [[bi-chat/bi_chat/src/agents/conversation_manager.py]](file/bi-chat/bi-chat/src/agents/conversation-manager.py) - [[bi-chat/bi_chat/src/agents/model_wrapper.py]](file/bi-chat/bi-chat/src/agents/model-wrapper.py) - [[bi-chat/bi_chat/src/agents/prompts/data_analysis_prompts.py]](file/bi-chat/bi-chat/src/agents/prompts/data-analysis-prompts.py) - [[_bmad/_config/agent-manifest.csv]](file/bmad/config/agent-manifest.csv) - [[_bmad/bmb/workflows/agent/data/agent-compilation.md]](file/bmad/bmb/workflows/agent/data/agent-compilation.md) - [[_bmad/bmb/workflows/agent/data/agent-menu-patterns.md]](file/bmad/bmb/workflows/agent/data/agent-menu-patterns.md) - [[_bmad/bmb/workflows/agent/data/agent-metadata.md]](file/bmad/bmb/workflows/agent/data/agent-metadata.md) - [[_bmad/bmb/workflows/agent/data/expert-agent-architecture.md]](file/bmad/bmb/workflows/agent/data/expert-agent-architecture.md) - [[_bmad/bmb/workflows/agent/data/module-agent-validation.md]](file/bmad/bmb/workflows/agent/data/module-agent-validation.md) - [[_bmad/bmb/workflows/agent/data/simple-agent-architecture.md]](file/bmad/bmb/workflows/agent/data/simple-agent-architecture.md) - [[_bmad/bmb/workflows/agent/data/simple-agent-validation.md]](file/bmad/bmb/workflows/agent/data/simple-agent-validation.md) - [[_bmad/bmb/workflows/agent/data/understanding-agent-types.md]](file/bmad/bmb/workflows/agent/data/understanding-agent-types.md) - [[_bmad/bmb/workflows/agent/templates/agent-plan.template.md]](file/bmad/bmb/workflows/agent/templates/agent-plan.template.md) - [[_bmad/bmb/workflows/agent/templates/expert-agent-template/expert-agent.template.md]](file/bmad/bmb/workflows/agent/templates/expert-agent-template/expert-agent.template.md) - [[_bmad/bmb/workflows/agent/templates/simple-agent.template.md]](file/bmad/bmb/workflows/agent/templates/simple-agent.template.md) - [[bi-chat/bi_chat/src/agents/tool_registry.py]](file/bi-chat/bi-chat/src/agents/tool-registry.py) - [[bi-chat/bi_chat/src/agents/tool_executor.py]](file/bi-chat/bi-chat/src/agents/tool-executor.py) - [[bi-chat/bi_chat/src/agents/tool_base.py]](file/bi-chat/bi-chat/src/agents/tool-base.py) - [[bi-chat/bi_chat/src/agents/complex_task_handler.py]](file/bi-chat/bi-chat/src/agents/complex-task-handler.py) - [[bi-chat/bi_chat/src/agents/clarification_guard.py]](file/bi-chat/bi-chat/src/agents/clarification-guard.py) - [[bi-chat/bi_chat/src/agents/report_agent.py]](file/bi-chat/bi-chat/src/agents/report-agent.py) - [[bi-chat/bi_chat/src/agents/summary_agent.py]](file/bi-chat/bi-chat/src/agents/summary-agent.py) - [[bi-chat/bi_chat/src/agents/knowledge_agent.py]](file/bi-chat/bi-chat/src/agents/knowledge-agent.py) - [[bi-chat/bi_chat/src/agents/calculation_agent.py]](file/bi-chat/bi-chat/src/agents/calculation-agent.py) - [[bi-chat/bi_chat/src/agents/general_agent.py]](file/bi-chat/bi-chat/src/agents/general-agent.py) - [[bi-chat/bi_chat/src/agents/optimization_agent.py]](file/bi-chat/bi-chat/src/agents/optimization-agent.py)

Table of Contents

  1. Introduction
  2. Project Structure
  3. Core Components
  4. Architecture Overview
  5. Detailed Component Analysis
  6. Dependency Analysis
  7. Performance Considerations
  8. Troubleshooting Guide
  9. Conclusion
  10. 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

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

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

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

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

Section sources

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

Section sources

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

Section sources

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

Section sources

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

Section sources

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

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