API
Browse

Perform a single MultiOn browsing session

The Browse API allows you to perform a single browsing session with the MultiOn Web Agent. A session in this context refers to a stateful instance of interaction with our Agent for a specific user query or workflow.

Understanding Sessions

Session Lifecycle
  • Session Lifecycle: A session begins when you initiate it with an input URL and an instruction prompt and ends when the Agent has completed the task with the required Actions. Each session is isolated, ensuring that data and interactions are not shared across sessions.
  • Use Cases: Sessions are ideal for handling individual queries, like fetching weather updates or executing a specific task.
  • Security: Sessions maintain high levels of security, as each session is authenticated and isolated, protecting the integrity of your data and interactions.

Browse Input

Here's what you need to start a session:

{
  "cmd": "Your command here", // The user input query or command for the session.
  "url": "https://www.example.com", // The URL where the session will start from.
  "maxSteps": 10, // The maximum number of steps the session will take before stopping.
  "sessionId": "optional-session-id" // A unique identifier to continue a previous browse session (optional).
}

Optional Parameters

Additional parameters can be included to refine your session's behavior and responses. Refer to the API documentation for a full list of optional parameters.

Dependencies

To get started, make sure you have the required dependencies installed:

pip install multion -U

Browse

Create a new browse session by running the following code in your preferred language:

response = multion.browse({
  "cmd": "Weather Today",
  "url": "https://www.google.com",
  "maxSteps": 5
})
print(response)

Response Body

The server will respond with different status codes depending on the outcome of the request. Here's what you can expect:

Success Response

{
  "sessionId": "unique-session-id", // The session ID of the current session
  "status": "DONE", // The current status of the browsing session
  "result": "response-result", // The response of the last step of the browsing session
  "lastUrl": "https://google.com", // The last URL where the browsing session stopped
  "content": "page-content", // The content of the page where the session stopped
  "screenshot": "image-url" // The screenshot of the page where the session stopped
}

Client Error Responses

Handle these responses appropriately in your application for a smooth user experience:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "The server could not understand the request due to invalid syntax."
}
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "The request lacks valid authentication credentials for the target resource."
}
{
  "statusCode": 402,
  "error": "Payment Required",
  "message": "The request cannot be processed until the client makes a payment."
}
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "The server encountered an unexpected condition that prevented it from fulfilling the request."
}