Here is the tasks.yaml
research_task_find_name:
description: >
description: >
Conduct a thorough research about {email}
Make sure you find surname, name a for the given email {email}
expected_output: >
Surname, name of the given email {email}
agent: researcher
research_task_find_organization:
description: >
Conduct a thorough research about {email}
Make sure you find organization for the given email {email}
expected_output: >
organisation_name to which the given email {email} belongs to
agent: researcher
ums_organization_task:
description: >
Based on the found organization hand over the organization_name to the ums_organization_tool.
expected_output: >
The organizatuion_name and the organization_identifier
agent: ums_org_agent
context: ["research_task_find_organization"]
ums_user_task:
description: >
Based on the given email adress {email} and the organization_identifier from the ums_organization_task hand over both parameters to the ums_user_tool
expected_output: >
"CREATED" if the user is created, "EXIST" is the user is part of the list. In both cases the log-on-id of the user, the user_identifier and the organization identifier the user belongs to.
agent: ums_user_agent
context: ["research_task_find_organization","research_task_find_name"]
FileTransferServerConfiguration_task:
description: >
Based on the found user_identifier, the given email adress {email} and the organization_identifier handover these parameters to the fts_account_tool
expected_output: >
"CREATED" if the account is created, "EXIST" is the account is part of the list. In both cases the log-on-id and the fts_account_identifier of the account
agent: file_transfer_server_agent
context: ["research_task_find_organization","research_task_find_name","ums_user_task"]
Here the agents.yaml
researcher:
role: >
Senior Data Researcher
goal: >
Find the name, surname and organization for the given emailadress {email}. Handover the organization to the ums_org_agent as input. Find only verified information and pass it on to the crew
backstory: >
You're a seasoned researcher with a knack for uncovering the latest
information for the mailadress {email}. Known for your ability to find the most relevant
information and present it in a clear and concise manner. You are a reliable agent that only provides checked and verified data and does not make assumptions.
ums_org_agent:
role: >
Senior operator and UMS specialist
goal: >
Comapre the UMS listing with the given Organization name. If the organization is in the list return "EXIST" and the name and the org_identifier to the crew.
If the organization name is not in the list create a new organization in UMS and return "NEW" and the name and the org_identifier to the crew
backstory: >
You are an seasoned operator with a lot of onboarding skills. You can compare listes of organizations with a given organization and you can create new organizations in UMS
ums_user_agent:
role: >
Senior operator and user UMS specialist
goal: >
Comapre the UMS user listing with the found email address {email}. If the user is in the list return "EXIST" else create the user.Provide the name, the log-on-id and the user_identifier to the crew
backstory: >
You are an seasoned operator with a lot of onboarding skills. You can compare listes of user email adresses with a given email address and you are able to create a new user within the correct organization
file_transfer_server_agent:
role: >
Senior operator and BIS File Transfer Server specialist
goal: >
Comapre the BIS File Transfer Server account listing with the user_identifier provided by the crew. If the user is in the list return "EXIST" else create a new account. Make use of the org_identifier from the created or found provided by the crew.
backstory: >
You are an seasoned operator with a lot of BIS File Transfer Server skills. You can compare list of accounts, wherein the identifier of a user will be listed or not.
the crew.py
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from ftsonboarding2.tools.fts_account_tool import FTSAccountTool
from ftsonboarding2.tools.ums_user_tool import UmsUserTool
from ftsonboarding2.tools.ums_organization_tool import UmsOrganizationTool
ums_organization_tool = UmsOrganizationTool()
ums_user_tool = UmsUserTool()
fts_account_tool = FTSAccountTool()
# Uncomment the following line to use an example of a custom tool
# from ftsonboarding2.tools.custom_tool import MyCustomTool
# Check our tools documentations for more information on how to use them
# from crewai_tools import SerperDevTool
@CrewBase
class Ftsonboarding2Crew():
"""Ftsonboarding2 crew"""
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'],
# tools=[MyCustomTool()], # Example of custom tool, loaded on the beginning of file
verbose=True
)
@agent
def ums_org_agent(self) -> Agent:
return Agent(
config=self.agents_config['ms_org_agent'],
tools=[ums_organization_tool],
verbose=True
)
@agent
def ums_user_agent(self) -> Agent:
return Agent(
config=self.agents_config['ums_user_agent'],
tools=[ums_user_tool],
verbose=True
)
@agent
def file_transfer_server_agent(self) -> Agent:
return Agent(
config=self.agents_config['file_transfer_server_agent'],
tools=[fts_account_tool],
verbose=True
)
@task
def research_task_find_name(self) -> Task:
return Task(
config=self.tasks_config['research_task_find_name'],
)
@task
def research_task_find_organization(self) -> Task:
return Task(
config=self.tasks_config['research_task_find_organization'],
)
@task
def ums_organization_task(self) -> Task:
return Task(
config=self.tasks_config['ums_organization_task'],
)
@task
def ums_user_task(self) -> Task:
return Task(
config=self.tasks_config['ums_user_task'],
)
@task
def FileTransferServerConfiguration_task(self) -> Task:
return Task(
config=self.tasks_config['FileTransferServerConfiguration_task'],
)
@crew
def crew(self) -> Crew:
"""Creates the Ftsonboarding2 crew"""
return Crew(
agents=self.agents, # Automatically created by the @agent decorator
tasks=self.tasks, # Automatically created by the @task decorator
process=Process.sequential,
verbose=True
# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
)
And the main.py
#!/usr/bin/env python
import sys
from ftsonboarding2.crew import Ftsonboarding2Crew
# This main file is intended to be a way for you to run your
# crew locally, so refrain from adding unnecessary logic into this file.
# Replace with inputs you want to test with, it will automatically
# interpolate any tasks and agents information
def run():
email = input("Bitte geben Sie Ihre E-Mail-Adresse ein: ")
inputs = {
'email': email
}
Ftsonboarding2Crew().crew().kickoff(inputs=inputs)
def train():
"""
Train the crew for a given number of iterations.
"""
inputs = {
"topic": "AI LLMs"
}
try:
Ftsonboarding2Crew().crew().train(n_iterations=int(sys.argv[1]), filename=sys.argv[2], inputs=inputs)
except Exception as e:
raise Exception(f"An error occurred while training the crew: {e}")
def replay():
"""
Replay the crew execution from a specific task.
"""
try:
Ftsonboarding2Crew().crew().replay(task_id=sys.argv[1])
except Exception as e:
raise Exception(f"An error occurred while replaying the crew: {e}")
def test():
"""
Test the crew execution and returns the results.
"""
inputs = {
"topic": "AI LLMs"
}
try:
Ftsonboarding2Crew().crew().test(n_iterations=int(sys.argv[1]), openai_model_name=sys.argv[2], inputs=inputs)
except Exception as e:
raise Exception(f"An error occurred while replaying the crew: {e}")
Do you need anything else?
Thx in advanced
Frank