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

# Artifacts and downloads

> Capture downloaded files, public reports, PDFs, and evidence from browser-agent workflows.

Artifacts are files or evidence produced during browser work. Downloads are browser-captured files from the live session.

## Browser-agent result artifacts

```ts theme={null}
const result = await agent.run({
  startUrl: "https://www.govinfo.gov/content/pkg/BUDGET-2025-BUD/pdf/BUDGET-2025-BUD.pdf",
  goal: "Confirm the public PDF is reachable and report whether a downloadable artifact was captured.",
});

console.log(result.artifacts);
```

## Download from a browser

```bash theme={null}
web browser downloads browser_123
web browser download browser_123 download_456 --output ./report.pdf
```

SDK shape:

```ts theme={null}
const downloads = await browser.downloads.list();
const report = downloads.data.find((download) =>
  download.suggestedFilename?.endsWith(".pdf"),
);

if (report) {
  await browser.downloads.save(report.id, "./evidence/report.pdf", {
    overwrite: true,
    maxBytes: 25_000_000,
  });
}
```

Use `maxBytes` when your app accepts files from the web. Treat every downloaded file as untrusted input until your application validates it.

## Write a generated artifact with an exact browser step

Advanced browser-code execution can produce browser evidence that is not a site download. Use artifacts for generated files or extracted evidence that should not be squeezed into the final text answer.

```ts theme={null}
await browser.playwright.execute({
  code: `
    await page.goto("https://example.com");
    const text = await page.locator("body").innerText();
    await artifacts.write("example-domain.txt", text, { mimeType: "text/plain" });
    return { url: page.url(), title: await page.title() };
  `,
});
```

Store artifact IDs with your job result and fetch the file only when a reviewer or downstream process needs it.

## Production notes

* Store artifact IDs and source URLs with the job result.
* Do not squeeze large files into a final answer.
* Treat files from the web as untrusted input.
* Keep signed file URLs and bearer capabilities out of public logs.

Use examples such as [public report download](/examples/public-report-download) to see a full task shape.
