-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove unused mypy warnings for cleaner configuration fr fr 🧹
- Removed `warn_return_type` and `warn_unused_configs` from mypy settings to streamline configuration - Focused on essential type checking options for improved clarity and maintainability no cap, just tidy mypy vibes fr fr
- Loading branch information
1 parent
80500f5
commit def4d55
Showing
4 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Factory for creating and configuring swarms.""" | ||
|
||
from typing import Optional | ||
|
||
from .specs import AgentSpec | ||
from .specs import BusinessUnit | ||
from .swarm import Swarm | ||
|
||
|
||
class SwarmFactory: | ||
"""Factory class for creating and configuring swarms.""" | ||
|
||
@staticmethod | ||
def create_swarm(name: str, description: Optional[str] = None) -> Swarm: | ||
"""Create a new swarm with the given name and description.""" | ||
return Swarm(name=name, description=description) | ||
|
||
@staticmethod | ||
def create_business_unit( | ||
name: str, description: str, objectives: list[str] | ||
) -> BusinessUnit: | ||
"""Create a new business unit with the given specifications.""" | ||
return BusinessUnit( | ||
name=name, | ||
description=description, | ||
agents=[], | ||
objectives=objectives, | ||
) | ||
|
||
@staticmethod | ||
def create_agent( | ||
name: str, | ||
role: str, | ||
capabilities: list[str], | ||
memory_size: Optional[int] = None, | ||
) -> AgentSpec: | ||
"""Create a new agent with the given specifications.""" | ||
return AgentSpec( | ||
name=name, | ||
role=role, | ||
capabilities=capabilities, | ||
memory_size=memory_size if memory_size is not None else 1024, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Specifications for agents and business units in the swarm.""" | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class AgentSpec(BaseModel): | ||
"""Specification for an individual agent in the swarm.""" | ||
|
||
name: str | ||
role: str | ||
capabilities: list[str] | ||
memory_size: int = 1024 | ||
|
||
|
||
class BusinessUnit(BaseModel): | ||
"""A business unit that groups agents together for a specific purpose.""" | ||
|
||
name: str | ||
description: str | ||
agents: list[AgentSpec] | ||
objectives: list[str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Core swarm implementation for orchestrating agents.""" | ||
|
||
from typing import Optional | ||
|
||
from .specs import AgentSpec | ||
from .specs import BusinessUnit | ||
|
||
|
||
class Swarm: | ||
"""A swarm of agents working together to achieve objectives.""" | ||
|
||
def __init__(self, name: str, description: Optional[str] = None) -> None: | ||
"""Initialize a new swarm with a name and optional description.""" | ||
self.name = name | ||
self.description = description | ||
self.business_units: list[BusinessUnit] = [] | ||
self.agents: list[AgentSpec] = [] | ||
|
||
def add_business_unit(self, unit: BusinessUnit) -> None: | ||
"""Add a business unit to the swarm.""" | ||
self.business_units.append(unit) | ||
self.agents.extend(unit.agents) | ||
|
||
def get_agent(self, name: str) -> Optional[AgentSpec]: | ||
"""Get an agent by name.""" | ||
for agent in self.agents: | ||
if agent.name == name: | ||
return agent | ||
return None |