POST
/
v1
/
agent
/
run
curl --request POST \
  --url https://api.lmnr.ai/v1/agent/run \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "<string>",
  "parentSpanContext": "<string>",
  "modelProvider": "anthropic",
  "model": "<string>",
  "stream": true,
  "enableThinking": true,
  "agentState": "<string>",
  "storageState": "<string>",
  "timeout": 123,
  "maxSteps": 123,
  "cdpUrl": "<string>",
  "thinkingTokenBudget": 123,
  "startUrl": "<string>",
  "returnScreenshots": true,
  "returnAgentState": true,
  "returnStorageState": true
}'
{
  "result": {
    "isDone": true,
    "content": "<string>",
    "error": "<string>",
    "giveControl": true
  },
  "storageState": "<string>",
  "agentState": "<string>",
  "stepCount": 123
}

Description

Run the Laminar agent with the given prompt. The response can be streamed or returned as a single response.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
prompt
string
required

The instructions to be used for the agent run.

parentSpanContext
string

Stringified Laminar OpenTelemetry span context. Useful to embed agent spans in a larger trace. Read more about LaminarSpanContext in our tracing docs.

modelProvider
enum<string>

LLM provider. Make sure to explicitly set this parameter, especially if you are setting the model parameter.

Available options:
anthropic,
gemini,
openai
model
string

LLM model name. Must match the provider API model name, e.g. 'claude-3-7-sonnet-latest'. Make sure to set the modelProvider parameter explicitly.

stream
boolean

If true, the response will be streamed including the intermediate 'thinking' steps. If false, the response will be returned as a single message. Currently, non-streaming connections timeout after 350 seconds. Laminar SDKs always set this to true, and, in the non-streaming mode, the response will be returned as a single message. Defaults to false.

enableThinking
boolean

The thinking parameter that is sent to the underlying LLM. This is always true for Gemini models. Defaults to true.

agentState
string

Stringified agent state as returned by a previous agent run. Useful to resume from a previous state.

storageState
string

Stringified browser storage state as returned by a previous agent run. Contains cookies and auth-related data.

timeout
number

Timeout in seconds. Only works in streaming mode. Note, this is a soft timeout, and the agent will finish its current step even if the timeout is reached. In addition, this timeout does not include initialization time.

maxSteps
number

Maximum number of steps to execute. Defaults to 100.

cdpUrl
string

URL of the Chrome DevTools Protocol (CDP) server. If not specified, Laminar will start its own CDP browser instance.

thinkingTokenBudget
number

Number of tokens the underlying LLM can use for thinking. Currently, there is a heuristic that converts the token budget to a reasoning effort parameter for OpenAI.

startUrl
string

URL to start the agent from. If not specified, the agent will infer this from the prompt. Make sure this is a valid URL with the protocol/scheme included.

returnScreenshots
boolean

Whether to return screenshots of the browser with each step. Ignored in non-streaming mode.

returnAgentState
boolean

Whether to return the agent state at the end of the run. CAUTION: This is a very large payload. Defaults to false.

returnStorageState
boolean

Whether to return the browser storage state at the end of the run. This includes cookies and auth-related data. CAUTION: This may be a very large payload. Defaults to false.

Response

200
application/json
Agent run result
result
object
required

The result of the agent run.

storageState
string

Stringified browser storage state as returned by a previous agent run. Contains cookies and auth-related data. Only returned if returnStorageState is true in the request. CAUTION: This may be a very large payload.

agentState
string

Stringified agent state as returned by a previous agent run. Only returned if returnAgentState is true in the request. CAUTION: This is a very large payload.

stepCount
number

Number of steps the agent took. Returned in non-streaming mode.