strands.agent.base
Agent Interface.
Defines the minimal interface that all agent types must implement.
AgentBase
Section titled “AgentBase”@runtime_checkableclass AgentBase(Protocol)Defined in: src/strands/agent/base.py:14
Protocol defining the interface for all agent types in Strands.
This protocol defines the minimal contract that all agent implementations must satisfy.
invoke_async
Section titled “invoke_async”async def invoke_async(prompt: AgentInput = None, **kwargs: Any) -> AgentResultDefined in: src/strands/agent/base.py:21
Asynchronously invoke the agent with the given prompt.
Arguments:
prompt- Input to the agent.**kwargs- Additional arguments.
Returns:
AgentResult containing the agent’s response.
__call__
Section titled “__call__”def __call__(prompt: AgentInput = None, **kwargs: Any) -> AgentResultDefined in: src/strands/agent/base.py:37
Synchronously invoke the agent with the given prompt.
Arguments:
prompt- Input to the agent.**kwargs- Additional arguments.
Returns:
AgentResult containing the agent’s response.
stream_async
Section titled “stream_async”def stream_async(prompt: AgentInput = None, **kwargs: Any) -> AsyncIterator[Any]Defined in: src/strands/agent/base.py:53
Stream agent execution asynchronously.
Arguments:
prompt- Input to the agent.**kwargs- Additional arguments.
Yields:
Events representing the streaming execution.