Principle:CrewAIInc CrewAI Task Definition
| Knowledge Sources | |
|---|---|
| Domains | Task_Management, Multi_Agent_Systems |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
A specification pattern for defining discrete units of work with clear descriptions, expected outputs, assigned agents, and optional structured output schemas.
Description
Task Definition establishes what work needs to be done in a multi-agent system. Each task is an atomic unit of work described in natural language, paired with an explicit specification of what the output should look like. Tasks support variable interpolation from runtime inputs, allowing dynamic descriptions. They can optionally specify structured output via Pydantic models, dependency contexts from other tasks, file outputs, guardrails for output validation, and human-in-the-loop review.
The separation of task specification from agent identity allows flexible assignment: tasks can be pre-assigned to specific agents or left unassigned for dynamic routing by a manager agent.
Usage
Use this principle whenever defining work items for agents to execute. Every crew requires at least one task. Tasks should be defined with clear, specific descriptions and unambiguous expected output specifications to guide agent behavior effectively.
Theoretical Basis
Task Definition follows the Specification Pattern, where each unit of work is fully described before execution begins. The description and expected output fields serve as a contract between the system designer and the executing agent. Variable interpolation uses Python string formatting ({variable} syntax) to inject runtime values.
Pseudo-code:
# Abstract task specification
task = define_task(
description="Analyze {topic} and produce a report",
expected_output="A structured report with findings and recommendations",
agent=assigned_agent, # Optional
output_schema=ReportModel, # Optional structured output
context=[prerequisite_tasks], # Optional dependencies
)
# At runtime, {topic} is replaced with actual input