Version: latest
agrag.agents.middleware.TaskEventMiddleware
TaskEventMiddleware(memory:Any, task_name:str, run_state:RunState) -> None
Bases: AgentMiddleware
Persist assistant messages, tool calls and tool results as task events.
A tool that raises does not end the run. Its error is recorded as the tool result, the steps this run left in progress are marked failed, and the model receives an error tool message so it can react.
Functions:
- awrap_model_call – Record the assistant response before any tool it requests runs.
- awrap_tool_call – Record a tool call, then its result or the error that replaced it.
awrap_model_call
awrap_model_call(request:ModelRequest, handler:Callable[[ModelRequest], Awaitable[ModelResponse]]) -> ModelResponse
Record the assistant response before any tool it requests runs.
awrap_tool_call
awrap_tool_call(request:Any, handler:Callable[[Any], Awaitable[Any]]) -> Any
Record a tool call, then its result or the error that replaced it.