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

# Streaming progress

> Stream browser-agent run events from the SDK and map them to product progress states.

Use `agent.stream(...)` when users or operators should see progress during a browser-agent run.

```ts theme={null}
const stream = agent.stream({
  startUrl: "https://www.sec.gov/edgar/search/",
  goal: "Find Apple's latest 10-Q filings and return filing metadata.",
});

for await (const event of stream) {
  if (event.type === "browser.created") {
    console.log("Browser", event.browserId);
  }

  if (event.type === "tool.completed") {
    console.log("Step", event.step, event.page?.title ?? event.page?.url);
  }

  if (event.type === "confirmation.requested") {
    console.log("Needs confirmation", event.request.message);
  }

  if (event.type === "run.completed") {
    console.log(event.result.status);
    console.log(event.result.text);
  }
}
```

## Events to handle

| Event                    | Use it for                                                   |
| ------------------------ | ------------------------------------------------------------ |
| `run.started`            | Create a job record or progress row.                         |
| `browser.created`        | Store the browser ID and optional debug capability.          |
| `tool.completed`         | Show the latest browser step, page title, or URL.            |
| `observation`            | Track how much page evidence the agent saw.                  |
| `artifact`               | Store files, downloads, or generated evidence.               |
| `confirmation.requested` | Ask a human or policy service for a decision.                |
| `run.completed`          | Persist the final result and route by `event.result.status`. |

## Logging rules

* Do not log raw secrets.
* Do not log signed Debug UI or CDP URLs unless your log store is trusted for bearer capabilities.
* Store source URLs and status so operators can review the run later.
* Keep user-facing progress short; put verbose diagnostics behind an operator view.
