A high-level library for building and managing teams of AutoGen agents
Project description
AskTheApi Team Builder
A high-level Python library for easily building and managing autonomous agents networks that solve complex tasks using APIs defined with OpenAPI standard format. This package provides a clean, type-safe interface for creating, configuring, and running teams of agents that can work together to solve complex tasks.
Features
- 🚀 Easy creation of agent networks with custom tools and capabilities based on openAPI specification
- 🤝 Team building with automatic coordination through a planning agent
- 📡 Support for streaming agent interactions
- 🔧 Built-in HTTP client for tool implementation
- ✨ Pydantic models for type safety and validation
- 🎯 Clean, intuitive API design
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(llm_service) # llm_service is your LLM provider
# 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
# 3. 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"}
)
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
Project details
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 asktheapi_team_builder-0.2.0.tar.gz.
File metadata
- Download URL: asktheapi_team_builder-0.2.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82e265a6694a7a42a9d375801722fa9284ee06d9fc50547515dd66aaf1f785e9
|
|
| MD5 |
87f961696dac221645039ad52c1e796b
|
|
| BLAKE2b-256 |
6f16bb4f765654c71f2cf7ea015aa88b37381ce727e3ff4aa090179d65e55e02
|
File details
Details for the file asktheapi_team_builder-0.2.0-py3-none-any.whl.
File metadata
- Download URL: asktheapi_team_builder-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f03766ba71f699d192e47081e6ed9f539dc9e159a0a60a97f8da29a783472f65
|
|
| MD5 |
abc86c50bda75434649315655f2066fe
|
|
| BLAKE2b-256 |
4cf549863bbae04eea3134625dc8b2805529c8b7813491b383b879c7e48115bf
|