You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
675 B
25 lines
675 B
from loguru import logger
|
|
from dotenv import load_dotenv
|
|
from swarms import create_agents_from_yaml
|
|
|
|
# Load environment variables
|
|
load_dotenv()
|
|
|
|
# Path to your YAML file
|
|
yaml_file = "agents_config.yaml"
|
|
|
|
try:
|
|
# Create agents and run tasks (using 'both' to return agents and task results)
|
|
agents, task_results = create_agents_from_yaml(
|
|
yaml_file, return_type="both"
|
|
)
|
|
|
|
# Print the results of the tasks
|
|
for result in task_results:
|
|
print(
|
|
f"Agent: {result['agent_name']} | Task: {result['task']} | Output: {result.get('output', 'Error encountered')}"
|
|
)
|
|
|
|
except Exception as e:
|
|
logger.error(f"An error occurred: {e}")
|