Get Next Task • AI Agent SDK
get_next_task: Get the next task name based on the 'when' condition evaluation.
get_next_task
Method
</div>
Get the next task name based on the ‘when’ condition evaluation.
This provides a simple routing mechanism for Task objects, similar to AgentFlow’s when() function.
Signature
def get_next_task(context: Dict[str, Any]) -> Optional[str]Parameters
ParamField
Dict[str, Any]Dictionary containing variables for evaluation.
Returns
ResponseField
Optional[str]then_task if condition is True, else_task if False. None if no routing is configured.
Uses
evaluate_when
Source
View on GitHubpraisonaiagents/task/task.py at line 1021