- unwind ai
- Posts
- Build an AI Services Agency run by AI Agents
Build an AI Services Agency run by AI Agents
Fully functional multi-agents app built with Agency Swarm (step-by-step instructions)
You might know about agencies that help build software products - with CEOs making strategic decisions, CTOs architecting solutions, developers writing code, and product managers coordinating everything. But can you imagine an agency fully run by AI agents that collaborate to analyze, plan and guide software projects, all working together seamlessly like a real team?
In this tutorial, we'll build exactly that - a multi-agent AI Services Agency where 5 specialized AI agents work together to provide comprehensive project analysis and planning:
CEO Agent: Strategic leader and final decision maker
CTO Agent: Technical architecture and feasibility expert
Product Manager Agent: Product strategy specialist
Developer Agent: Technical implementation expert
Client Success Agent: Marketing strategy leader
For this application, we are using Agency Swarm, a powerful Python framework that makes it easy to create and coordinate multiple AI agents. Unlike simpler frameworks that only handle single agents, Agency Swarm provides built-in features for real team collaboration:
Define specialized roles and behaviors for each agent (like CEO, CTO, Developer)
Enable direct agent-to-agent communication using a message-passing system
Share files and context between agents through a common workspace
Control agent interactions with configurable rules and hierarchies
Run agents asynchronously for parallel processing
Maintain persistent state across conversations
What We’re Building
This implementation creates a digital agency simulation powered by AI agents that collaborate to analyze and plan software projects. Through a clean Streamlit interface, users can input their project details and receive comprehensive analysis and recommendations from a team of specialized AI agents.
The AI Agent Team:
CEO Agent (Project Director) - Strategic leader and decision maker who evaluates project viability, assesses requirements, and aligns team efforts with business goals.
CTO Agent (Technical Architect) - Technical leader who designs system architecture, makes technology choices, and ensures technical feasibility of proposed solutions.
Product Manager Agent - Product strategy specialist who develops roadmaps, defines requirements, and coordinates between technical and business needs.
Developer Agent (Lead Developer) - Technical implementation expert who plans development approach, estimates efforts, and provides technology stack recommendations.
Client Success Agent - Client relationship and strategy leader who develops go-to-market plans, manages expectations, and ensures project success.
How the App Works
Custom Analysis Tools
The agency utilizes specialized tools built with Agency Swarm's framework:
AnalyzeProjectRequirements Tool
Processes project details including name, description, type, and budget
Generates structured analysis of project complexity and requirements
Stores analysis results in shared state for other agents
CreateTechnicalSpecification Tool
Builds technical specifications based on project analysis
Defines architecture type, core technologies, and scalability needs
Creates structured output for development planning
Asynchronous Communication
The system operates in async mode, allowing agents to work simultaneously and communicate efficiently. This enables parallel processing, real-time updates, and smooth coordination between team members.
Agent Communication Flows
Strategic Level
CEO ↔️ All Agents (Strategic oversight and alignment)
CTO ↔️ CEO (Technical feasibility and architecture decisions)
Implementation Level
CTO ↔️ Developer (Technical implementation details)
Product Manager ↔️ Developer (Feature requirements and planning)
Client Level
Product Manager ↔️ Client Success (Product roadmap and delivery)
CEO ↔️ Client Success (Strategic alignment with client needs)
and more!
Prerequisites
Before we begin, make sure you have the following:
Python installed on your machine (version 3.10 or higher is recommended)
Your OpenAI API Key
A code editor of your choice (we recommend VS Code or PyCharm for their excellent Python support)
Basic familiarity with Python programming
Step-by-Step Instructions
Setting Up the Environment
First, let's get our development environment ready:
Clone the GitHub repository:
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
Go to the ai_services_agency folder:
cd rag_tutorials/hybrid_search_rag
Install the required dependencies:
pip install -r requirements.txt
Creating the Streamlit App
Let’s create our app. Create a new file agency.py
and add the following code:
Import required libraries and setup:
• Agency Swarm as the AI agent framework
• Streamlit for the interface
from typing import List, Literal, Dict, Optional
from agency_swarm import Agent, Agency, set_openai_key, BaseTool
from pydantic import Field, BaseModel
import streamlit as st
First, define our project analysis tool:
class AnalyzeProjectRequirements(BaseTool):
project_name: str = Field(...)
project_description: str = Field(...)
project_type: Literal["Web Application", "Mobile App", "API Development",
"Data Analytics", "AI/ML Solution", "Other"] = Field(...)
budget_range: Literal["$10k-$25k", "$25k-$50k", "$50k-$100k", "$100k+"] = Field(...)
class ToolConfig:
name = "analyze_project"
description = "Analyzes project requirements and feasibility"
Define the technical specification tool:
class CreateTechnicalSpecification(BaseTool):
architecture_type: Literal["monolithic", "microservices", "serverless", "hybrid"]
core_technologies: str
scalability_requirements: Literal["high", "medium", "low"]
class ToolConfig:
name = "create_technical_spec"
description = "Creates technical specifications based on project analysis"
Initialize the CEO Agent with project analysis capabilities:
ceo = Agent(
name="Project Director",
description="Experienced CEO with project evaluation expertise",
instructions="""
1. FIRST, use the AnalyzeProjectRequirements tool with:
- project_name: The name from project details
- project_description: The full project description
- project_type: The type of project
- budget_range: The specified budget range
""",
tools=[AnalyzeProjectRequirements],
temperature=0.7
)
Create the CTO Agent for technical architecture:
cto = Agent(
name="Technical Architect",
description="Senior technical architect with system design expertise",
instructions="""
1. WAIT for project analysis completion
2. Use CreateTechnicalSpecification tool with:
- architecture_type: Choose architecture
- core_technologies: List main technologies
- scalability_requirements: Set scalability needs
""",
tools=[CreateTechnicalSpecification]
)
Add Product Manager Agent:
product_manager = Agent(
name="Product Manager",
description="Experienced product manager for delivery excellence",
instructions="""
- Manage project scope and timeline
- Define product requirements
- Create potential products and features
""",
temperature=0.4
)
Create Developer and Client Manager Agents:
developer = Agent(
name="Lead Developer",
description="Senior full-stack developer",
instructions="""
- Plan technical implementation
- Provide effort estimates
- Review feasibility
"""
)
client_manager = Agent(
name="Client Success Manager",
description="Client delivery expert",
instructions="""
- Ensure satisfaction
- Manage expectations
- Handle feedback
"""
)
Set up the Agency with team structure:
agency = Agency(
[
ceo, cto, product_manager, developer, client_manager,
[ceo, cto],
[ceo, product_manager],
[cto, developer],
[product_manager, client_manager]
],
async_mode='threading'
)
Create Streamlit interface:
def main():
st.title("🚀 AI Services Agency")
with st.form("project_form"):
project_name = st.text_input("Project Name")
project_description = st.text_area("Project Description")
col1, col2 = st.columns(2)
with col1:
project_type = st.selectbox("Project Type",
["Web Application", "Mobile App", "API Development"])
timeline = st.selectbox("Timeline",
["1-2 months", "3-4 months", "5-6 months"])
Process project analysis:
try:
ceo_response = agency.get_completion(
message=f"""Analyze this project:
Project Name: {project_name}
Project Description: {project_description}
Project Type: {project_type}
Budget Range: {budget_range}
""",
recipient_agent=ceo
)
Generate technical specifications:
cto_response = agency.get_completion(
message="Review project analysis and create technical specifications",
recipient_agent=cto,
additional_instructions="Choose architecture and technologies"
)
Get product management insights:
pm_response = agency.get_completion(
message=f"Analyze project management: {project_info}",
recipient_agent=product_manager,
additional_instructions="Focus on product-market fit"
)
Display results in tabs:
tabs = st.tabs([
"CEO's Analysis",
"CTO's Specification",
"PM's Plan",
"Dev Plan",
"Client Strategy"
])
with tabs[0]:
st.markdown(ceo_response)
Handle session state:
if 'messages' not in st.session_state:
st.session_state.messages = []
if 'api_key' not in st.session_state:
st.session_state.api_key = None
Running the App
With our code in place, it's time to launch the app.
In your terminal, navigate to the project folder, and run the following command
streamlit run ai_services_agency/agency.py
Streamlit will provide a local URL (typically http://localhost:8501).
Working Application Demo
Conclusion
And you've just built an AI-powered digital agency that simulates a complete software project team! This multi-agent system demonstrates how AI can collaborate to provide comprehensive project analysis and planning, just like a real agency team.
Your AI Services Agency can be enhanced further in several exciting ways:
Add specialized agents for UI/UX design, QA testing, or security analysis
Implement agents for financial planning and resource allocation
Create visual representations of agent communication flows
Connect with project management tools like Jira or Trello
Keep experimenting and refining to build smarter AI solutions!
We share hands-on tutorials like this 2-3 times a week, to help you stay ahead in the world of AI. If you're serious about leveling up your AI skills and staying ahead of the curve, subscribe now and be the first to access our latest tutorials.
Reply