A dynamic, plugin-based multi-agent system built on Microsoft's Agent Framework with automatic tool and agent discovery. Create powerful AI agents with just YAML configuration files - minimal code!
# 1οΈβ£ Manually create tools
from azure.ai.projects.agentic import FunctionTool
def weather_tool():
"""Hard-coded tool definition"""
pass
weather = FunctionTool(weather_tool, ...)
# 2οΈβ£ Manually register in __init__.py
from .weather import weather_tool
from .stock import stock_tool
# ... repeat for every tool
# 3οΈβ£ Hard-code agent configuration
agent = ChatAgent(
name="Weather Agent",
instructions="Long prompt...",
tools=[weather, forecast, ...] # Manual list
)
# 4οΈβ£ Edit Python for every change
# Want to add a tool? Edit 3+ files
# Want to change prompt? Edit Python
# Want new agent? Write more PythonPain Points:
|
# 1οΈβ£ Drop a tool file - auto-discovered!
# tools/weather/humidity.py
@tool(domain="weather", description="...")
def get_humidity(location: str) -> str:
return f"Humidity: 65%"
# Done! β¨ Automatically registered
# 2οΈβ£ Drop a YAML file - instant agent!
# agents/weather_agent.yaml
name: "Weather Assistant"
tool_domains: ["weather"]
instructions: |
You are a weather assistant...
# Done! β¨ Automatically created
# 3οΈβ£ Launch DevUI
python run_devui.py
# All agents & tools auto-discovered! πBenefits:
|
| Metric | Before | After | Improvement |
|---|---|---|---|
| Lines of Code per Tool | 20-30 | 5-8 | 75% reduction |
| Files to Edit per Agent | 3-5 | 1 | 80% reduction |
| Time to Add Tool | 15-20 min | 2-3 min | 85% faster |
| Time to Add Agent | 30-45 min | 5 min | 90% faster |
| Manual Imports | Every tool | Zero | 100% automated |
| Configuration Changes | Edit Python | Edit YAML | Non-technical friendly |
Traditional Approach:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Create tool.py β Edit __init__.py β Import in agent.py β
Create agent class β Register agent β Test β Debug imports β
Restart β Test again
β±οΈ Time: ~45 minutes per agent
This Framework:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Drop tool.py β Drop agent.yaml β Run DevUI
β±οΈ Time: ~5 minutes per agent
π 10x faster development
- Zero-Code Tool Integration: Drop a Python file in
tools/domain/and it's automatically available - Decorator-Based Registration: Simple
@tooldecorator handles all registration - Domain Organization: Tools organized by business domain (weather, stock, email, calendar)
- Tag-Based Filtering: Fine-grained control over which tools each agent gets
- Hot-Reload Support: Modify tools without restarting the system
- YAML-Based Configuration: Define agents declaratively without writing Python
- Zero-Code Agent Creation: Drop a YAML file in
agents/and it's immediately available - Automatic Tool Attachment: Agents automatically discover and attach tools based on domains/tags
- No Manual Registration: No need to edit
__init__.pyor import statements
- Sequential Workflows: Chain agents in sequence for complex workflows
- Parallel Execution: Run multiple agents concurrently with fan-out/fan-in patterns
- Custom Aggregators: Combine parallel results with custom logic
- Multi-Provider LLM Support: Azure OpenAI, OpenRouter, and direct OpenAI with automatic fallback
- DevUI Integration: Built-in web interface for testing and debugging
- Comprehensive Logging: Detailed logs for tool discovery and agent creation
- Mock & Real APIs: Easy toggle between mock data and real API integrations
- Gmail Integration: Full OAuth2 support for real email operations
- OpenRouter Support: Access to 100+ LLM models through a single API
- Type Safety: Full type hints and annotations throughout
- Quick Start
- Installation
- Project Structure
- Core Concepts
- Creating Tools
- Creating Agents
- Running the System
- Examples
- Architecture
- Configuration
- Contributing
- License
- Python 3.11 or higher
- One of the following LLM providers:
- Azure OpenAI (with Azure CLI)
- OpenRouter API key (Get one here)
- Direct OpenAI API key
- Optional:
- Gmail account (for real email features)
- Google Cloud project (for Gmail API)
- Clone the repository
git clone https://github.com/yourusername/agentic-ms.git
cd agentic-ms- Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Configure environment
# Copy example environment file
cp .env.example .env
# Edit with your API keys and configuration
nano .env # or use your preferred editorChoose your LLM provider (edit .env):
-
Option A: OpenRouter (Easiest for testing)
OPENROUTER_API_KEY=sk-or-v1-your-key-here OPENROUTER_MODEL=openai/gpt-4-turbo
-
Option B: Azure OpenAI
az login # Authenticate Azure CLIAZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/ AZURE_OPENAI_DEPLOYMENT=gpt-4o
-
Option C: Direct OpenAI
OPENAI_API_KEY=sk-your-key-here OPENAI_MODEL=gpt-4-turbo-preview
- Optional: Enable Gmail Integration
See Setup Guide - Gmail Section for detailed instructions.
Quick setup:
USE_REAL_EMAIL_API=true
GMAIL_CREDENTIALS_FILE=credentials.json
GMAIL_USER_EMAIL=your.email@gmail.com- Run the DevUI
# Using bun (recommended)
bun run agent
# Or using Python directly
python run_devui.pyOpen http://localhost:8080 in your browser and start chatting with agents!
π New to the project? Check out the Quick Start Guide (5 min setup!)
π For detailed setup instructions, see the Complete Setup Guide
agentic-ms/
βββ agents/ # Agent YAML configurations
β βββ agent_factory.py # Factory for creating agents from YAML
β βββ __init__.py # Auto-discovery of all agents
β βββ weather_agent.yaml # Weather assistant configuration
β βββ stock_agent.yaml # Stock market assistant configuration
β βββ email_agent.yaml # Email assistant configuration
β βββ calendar_agent.yaml # Calendar assistant configuration
β βββ general_openrouter_agent.yaml # OpenRouter-powered agent (NEW)
β
βββ tools/ # Tool library (auto-discovered)
β βββ _decorators.py # @tool decorator for registration
β βββ _registry.py # Central tool registry (singleton)
β βββ _loader.py # Auto-discovery engine
β βββ __init__.py # Package initialization
β β
β βββ weather/ # Weather domain tools
β β βββ current_weather.py
β β βββ forecast.py
β β
β βββ stock/ # Stock market domain tools
β β βββ stock_price.py
β β βββ stock_analysis.py
β β βββ stock_history.py
β β
β βββ email/ # Email domain tools
β β βββ send_email.py
β β βββ read_inbox.py
β β βββ search_emails.py
β β βββ gmail_utils.py # Gmail API integration (NEW)
β β
β βββ calendar/ # Calendar domain tools
β β βββ create_event.py
β β βββ list_events.py
β β βββ find_free_time.py
β β
β βββ common/ # Shared utility tools
β
βββ workflows/ # Workflow orchestrations
β βββ financial_workflow.py # Sequential workflow example
β βββ reusable_workflows.py # Parallel workflow examples
β
βββ docs/ # Documentation
β βββ DYNAMIC_TOOL_ARCHITECTURE.md
β βββ AGENT_WORKFLOW_ARCHITECTURE.md
β βββ PARALLEL_EXECUTION_QUICKSTART.md
β βββ SETUP_GUIDE.md # Complete setup guide (NEW)
β βββ EMAIL_AGENT_DEMO.md
β
βββ demos/ # Demo scripts
β βββ demo_parallel_execution.py
β βββ workflow_runner.py
β
βββ run_devui.py # Launch DevUI with all agents
βββ test_agent_factory.py # Test YAML-based agents
βββ test_auto_discovery.py # Test automatic discovery
βββ requirements.txt # Python dependencies
Tools are Python functions decorated with @tool that provide specific capabilities to agents.
Key Features:
- Automatic discovery via filesystem scanning
- Domain-based organization (weather, stock, email, etc.)
- Tag-based filtering for fine-grained control
- Mock vs real API support
Agents are AI assistants configured via YAML files that automatically discover and use tools.
Key Features:
- Declarative YAML configuration
- Automatic tool attachment based on domains/tags
- Editable prompts without code changes
- Azure OpenAI integration
Workflows orchestrate multiple agents to solve complex tasks.
Types:
- Sequential: Agents run one after another
- Parallel: Agents run concurrently (fan-out/fan-in)
- Custom: Build complex routing and conditional logic
Create a Python file in the appropriate domain folder:
# tools/weather/humidity.py
from typing import Annotated
from tools._decorators import tool
@tool(
domain="weather",
description="Get humidity levels for a location",
tags=["weather", "humidity", "conditions"],
mock=True, # Set to False when using real APIs
)
def get_humidity(
location: Annotated[str, "The location to check humidity for"]
) -> str:
"""Get humidity percentage for a given location.
Args:
location: City name or location string
Returns:
Formatted string with humidity information
"""
# Mock implementation
return f"Humidity in {location}: 65%"The tool is now:
- β Automatically discovered at startup
- β Registered in the tool registry
- β
Available to all agents with
tool_domains: ["weather"]
No code editing, imports, or registration needed!
@tool(
domain: str, # Required: Tool domain (weather, stock, email, etc.)
name: Optional[str], # Optional: Tool name (defaults to function name)
description: Optional[str], # Optional: Description (defaults to docstring)
tags: Optional[list], # Optional: Additional tags for filtering
mock: bool = False, # Optional: Is this a mock implementation?
requires_api_key: Optional[str], # Optional: API key environment variable
)Create a YAML file in the agents/ directory:
# agents/news_agent.yaml
name: "News Assistant"
description: "Provides latest news headlines and articles"
# Tool Discovery - automatically finds matching tools
tool_domains:
- news
tool_tags:
- news
- headlines
- articles
# Optional: Exclude specific tools
# exclude_tools:
# - news.experimental_feature
# Agent Instructions (the "prompt")
instructions: |
You are a news assistant. Provide latest news headlines
and articles when asked. Always cite your sources and
present information objectively.
When users ask about news:
1. Use the appropriate tool to fetch articles
2. Summarize key points clearly
3. Provide source attribution
# Model Configuration - Multi-Provider with Automatic Fallback
model:
# Provider list (will try in order until one succeeds)
providers:
- "openrouter" # Try OpenRouter first (easiest, no auth issues)
- "azure" # Fall back to Azure if available
- "openai" # Fall back to OpenAI if available
# Azure configuration (used if azure provider succeeds)
endpoint: "https://your-azure-openai.openai.azure.com/"
deployment: "gpt-4o"
credential_type: "azure_cli"
# OpenRouter/OpenAI config loaded from environment:
# OPENROUTER_API_KEY, OPENROUTER_MODEL, OPENAI_API_KEYIf the domain doesn't exist, create tools for it:
# tools/news/get_headlines.py
from tools._decorators import tool
@tool(domain="news", description="Get latest news headlines")
def get_headlines(category: str = "general") -> str:
"""Fetch latest news headlines."""
# Implementation here
return "Latest headlines..."python run_devui.pyThe news agent is now automatically:
- β Discovered from the YAML file
- β Created with matching tools attached
- β Available in the DevUI
No Python code editing required!
Launch the development web interface:
python run_devui.pyFeatures:
- Chat with individual agents
- Test workflows
- View agent capabilities
- Debug tool calls
Use agents programmatically:
from agents import get_all_agents
import asyncio
async def main():
# Get all auto-discovered agents
agents = get_all_agents()
# Use weather agent
weather_agent = agents['weather_agent']
response = await weather_agent.run("What's the weather in Tokyo?")
print(response)
asyncio.run(main())Run the test suites:
# Test tool discovery
python -c "from tools import ToolRegistry; print(ToolRegistry().get_summary())"
# Test agent creation
python test_agent_factory.py
# Test automatic discovery
python test_auto_discovery.pyfrom agents import get_all_agents
import asyncio
async def main():
agents = get_all_agents()
weather_agent = agents['weather_agent']
response = await weather_agent.run(
"What's the weather forecast for Seattle this week?"
)
print(response)
asyncio.run(main())from agent_framework import SequentialBuilder
from agents import get_all_agents
agents = get_all_agents()
stock_agent = agents['stock_agent']
weather_agent = agents['weather_agent']
workflow = (
SequentialBuilder()
.add_agent(stock_agent)
.add_agent(weather_agent)
.build()
)
# Execute: stock analysis β weather check
result = await workflow.run("Analyze AAPL and check weather in Cupertino")from agent_framework import ConcurrentBuilder
from agents import get_all_agents
agents = get_all_agents()
workflow = (
ConcurrentBuilder()
.participants([agents['stock_agent'], agents['weather_agent']])
.build()
)
# Both agents run simultaneously
result = await workflow.run("Get AAPL price and Seattle weather")# tools/news/search_articles.py
from typing import Annotated
from tools._decorators import tool
@tool(
domain="news",
description="Search news articles by keyword",
tags=["news", "search", "articles"],
mock=True
)
def search_articles(
query: Annotated[str, "Search query"],
days: Annotated[int, "Days to look back"] = 7
) -> str:
"""Search for news articles matching the query."""
return f"Found 10 articles about '{query}' from last {days} days"βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MS-AGENTIC FRAMEWORK ACCELERATOR β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β AGENT LAYER (YAML) β β
β β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β β
β β β Weather Agentβ βCalendar Agentβ β Stock Agent β β β
β β β .yaml β β .yaml β β .yaml β β β
β β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β β
β βββββββββββΌβββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββ β
β β β β β
β βββββββββββΌβββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββ β
β β AGENT FACTORY (Dynamic Discovery) β β
β β β’ YAML Parser β’ Tool Discovery Integration β β
β β β’ Chat Client β’ Multi-Provider Fallback β β
β β β’ Context Injector β’ Azure/OpenRouter/OpenAI Support β β
β βββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β TOOL REGISTRY & DISCOVERY ENGINE β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β Automatic Tool Discovery β β β
β β β β’ Recursive directory scanning β β β
β β β β’ @tool decorator detection β β β
β β β β’ Metadata extraction β β β
β β β β’ Dynamic registration β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β Tool Registry (Singleton) β β β
β β β β’ Domain filtering (weather, calendar, stock) β β β
β β β β’ Tag filtering (forecast, event, price) β β β
β β β β’ Metadata storage (docs, params, types) β β β
β β β β’ Hot-reload support β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ β
β β TOOL DOMAINS (4 Active Domains) β β
β β β β
β β ββββββββββββββ ββββββββββββββ βββββββββββ ββββββββββββ β β
β β β WEATHER β β CALENDAR β β STOCK β β EMAIL β β β
β β β Domain β β Domain β β Domain β β Domain β β β
β β ββββββββββββββ€ ββββββββββββββ€ βββββββββββ€ ββββββββββββ€ β β
β β β current_ β β create_ β β stock_ β β send_ β β β
β β β weather β β event β β price β β email β β β
β β β β β β β β β β β β
β β β forecast β β list_ β β stock_ β β read_ β β β
β β β β β events β β analysisβ β inbox β β β
β β β β β β β β β β β β
β β β β β delete_ β β stock_ β β search_ β β β
β β β β β event β β history β β emails β β β
β β β β β β β β β β β β
β β β β β find_free_ β β β β organize β β β
β β β β β time β β β β _email β β β
β β β β β β β β β β β β
β β β (2 tools) β β (4 tools) β β(3 tools)β β (4 tools)β β β
β β ββββββββββββββ ββββββββββββββ βββββββββββ ββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ β
β β DEVUI & ORCHESTRATION β β
β β β’ Web-based UI for agent interaction β β
β β β’ Real-time tool discovery display β β
β β β’ Auto-startup agent loading β β
β β β’ Sequential & parallel workflow execution β β
β β β’ Live execution monitoring β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β START: run_devui.py β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β ToolLoader.discover_tools() β
β β’ Scans tools/ directory β
β β’ Recursively walks subdirectories β
β β’ Finds all .py files β
βββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββΌββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β tools/ β β tools/ β β tools/ β
β weather/ β β calendar/ β β stock/ β
β β β β β β
β current_ β β create_ β β stock_ β
β weather.py β β event.py β β price.py β
β β β β β β
β forecast.py β β list_ β β stock_ β
β β β events.py β β analysis.py β
β β β β β β
β β β delete_ β β stock_ β
β β β event.py β β history.py β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β β β
βββββββββββββββΌββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β For each file: β
β β’ Import module dynamically β
β β’ Find @tool decorated functions β
β β’ Extract metadata β
β β’ Register in ToolRegistry β
βββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β ToolRegistry (Singleton) β
β _tools = { β
β "weather.current_weather": {...},β
β "calendar.create_event": {...}, β
β "stock.stock_price": {...}, β
β ... β
β } β
β β
β β 11+ tools registered β
β β 4 domains active β
βββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AgentFactory.discover_all_agents() β
β β’ Scans agents/ directory for *.yaml files β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββ΄βββββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β weather_agent.yaml β β stock_agent.yaml β
β βββββββββββββββββββββββββ β βββββββββββββββββββββββββ
β β 1. Load YAML config ββ β β 1. Load YAML config ββ
β β ββ β β ββ
β β 2. Parse domains: ββ β β 2. Parse domains: ββ
β β [weather] ββ β β [stock, weather] ββ
β β ββ β β ββ
β β 3. Query registry: ββ β β 3. Query registry: ββ
β β get_tools_by_ ββ β β get_tools_by_ ββ
β β domain("weather") ββ β β domain("stock") ββ
β β ββ β β ββ
β β 4. Results: ββ β β 4. Results: ββ
β β [current_weather, ββ β β [stock_price, ββ
β β forecast] ββ β β stock_analysis, ββ
β β ββ β β stock_history] + ββ
β β 5. Build client: ββ β β [current_weather] ββ
β β Try providers: ββ β β ββ
β β - OpenRouter β ββ β β 5. Build client: ββ
β β ββ β β Try providers: ββ
β β 6. Inject context: ββ β β - OpenRouter β ββ
β β Add tool docs to ββ β β ββ
β β instructions ββ β β 6. Inject context ββ
β β ββ β β ββ
β β 7. Create ChatAgent ββ β β 7. Create ChatAgent ββ
β β β Ready! ββ β β β Ready! ββ
β βββββββββββββββββββββββββ β βββββββββββββββββββββββββ
ββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββ
β All agents loaded: β
β { β
β 'weather_agent': <ChatAgent>, β
β 'calendar_agent': <ChatAgent>, β
β 'stock_agent': <ChatAgent>, β
β 'email_agent': <ChatAgent> β
β } β
ββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββ
β StartupLogger displays: β
β β’ Tools discovered by domain β
β β’ Agents created β
β β’ Agent β Tool mappings β
β β’ Model provider info β
ββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββ
β DevUI Server Launch β
β serve(entities=agents) β
β β http://localhost:8080 β
ββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent YAML Configuration β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β model: β β
β β providers: β Try in order β β
β β - "openrouter" β 1st: Easy, no auth β β
β β - "azure" β 2nd: Enterprise β β
β β - "openai" β 3rd: Direct API β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ
βOpenRouterβ β Azure β β OpenAI β
β Client β β OAI Clientβ β Client β
βββββββ¬βββββ βββββββ¬βββββ βββββββ¬βββββ
β β β
β Try connect β β
Success? ββΌβ YES βββ β β
β β β β
β NO ββββΌβββββββΌβ Try Azure β
β β β β
β β Success? ββββ β
β β β β β
β β NO ββΌβββββββΌββ Try OpenAI
β β β β β
β β β Success? ββββ€
β β β β
βΌ βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββ
β Return working client to AgentFactory β
β β’ Zero config changes needed β
β β’ Automatic failover β
β β’ Production-ready reliability β
ββββββββββββββββββββββββββββββββββββββββββββ
User launches application
β
βΌ
run_devui.py
β
βββΊ Load environment (.env)
β
βββΊ Import agents package
β β
β βββΊ agents/__init__.py
β β
β βββΊ AgentFactory()
β β
β βββΊ discover_all_agents()
β β
β βββΊ Scan agents/*.yaml
β β
β βββΊ For each YAML:
β β
β βββΊ Parse config
β β
β βββΊ Query ToolRegistry
β β βββΊ get_tools_by_domain()
β β
β βββΊ Build chat client
β β βββΊ Try providers
β β
β βββΊ Inject tool context
β β βββΊ Enhance instructions
β β
β βββΊ Create ChatAgent
β
βββΊ Get discovery data
β βββΊ {agents, tools_by_domain, mappings}
β
βββΊ Print startup summary
β βββΊ Beautiful CLI output
β
βββΊ Start DevUI server
βββΊ serve() β http://localhost:8080
β
βββΊ Browser auto-opens
β
βββΊ User interacts with agents
β
βββΊ Agents use tools dynamically
The ToolRegistry maintains a central registry of all discovered tools with powerful query capabilities:
Core Operations:
get_tools_by_domain(domain)- Filter by domain (weather, calendar, etc.)get_tools_by_tags(tags)- Filter by tags (forecast, event, etc.)get_tool(tool_id)- Get specific tool by IDlist_domains()- Get all available domainsget_summary()- Get registry statistics
Example:
from tools import ToolRegistry
registry = ToolRegistry()
# Get all weather tools
weather_tools = registry.get_tools_by_domain("weather")
# Returns: [current_weather, forecast]
# Get all tools tagged with "event"
event_tools = registry.get_tools_by_tags(["event"])
# Returns: [create_event, delete_event, list_events]
# Get summary
summary = registry.get_summary()
# {
# 'total_tools': 11,
# 'domains': ['weather', 'calendar', 'stock', 'email'],
# 'tools_by_domain': {...}
# }All agents now support automatic provider fallback - if one provider fails (e.g., Azure auth issues), the system automatically tries the next provider in the list.
How it works:
- Agent YAML specifies a list of providers to try
- System attempts each provider in order
- First successful provider is used
- If all fail, error is reported
Example configuration:
model:
providers:
- "openrouter" # Try first (easiest, no Azure auth needed)
- "azure" # Try second (if Azure CLI is authenticated)
- "openai" # Try third (if OpenAI API key is set)Benefits:
- β No more agent failures due to Azure auth issues
- β Seamless switching between providers
- β Development-friendly (OpenRouter) with production Azure support
- β Zero code changes needed
Supported Providers:
- OpenRouter: Access 100+ models via single API key
- Azure OpenAI: Enterprise-grade Azure integration
- OpenAI: Direct OpenAI API access
name: "Agent Name" # Required: Display name
description: "Agent description" # Required: Short description
tool_domains: # Optional: Domain filters
- domain1
- domain2
tool_tags: # Optional: Tag filters
- tag1
- tag2
exclude_tools: # Optional: Tools to exclude
- tool.name
instructions: | # Required: Agent prompt
Your instructions here...
# Model Configuration - Multi-Provider Support
model:
# Provider list (tries in order until one succeeds)
providers: # Required: List of providers to try
- "openrouter" # Recommended first choice
- "azure" # Fallback to Azure
- "openai" # Fallback to OpenAI
# Azure OpenAI configuration
endpoint: "https://..." # Azure OpenAI endpoint
deployment: "model-name" # Deployment name
credential_type: "azure_cli" # azure_cli or api_key
# OpenRouter/OpenAI config (from environment)
# OPENROUTER_API_KEY, OPENROUTER_MODEL
# OPENAI_API_KEY, OPENAI_MODELCreate a .env file for API keys:
# ============================================================================
# LLM Provider Configuration (choose one or all for automatic fallback)
# ============================================================================
# OpenRouter (Recommended for development - easiest setup)
OPENROUTER_API_KEY=sk-or-v1-your-key-here
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_MODEL=openai/gpt-4o-mini
OPENROUTER_APP_NAME=your-app-name
# Azure OpenAI (Enterprise production use)
AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/
AZURE_OPENAI_DEPLOYMENT=gpt-4o
AZURE_OPENAI_API_VERSION=2024-02-15-preview
# Note: Also requires `az login` for azure_cli authentication
# Direct OpenAI (Alternative to Azure)
OPENAI_API_KEY=sk-your-key-here
OPENAI_MODEL=gpt-4-turbo-preview
# ============================================================================
# Optional: Real API keys for tools
# ============================================================================
OPENWEATHER_API_KEY=your_key_here
ALPHA_VANTAGE_API_KEY=your_key_here
# ============================================================================
# Gmail Integration (Optional)
# ============================================================================
USE_REAL_EMAIL_API=true
GMAIL_CREDENTIALS_FILE=credentials.json
GMAIL_TOKEN_FILE=token.json
GMAIL_USER_EMAIL=your.email@gmail.com@tool(
domain="your_domain", # Required
name="tool_name", # Optional
description="What it does", # Optional
tags=["tag1", "tag2"], # Optional
mock=True, # Use mock data (True/False)
requires_api_key="API_KEY_ENV" # Environment variable name
)We welcome contributions! Here's how to get started:
- Fork the repository
- Clone your fork
- Create a virtual environment
- Install dependencies:
pip install -r requirements.txt - Create a branch:
git checkout -b feature/your-feature
- Create domain folder:
mkdir tools/your_domain - Add
__init__.py:touch tools/your_domain/__init__.py - Create tools: Add Python files with
@tooldecorators - Create agent YAML: Add
agents/your_domain_agent.yaml - Test: Run
python test_auto_discovery.py - Submit PR: Create a pull request with your changes
- Follow PEP 8 guidelines
- Use type hints for all functions
- Add docstrings to all public functions
- Use meaningful variable names
- Keep functions focused and small
Before submitting a PR:
# Test tool discovery
python -c "from tools import ToolRegistry; ToolRegistry().get_summary()"
# Test agent creation
python test_agent_factory.py
# Test your new domain
python test_auto_discovery.py- Update documentation for new features
- Add examples if adding new capabilities
- Ensure all tests pass
- Update README if needed
- Describe changes in PR description
Comprehensive documentation available in the docs/ folder:
- Dynamic Tool Architecture: Complete guide to the tool system
- Agent Workflow Architecture: Sequential and parallel workflows
- Parallel Execution Quickstart: Quick guide to parallel patterns
- Email Agent Demo: Step-by-step example of creating an agent
Problem: Tools not showing up in registry
Solution:
- Check file is in
tools/domain/directory - Ensure
@tooldecorator is present - Verify
__init__.pyexists in domain folder - Check logs for import errors
Problem: Agent YAML file not creating agent
Solution:
- Verify YAML syntax is correct
- Check domain names match tool domains
- Ensure Azure OpenAI credentials are configured
- Check logs for errors during discovery
Problem: Azure OpenAI connection fails
Solution:
- Verify endpoint URL is correct (must include
.azure.com) - Check Azure CLI is authenticated:
az account show - Verify deployment name matches your Azure setup
- Check network connectivity
The system includes 4 pre-built agents with 11 tools across 4 domains:
- Tools: 2 (current weather, forecast)
- Use Cases: Weather forecasts, current conditions
- Example: "What's the weather in Tokyo?"
- Tools: 3 (price, analysis, history)
- Use Cases: Stock prices, analyst ratings, historical data
- Example: "Analyze AAPL stock"
- Tools: 3 (send, read inbox, search)
- Use Cases: Email management, inbox checking
- Example: "Show me my unread emails"
- Tools: 3 (create event, list events, find free time)
- Use Cases: Schedule management, availability checking
- Example: "Find me a free slot tomorrow afternoon"
This project is licensed under the MIT License - see the LICENSE file for details.
- Microsoft Agent Framework: Core agent orchestration framework
- Azure OpenAI: LLM infrastructure
- Contributors: Thanks to all contributors who help improve this project
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- β Dynamic tool discovery
- β Automatic agent discovery
- β YAML-based configuration
- β Sequential workflows
- β Parallel workflows
- β DevUI integration
- π MCP Server implementation
- π Real API integrations (OpenWeatherMap, Alpha Vantage)
- π Tool versioning system
- π Agent performance monitoring
- π Hot-reload without restart
- π Plugin marketplace
- Multiple LLM provider support (OpenAI, Anthropic, etc.)
- Tool dependency management
- Conditional workflow routing
- Agent-to-agent communication
- Distributed agent execution
- Web-based agent configuration UI
Made with β€οΈ using Microsoft Agent Framework
Star β this repo if you find it useful!