CrewAICrewAI 1.15 · Python 3.10 to 3.13
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
32 small wins to finish your pathNext lesson

Inputs: one crew, many tickets

A task with {question} in its description is a template. kickoff(inputs=...) fills it in, so one crew answers any ticket, and kickoff_for_each runs a list of them.

Lesson 4's task had the customer's question typed into its description. A support desk needs the same crew for every ticket.

Examplecrew.py
from crewai import Agent, Crew, Task
from shop_llm import ShopLLM

agent = Agent(
    role="Support agent",
    goal="Answer customers of a small online shop",
    backstory="You have worked the shop's support desk for years.",
    llm=ShopLLM(model="shop"),
)
task = Task(
    description="Answer the customer: {question}",
    expected_output="One short, friendly sentence.",
    agent=agent,
)
crew = Crew(agents=[agent], tasks=[task])

The description now contains {question}, a placeholder in curly braces. The agent is lesson 4's.

Example
result = crew.kickoff(inputs={"question": "Where is my order A17?"})
print(result.raw)

inputs is a dictionary. Before the crew runs, CrewAI puts each value in place of the placeholder with the same name, in task descriptions, expected outputs and the agent's role, goal and backstory.

A misspelled input

Example
crew.kickoff(inputs={"q": "Where is my order A17?"})

A placeholder with no value in inputs stops the run before any model is called, and the error names the missing variable. Calling kickoff() with no inputs at all is different: nothing is filled in, and the agent is asked about the literal text {question}.

Many tickets

Example
tickets = [
    {"question": "Where is my order A17?"},
    {"question": "Hello, can you help me?"},
]
for result in crew.kickoff_for_each(inputs=tickets):
    print(result.raw)

kickoff_for_each runs the crew once per dictionary and returns the results in the same order. The first ticket names an order; the second does not, so the model asks which one.

Try it yourself
  • Put {question} in the agent's goal as well and run the first example.
  • Add a third ticket about C40 to the list.
  • Call crew.kickoff() with no inputs, then print task.description.

Little by little, you're building something great.