Skip to main content

Parameters

ParameterTypeDefaultDescription
taskTaskRequiredThe task being managed
agentAgentRequiredThe agent instance managing the task

Functions

process_response

Process the model response and set it as the task response. Parameters:
  • model_response (Any): The model response to process
Returns:
  • Any: The processed model response

manage_task

Asynchronous context manager for managing task lifecycle. Returns:
  • AsyncContextManager: Context manager that handles task lifecycle
Usage:
async with task_manager.manage_task() as manager:
    # Execute task logic
    response = await model.request(...)
    manager.process_response(response)
    # Task lifecycle handled automatically
Features:
  • Automatic task start (calls task.task_start(agent))
  • Task response processing (calls task.task_response(model_response))
  • Automatic task end (calls task.task_end())
  • Task lifecycle state management
I