| title | actor |
|---|
T = TypeVar('T')class Actor(name: str, instructions: str | None = None, description: str | None = None, verbose: bool = False, prompt: str | Path)Methods:
end_turnCalled when the actor ends its turn.def end_turn(self, thread: Thread, result: AgentRunResult)
friendly_namedef friendly_name(self, verbose: bool = True) -> str
get_agentletdef get_agentlet(self, tools: Sequence[Callable[..., Any]], end_turn_tools: Sequence[EndTurn], active_mcp_servers: list[MCPServer] | None = None) -> pydantic_ai.Agent[Any, Any]
get_currentGet the current actor from context.def get_current(cls) -> Actor | None
get_end_turn_toolsA list ofdef get_end_turn_tools(self) -> list[EndTurn]
EndTurntools that this actor can use to end its turn.get_memoriesA list of memories that this actor can use during its turn.def get_memories(self) -> list[Memory]
get_promptdef get_prompt(self) -> str
get_toolsA list of tools that this actor can use during its turn.def get_tools(self) -> list[Callable[..., Any]]
rundef run(self, instructions: str | Sequence[UserContent], result_type: type[T] = str, tools: list[Callable[..., Any]] = [], thread: Thread | str | None = None, handlers: list[Handler | AsyncHandler] | None = None, raise_on_failure: bool = True, **kwargs: Any = {}) -> Any
run_asyncdef run_async(self, instructions: str | Sequence[UserContent], result_type: type[T] = str, tools: list[Callable[..., Any]] = [], thread: Thread | str | None = None, handlers: list[Handler | AsyncHandler] | None = None, raise_on_failure: bool = True, **kwargs: Any = {}) -> Any
sayResponds to a user message in a conversational way.def say(self, message: str, instructions: str | None = None, thread: Thread | str | None = None)
say_asyncResponds to a user message in a conversational way.def say_async(self, message: str, instructions: str | None = None, thread: Thread | str | None = None)
start_turnCalled when the actor starts its turn.def start_turn(self, thread: Thread)
def get_current_actor() -> Actor | NoneGet the currently active actor from context.
Returns: The current Actor instance or None if no actor is active.
Parent Module: agents