> ## 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

> Get validated, typed data back from agent tasks.

Pass a Pydantic model (Python) or Zod schema (TypeScript) — `result.output` is automatically validated and converted to the typed object.

<Note>
  TypeScript requires **Zod v4** (`npm install zod@4`). Zod v3 is not compatible.
</Note>

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

  class Post(BaseModel):
      name: str
      points: int
      comments: int

  class HNPosts(BaseModel):
      posts: list[Post]

  client = AsyncBrowserUse()
  result = await client.run(
      "List the top 20 posts on Hacker News today with their points",
      output_schema=HNPosts,
  )
  for post in result.output.posts:
      print(f"{post.name} ({post.points} pts, {post.comments} comments)")
  ```

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

  const Post = z.object({
    name: z.string(),
    points: z.number(),
    comments: z.number(),
  });

  const HNPosts = z.object({
    posts: z.array(Post),
  });

  const client = new BrowserUse();
  const result = await client.run(
    "List the top 20 posts on Hacker News today with their points",
    { schema: HNPosts },
  );
  for (const post of result.output.posts) {
    console.log(`${post.name} (${post.points} pts, ${post.comments} comments)`);
  }
  ```
</CodeGroup>
