parent
2b01f83cb0
commit
1f5476d3a1
@ -1,24 +1,19 @@
|
|||||||
from loguru import logger
|
from loguru import logger
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from swarms import create_agents_from_yaml
|
from swarms.agents.create_agents_from_yaml import create_agents_from_yaml
|
||||||
|
|
||||||
# Load environment variables
|
# Load environment variables
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# Path to your YAML file
|
# Path to your YAML file
|
||||||
yaml_file = "agents_config.yaml"
|
yaml_file = "agents.yaml"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create agents and run tasks (using 'both' to return agents and task results)
|
# Create agents and run tasks (using 'both' to return agents and task results)
|
||||||
agents, task_results = create_agents_from_yaml(
|
task_results = create_agents_from_yaml(
|
||||||
yaml_file, return_type="both"
|
yaml_file, return_type="tasks"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Print the results of the tasks
|
logger.info(f"Results from agents: {task_results}")
|
||||||
for result in task_results:
|
|
||||||
print(
|
|
||||||
f"Agent: {result['agent_name']} | Task: {result['task']} | Output: {result.get('output', 'Error encountered')}"
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {e}")
|
logger.error(f"An error occurred: {e}")
|
||||||
|
Loading…
Reference in new issue