coordinator
MCP agent management utilities for the MADA multi-agent system.
This module defines the MCPAgentManager class, a reusable base for managing
agents that interact with MCP (Model Context Protocol) tool servers.
Responsibilities of this module include: - Creating and configuring chat agents with model and instruction settings - Instantiating an OpenAI-compatible model client for use by agents
Typical usage
Subclass MCPAgentManager to implement specific session logic (e.g., console or web UI),
then call create_chat_agent() with an AgentConfig to instantiate tool-using agents.
MCPAgentManager
Base class for managing agent creation with MCP (Model Context Protocol) tools.
This class provides shared functionality for creating agents and managing model client configuration. It can be extended by different implementations for console or web UI integrations.
Attributes:
| Name | Type | Description |
|---|---|---|
model_config |
ModelConfig
|
Configuration for the model client. |
timeout |
int
|
Timeout in seconds for server operations. |
model_client |
BaseChatClient
|
Client for generating chat responses. |
Methods:
| Name | Description |
|---|---|
create_chat_agent |
Given an agent configuration, create an Agent. |
Source code in src/mada/core/coordinator.py
__init__(model_config=None, timeout=86400)
Initialize the MCP agent manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_config
|
Optional[ModelConfig]
|
Configuration for the model client. If None, uses environment variables. |
None
|
timeout
|
int
|
Timeout in seconds for server operations. |
86400
|
Source code in src/mada/core/coordinator.py
create_chat_agent(agent_config, tools=None, **kwargs)
async
Create an Agent from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_config
|
AgentConfig
|
Configuration for the agent. |
required |
tools
|
List[Any]
|
List of tools to provide to the agent. |
None
|
**kwargs
|
Dict[str, Any]
|
Additional arguments to pass to Agent constructor. |
{}
|
Returns:
| Type | Description |
|---|---|
Agent
|
The created Agent. |