Base agent interface for MCP tools API Documentation
from mcp_use.agents.base import BaseAgent
method
sessionmcp_use.session.MCPSessionrequired The MCP session to use for tool calls.
def __init__(session: mcp_use.session.MCPSession):
def initialize():
querystrrequired The query to run. max_stepsintdefault:"10" The maximum number of steps to run.
returnsdict[str, Any]The final result from the agent.
def run(query: str, max_steps: int = 10):
querystrrequired The query to run. previous_stepslist[dict[str, typing.Any]] | Nonedefault:"None" Optional list of previous steps.
returnsdict[str, Any]The result of the step.
def step(query: str, previous_steps: list[dict[str, typing.Any]] | None = None):
Was this page helpful?