Passing multiple different input different to agents in same crew

[Flow._execute_single_listener] Error in method second_method: Something went wrong. Kickoff should return only one task output.
Traceback (most recent call last):
raise ValueError(
ValueError: Something went wrong. Kickoff should return only one task output.
The error occurs whenever I try to pass multiple inputs inside a Crew, which are assigned to different agents. Additionally, the output of either agent is not useful for the Crew, leading to the issue.

This error indicates that the kickoff method in CrewAI expects a single, consolidated output, but it is currently receiving multiple outputs from different tasks.

I have also used a planning agent and set the process to be hierarchical. Can anyone help me resolve this error?

What do you mean when you say multiple inputs? Do you mean:

crew.kickoff(inputs={“name”: “user”, “email”: “email@mail.com”})

yes exactly like that, the only difference is each input is interpolated in different agent , so when running the code outputs error saying crew cannot have multiple task outputs.

Is there anyway you can share your code? There aren’t enough details to figure out what’s going on here.

I don’t think the inputs are causing the issue so it has to be something else.

I don’t see where you are interpolating the input variables in the tasks. Are you doing that?

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?