Bases: AvailableCondition
Available condition for determining if a summary task should be performed.
This condition checks if: 1. There are no documents left to ingest 2. There are no queries left to run 3. The completed task count is truthy
If all conditions are met, the agent is ready for a summary task.
documents_var class-attribute
instance-attribute
documents_var = 'DocumentsToIngest'
queries_var class-attribute
instance-attribute
queries_var = 'QueriesToRun'
completed_var class-attribute
instance-attribute
completed_var = 'CompletedTaskCount'
is_available
is_available(agent, messages)
Check if all task conditions are met.
PARAMETER | DESCRIPTION |
agent | The agent with context variables TYPE: ConversableAgent |
messages | The conversation history (not used) TYPE: list[dict[str, Any]] |
RETURNS | DESCRIPTION |
bool | True if all conditions are met (ready for summary), False otherwise |
Source code in autogen/agents/experimental/document_agent/document_conditions.py
| def is_available(self, agent: "ConversableAgent", messages: list[dict[str, Any]]) -> bool:
"""Check if all task conditions are met.
Args:
agent: The agent with context variables
messages: The conversation history (not used)
Returns:
True if all conditions are met (ready for summary), False otherwise
"""
# Get variables from context with appropriate casting
documents_to_ingest: List[Ingest] = cast(List[Ingest], agent.context_variables.get(self.documents_var, []))
queries_to_run: List[Query] = cast(List[Query], agent.context_variables.get(self.queries_var, []))
completed_task_count = bool(agent.context_variables.get(self.completed_var, 0))
# All conditions must be true for the function to return True
return len(documents_to_ingest) == 0 and len(queries_to_run) == 0 and completed_task_count
|