|
|
|
@ -996,8 +996,9 @@ from swarms import AutoSwarm, AutoSwarmRouter, BaseSwarm
|
|
|
|
|
|
|
|
|
|
# Build your own Swarm
|
|
|
|
|
class MySwarm(BaseSwarm):
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
def __init__(self, name="kyegomez/myswarm", *args, **kwargs):
|
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
self.name = name
|
|
|
|
|
|
|
|
|
|
def run(self, task: str, *args, **kwargs):
|
|
|
|
|
# Add your multi-agent logic here
|
|
|
|
@ -1005,8 +1006,8 @@ class MySwarm(BaseSwarm):
|
|
|
|
|
# agent 2
|
|
|
|
|
# agent 3
|
|
|
|
|
return "output of the swarm"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add your custom swarm to the AutoSwarmRouter
|
|
|
|
|
router = AutoSwarmRouter(
|
|
|
|
|
swarms=[MySwarm]
|
|
|
|
@ -1015,7 +1016,7 @@ router = AutoSwarmRouter(
|
|
|
|
|
|
|
|
|
|
# Create an AutoSwarm instance
|
|
|
|
|
autoswarm = AutoSwarm(
|
|
|
|
|
name = "AutoSwarm, an API for all swarms",
|
|
|
|
|
name="kyegomez/myswarm",
|
|
|
|
|
description="A simple API to build and run swarms",
|
|
|
|
|
verbose=True,
|
|
|
|
|
router=router,
|
|
|
|
|