from your_module import Agent, Task, Crew, Process, add_json_to_vectorDB, llm_model
Manager Agent
manager = Agent(
role=“Manager Agent”,
goal=f"Manage the eligibility assessment pipeline.“,
backstory=f"Orchestrates the structured execution flow.”,
llm=llm_model,
verbose=True,
max_rpm=6,
respect_context_window=True,
allow_delegation=True
)
Vector DB Agent
vector_db_agent = Agent(
role=“Vector DB Processor”,
goal=f"Add JSON files to the vector database.“,
backstory=f"Ensures accurate processing of JSON content.”,
tools=[add_json_to_vectorDB],
llm=llm_model,
verbose=True,
max_rpm=6,
respect_context_window=True,
allow_delegation=False
)
Process JSON Task
process_json_task = Task(
description=f"Extract content from JSON {file}and add to the vector database.“,
expected_output=f"JSON content from {file} successfully added to the vector database.”,
tools=[add_json_to_vectorDB],
agent=vector_db_agent,
async_execution=False
)
Query Generator Agent
query_generator_agent = Agent(
role=“Eligibility Query Generator”,
goal=f"Convert structured JSON input {{response}} into a natural language query.“,
backstory=f"Processes structured data into well-formed eligibility queries.”,
llm=llm_model,
verbose=True,
max_rpm=6,
respect_context_window=True,
allow_delegation=False
)
Query Generation Task
query_generation_task = Task(
description=f"Transform structured JSON input {{response}} into a natural language query.“,
expected_output=f"Generated query in string format from {{response}}.”,
agent=query_generator_agent
)
Define the Crew
crew_one = Crew(
agents=[vector_db_agent, query_generator_agent],
tasks=[process_json_task, query_generation_task],
process=Process.heirarchical,
planner_agent=manager,
verbose=True
)
Define the input data for the crew
input_data = {
‘file’: ‘path_to_your_json_file.json’,
‘response’: ‘your_structured_json_response’
}
Execute the crew with the provided input data
result = crew_one.kickoff(inputs=input_data)
Access and print the output of the crew execution
print(result.output)
A follow-up question: Can interpolation be used with the Planner Agent (Manager Agent in this case) to make decisions on passing the input to the right agent?