marvin.agents.actor
Constants
Classes
Actor
class Actor(name: str, instructions: str | None = None, description: str | None = None, verbose: bool = False, prompt: str | Path)
Methods:
end_turn
def end_turn(self, thread: Thread, result: AgentRunResult)
Called when the actor ends its turn.
friendly_name
def friendly_name(self, verbose: bool = True) -> str
get_agentlet
def 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_current
def get_current(cls) -> Optional[Actor]
Get the current actor from context.
get_end_turn_tools
def get_end_turn_tools(self) -> list[EndTurn]
A list of EndTurn
tools that this actor can use to end its turn.
get_memories
def get_memories(self) -> list[Memory]
A list of memories that this actor can use during its turn.
get_prompt
def get_prompt(self) -> str
get_tools
def get_tools(self) -> list[Callable[..., Any]]
A list of tools that this actor can use during its turn.
run
def 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_async
def 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
say
def say(self, message: str, instructions: str | None = None, thread: Thread | str | None = None)
Responds to a user message in a conversational way.
say_async
def say_async(self, message: str, instructions: str | None = None, thread: Thread | str | None = None)
Responds to a user message in a conversational way.
start_turn
def start_turn(self, thread: Thread)
Called when the actor starts its turn.
Functions
get_current_actor
def get_current_actor() -> Actor | None
Get the currently active actor from context.
Returns:
The current Actor instance or None if no actor is active.
Parent Module: agents