6from collections.abc import Awaitable, Callable, Sequence
7from dataclasses import dataclass, field, replace
8▶from inspect import iscoroutinefunction
9from typing import (
10 TYPE_CHECKING,
· · ·
381
382 Subclass this and implement any of the defined methods to customize agent behavior
383▶ between steps in the main agent loop.
384
385 Type Parameters:
· · ·
575 "To resolve this, either: "
576 "(1) subclass AgentMiddleware and implement the synchronous wrap_model_call method, "
577▶ "(2) use the @wrap_model_call decorator on a standalone sync function, or "
578 "(3) invoke your agent asynchronously using `astream()` or `ainvoke()`."
579 )
· · ·
627 "To resolve this, either: "
628 "(1) subclass AgentMiddleware and implement the asynchronous awrap_model_call method, "
629▶ "(2) use the @wrap_model_call decorator on a standalone async function, or "
630 "(3) invoke your agent synchronously using `stream()` or `invoke()`."
631 )
· · ·
733 "To resolve this, either: "
734 "(1) subclass AgentMiddleware and implement the synchronous wrap_tool_call method, "
735▶ "(2) use the @wrap_tool_call decorator on a standalone sync function, or "
736 "(3) invoke your agent asynchronously using `astream()` or `ainvoke()`."
737 )
+ 165 more matches in this file