View the source code for this module on GitHub: https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/agents/remote.py
RemoteAgent
from mcp_use.agents.remote import RemoteAgent
method init
Initialize remote agent.ParametersSignatureThe ID of the remote agent to executeThe ID of the chat session to use. If None, a new chat session will be created.API key for authentication. If None, will check MCP_USE_API_KEY env varBase URL for the remote API
def __init__(agent_id: str, chat_id: str | None = None, api_key: str | None = None, base_url: str = "https://cloud.mcp-use.com"):
method run
Executes the agent and returns the final result.
This method uses HTTP streaming to avoid timeouts for long-running tasks.
It consumes the entire stream and returns only the final result.ParametersReturnsQuery string or inputInteger valueList of itemsParameter value
Signature
def run(
query: str,
max_steps: int | None = None,
external_history: list[langchain_core.messages.base.BaseMessage] | None = None,
output_schema: type[~T] | None = None
):
method stream
Stream the execution of a query on the remote agent using HTTP streaming.ParametersReturnsQuery string or inputInteger valueList of itemsParameter value
Signature
def stream(
query: str,
max_steps: int | None = None,
external_history: list[langchain_core.messages.base.BaseMessage] | None = None,
output_schema: type[~T] | None = None
):