OnCondition

OnCondition(
    target: ConversableAgent | dict[str, Any] | None = None,
    condition: str | ContextStr | Callable[[ConversableAgent, list[dict[str, Any]]], str] | None = None,
    available: Callable[[ConversableAgent, list[dict[str, Any]]], bool] | str | ContextExpression | None = None
)

Defines a condition for transitioning to another agent or nested chats.
This is for LLM-based condition evaluation where these conditions are translated into tools and attached to the agent.
These are evaluated after the OnCondition conditions but before the AfterWork conditions.

Parameters:
NameDescription
targetType: ConversableAgent | dict[str, typing.Any] | None

Default: None
conditionType: str | ContextStr | Callable[[ConversableAgent, list[dict[str, Any]]], str] | None

Default: None
availableType: Callable[[ConversableAgent, list[dict[str, Any]]], bool] | str | ContextExpression | None

Default: None

Instance Attributes

available



condition



target