Condition Protocol • AI Agent SDK
ConditionProtocol: Minimal Protocol for condition implementations.
ConditionProtocol
Defined in the protocols module.
AI Agent
Minimal Protocol for condition implementations.
This defines the essential interface that any condition must provide. It enables unified condition evaluation across AgentFlow (string-based) and AgentTeam (dict-based) systems.
Methods
Usage
# Create a custom condition
class ScoreCondition:
def __init__(self, threshold: int):
self.threshold = threshold
def evaluate(self, context: Dict[str, Any]) -> bool:
return context.get("score", 0) > self.threshold
# Use in workflows
cond: ConditionProtocol = ScoreCondition(80)
result = cond.evaluate({"score": 90}) # TrueSource
View on GitHubpraisonaiagents/conditions/protocols.py at line 17