> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browser-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Structured output

> Ask for JSON and validate the V4 result in your application.

V4 returns `run.result` as a string. Ask for JSON only, then validate it
client-side:

<CodeGroup>
  ```python Python theme={null}
  from browser_use_sdk.v4 import BrowserUse
  from pydantic import BaseModel

  client = BrowserUse()

  class Story(BaseModel):
      title: str
      points: int

  run = client.runs.create(
      'Find the top HN story. Return only {"title":"...","points":0}.'
  )
  run = client.runs.wait_for_completion(run.id)
  story = Story.model_validate_json(run.result or "{}")
  ```

  ```typescript TypeScript theme={null}
  import { BrowserUse } from "browser-use-sdk/v4";
  import { z } from "zod";

  const client = new BrowserUse();

  const Story = z.object({
    title: z.string(),
    points: z.number(),
  });

  const run = await client.runs.create({
    task: 'Find the top HN story. Return only {"title":"...","points":0}.',
    model: "grok-4.5",
  });
  const result = await client.runs.waitForCompletion(run.id);
  const story = Story.parse(JSON.parse(result.result ?? "{}"));
  ```
</CodeGroup>

V4 does not accept `output_schema` / `outputSchema`. Handle validation errors
and retry with a [session follow-up](/cloud/agent/sessions) when needed.
