AskTheApi Team Builder
Agent network builder for communicating with openapi apis. Based in autogen
AlexAlbala
README
AskTheApi Team Builder
A high-level Python library for building and managing networks of autonomous agents that collaborate to solve complex tasks. It's designed to work seamlessly with APIs defined using the OpenAPI standard. The library provides a clean, type-safe interface for creating, configuring, and running teams of agents, making it easy to orchestrate multi-agent workflows with minimal boilerplate.
Features
-
🚀 Effortless Agent Network Creation: Quickly build agent networks with custom tools and capabilities based on OpenAPI specifications.
-
🤝 Team-Based Collaboration: Easily define agent teams with automatic coordination handled by a built-in planning agent.
-
📡 Streaming Interactions: Stream agent communication in real-time for more dynamic and responsive workflows.
-
🔧 Built-in HTTP Client: Simplify tool implementation with an integrated HTTP client ready to call external APIs.
-
✨ Type Safety with Pydantic: Leverage Pydantic models for robust data validation and clear type definitions.
-
🎯 Clean and Intuitive API: Designed for developers—minimal boilerplate, maximum clarity.
Installation
pip install asktheapi-team-builder
Quick Start
Here's how to use the package:
1. Create agents from OpenAPI spec
from asktheapi_team_builder import TeamBuilder, Agent, Tool, Message, APISpecHandler
from typing import List
async def create_agents_from_spec():
# Initialize handlers
api_spec_handler = APISpecHandler()
# Download and parse OpenAPI spec
spec_content = await api_spec_handler.download_url_spec("https://api.example.com/openapi.json")
# Classify endpoints into logical groups
classification_result = await api_spec_handler.classify_spec(
spec_content
)
# Generate agents for each group
agents = []
for group_spec in classification_result.specs:
agent_result = await api_spec_handler.generate_agent_for_group(
group_spec,
spec_content
)
agents.append(agent_result)
return agents
2. Build and run a team
async def run_agent_team(agents: List[Agent], query: str):
# Initialize team builder
team_builder = TeamBuilder(
model="gpt-4",
model_config={"temperature": 0.7}
)
# Build the team
team = await team_builder.build_team(agents)
# Create messages
messages = [
Message(
role="user",
content=query
)
]
# Run the team with streaming
async for event in team_builder.run_team(team, messages, stream=True):
if isinstance(event, ChatMessage):
print(f"{event.source}: {event.content}")
Example usage
async def main():
# Create agents from spec
api_agents = await create_agents_from_spec()
# Combine with manual agents
all_agents = [weather_agent] + api_agents
# Run the team
await run_agent_team(
all_agents,
"What's the weather like in London and how might it affect local businesses?"
)
Custom Headers and Configuration
You can configure the team builder with custom headers and model settings:
team_builder = TeamBuilder(
model="gpt-4",
model_config={
"temperature": 0.7,
"default_headers": {
"Authorization": "Bearer your-token",
"Custom-Header": "custom-value"
}
}
)
# Run team with extra headers for specific requests
team = await team_builder.build_team(agents)
result = await team_builder.run_team(
team,
messages,
extra_headers={"Request-ID": "123"}
)
MCP (Model Control Protocol) Support
The library includes built-in support for Model Control Protocol, allowing you to expose your agent teams as API endpoints with automatic tool generation from OpenAPI specifications.
from asktheapi_team_builder import MCPService, MCPConfig
# Configure MCP service
mcp_config = MCPConfig(
transport="sse", # Server-Sent Events transport
port=8000, # Port to run the MCP server
name="asktheapi_mcp" # Service name
)
# Initialize MCP service
mcp_service = MCPService(mcp_config)
# Start MCP server with OpenAPI spec
await mcp_service.start_from_spec(
url_spec="https://api.example.com/openapi.json",
headers={"Authorization": "Bearer your-token"}
)
The MCP service will:
- Automatically download and parse the OpenAPI specification
- Classify endpoints into logical groups
- Generate appropriate tools for each group
- Expose these tools through a Model Control Protocol interface
- Handle real-time streaming of agent interactions
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Development Setup
# Clone the repository
git clone https://github.com/alexalbala/asktheapi-team-builder.git
cd asktheapi-team-builder
# Install dependencies
pip install -e ".[dev]"
# Run tests
pytest
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built on top of Microsoft's AutoGen
- Inspired by the need for a higher-level interface for agent team management
推荐服务器
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
MCP Package Docs Server
促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。
Claude Code MCP
一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。
@kazuph/mcp-taskmanager
用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。
mermaid-mcp-server
一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。
Jira-Context-MCP
MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

Linear MCP Server
一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

Sequential Thinking MCP Server
这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。
Curri MCP Server
通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。