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