Routing Condition Protocol • AI Agent SDK
RoutingConditionProtocol: Extended Protocol for conditions that support routing to targets.
RoutingConditionProtocol
Defined in the protocols module.
AI Agent
Extended Protocol for conditions that support routing to targets.
This extends ConditionProtocol with the ability to return target tasks/steps based on the condition evaluation. Used primarily by AgentTeam for task routing.
Methods
Usage
class ApprovalCondition:
def __init__(self, routes: Dict[str, List[str]]):
self.routes = routes
def evaluate(self, context: Dict[str, Any]) -> bool:
decision = context.get("decision", "")
return decision in self.routes
def get_target(self, context: Dict[str, Any]) -> List[str]:
decision = context.get("decision", "")
return self.routes.get(decision, [])Source
View on GitHubpraisonaiagents/conditions/protocols.py at line 57