An agentic AI framework with Master Control Program (MCP) supervision
Project description
MindChain: Agentic AI Framework
MindChain is a comprehensive framework for building, deploying, and managing AI agents with a unique Master Control Program (MCP) supervision layer. The architecture enables both simple single-agent workflows and complex multi-agent systems with advanced coordination capabilities.
Installation
Install from PyPI:
pip install mindchain
Core Features
- Master Control Program (MCP): Central supervision system for agent management, monitoring, and orchestration
- Flexible Agent Architecture: Build single agents or complex multi-agent systems
- Memory Management: Contextual memory for improved agent responses
- Policy Enforcement: Control what agents can and cannot do
- Resource Monitoring: Track and limit resource usage
- Agent Orchestration: Coordinate multi-agent workflows with dependency management
Quick Start
import asyncio
from mindchain import MCP, Agent, AgentConfig
async def main():
# Initialize the MCP
mcp = MCP(config={
'log_level': 'INFO',
'policies': {
'allow_external_tools': True,
}
})
# Create agent configuration
config = AgentConfig(
name="ResearchAssistant",
description="Helps with research tasks",
system_prompt="You are a helpful research assistant that provides concise and accurate information."
)
# Create and register an agent
agent = Agent(config)
agent_id = mcp.register_agent(agent)
# Run the agent with MCP supervision
response = await mcp.supervise_execution(
agent_id=agent_id,
task=lambda: agent.run("What are the key benefits of transformer models?")
)
print(response)
# Clean up
mcp.unregister_agent(agent_id)
# Run in an async environment
if __name__ == "__main__":
asyncio.run(main())
Multi-Agent Orchestration
MindChain provides a powerful AgentOrchestrator for coordinating complex multi-agent workflows:
import asyncio
from mindchain import MCP, Agent, AgentConfig, AgentOrchestrator
async def main():
mcp = MCP()
orchestrator = AgentOrchestrator(mcp)
# Create and register multiple agents
agents = []
agent_ids = []
for role in ["Researcher", "Analyst", "Writer"]:
agent = Agent(AgentConfig(
name=role,
description=f"{role} agent",
system_prompt=f"You are a {role.lower()} specialized in your domain."
))
agent_id = mcp.register_agent(agent)
agents.append(agent)
agent_ids.append(agent_id)
# Create a sequential workflow
topic = "Artificial Intelligence in Healthcare"
workflow_id = orchestrator.create_sequential_workflow(
name="Research and Article Creation",
description=f"Research and create an article about: {topic}",
agent_ids=agent_ids,
prompts=[
f"Research the topic: {topic}",
"Analyze this research: {previous_result}",
"Write an article based on: {previous_result}"
]
)
# Execute the workflow
results = await orchestrator.execute_workflow(workflow_id)
# Get the final article from the last step
workflow = orchestrator.get_workflow(workflow_id)
final_step_id = workflow['steps'][-1]['id']
article = results[final_step_id]
print(article)
# Clean up
for agent_id in agent_ids:
mcp.unregister_agent(agent_id)
if __name__ == "__main__":
asyncio.run(main())
Framework Structure
- MCP: Centralized supervision layer
- Agent: Core agent implementation
- Memory: Remembers interactions for context
- Policies: Controls agent behaviors and permissions
- Resources: Manages and limits resource usage
- Orchestrator: Coordinates multi-agent workflows
Running Examples
Explore the included examples to see the framework in action:
# Run the simple agent example
python -m examples.basic_agent.simple_agent
# Run the multi-agent collaboration example
python -m examples.multi_agent.team_collaboration
Command Line Interface
MindChain comes with a built-in CLI:
# Show available commands
python -m mindchain --help
# Run an agent interactively
python -m mindchain run
# Run an agent with a specific query
python -m mindchain run --query "Explain what agentic AI is"
# Use a custom configuration file
python -m mindchain run --config my_agent_config.json
Testing
Run the tests:
pytest
Documentation
For detailed documentation, visit https://md-ali-beg.github.io/mindchain
Contributing
We welcome contributions! See CONTRIBUTING.md for details.
Roadmap
Check out our ROADMAP.md for upcoming features and development plans.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mindchain-0.1.1.tar.gz.
File metadata
- Download URL: mindchain-0.1.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.22 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5a0098caa920987820de7b42b65863842154aebc11c4a40ebf8020819e3311d
|
|
| MD5 |
8f54c0b2a47e734835bb2b3d8c8147ed
|
|
| BLAKE2b-256 |
c5b11cebf35e824c587838a8f4fd529ca18554d052015be1754726ca7226e9f7
|
File details
Details for the file mindchain-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mindchain-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.22 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7187dcbf0036ac9ccd501379218f4fac932ba63f9c18febc313ace0fdfa5eca
|
|
| MD5 |
897de603da2f98249db93159bc1876fc
|
|
| BLAKE2b-256 |
05569bb48ccade9ed91b1698710d694c35df4b35feb68dc39c64e987296cde6a
|