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

# Collect and Summarize Newsletters into a Daily Digest

> Subscribe the agent's address, collect what arrived, extract PDFs, send one digest to the team, and archive the threads automatically.

Subscribe the agent's address to the newsletters, changelogs, and alerts your team wants summarized. Every morning the agent reads what arrived since yesterday, extracts the text from attached PDFs and CSVs, writes one consolidated digest, and mails it to the team. For newsletters that require a browser to render properly, the agent can run Chrome on its own Linux machine instead of on your computer.

## What you need

An agent equipped with an inbox and a token that has the following capabilities:

* **email:read** — to list and read incoming newsletters
* **email:send** — to send the daily digest to the team

Add **compute:run** if any sources require browser rendering or chart generation. The `compute:run` capability is feature-flagged — contact support if it is not visible on your plan.

## Steps

<Steps>
  ### Subscribe with the agent's address

  Use the agent's inbox address when signing up for each newsletter or alert service. Confirmation links arrive in the inbox — call `find_verification_code` or `read_message` to retrieve them and complete any double-opt-in flows.

  <Tip>
    Enable allowlist mode on the inbox to ensure only sources you subscribed to can deliver mail. Everything else is blocked before the agent sees it.
  </Tip>

  ### Collect what arrived since yesterday

  Call `list_messages` with a `since` timestamp set to 24 hours ago and `direction: "inbound"` to page through everything that arrived. Use cursor pagination to get up to 100 messages per request.

  ### Extract PDF and CSV text

  For any message with attachments, call `read_attachment_text` with the attachment ID. It returns extracted text from PDFs, CSVs, JSON, and HTML files — no download required. Pass this text directly to your summarization model.

  ### Write and send the digest

  Compose one message to the team with a `labels` array (e.g. `["digest"]`) and a stable daily `idempotency_key` (e.g. `digest-{YYYY-MM-DD}`). If the job reruns on the same day, the duplicate send is safely ignored.

  ### Archive the handled threads

  For each newsletter thread you've processed, call `update_thread` with `folder: "archive"` to move it out of the inbox. Free Sandbox retains mail for 7 days; paid plans keep history longer.
</Steps>

## Chat prompt example

Use this prompt in any chat client with Agent Loadout connected:

```text Chat prompt theme={null}
Summarize every newsletter that arrived in your inbox since yesterday, including
the text of any PDF attachments, and send the digest to team@example.com with
the subject Daily digest. Then archive those conversations.
```

## CLI example

```bash CLI theme={null}
SINCE=$(date -u -v-1d +%Y-%m-%dT%H:%M:%SZ)
agent-loadout messages list inb_… --since "$SINCE" --direction inbound --limit 100 > today.json
jq -r '.messages[] | .id' today.json | while read id; do agent-loadout messages get "$id"; done > bodies.json
# summarize bodies.json with your model, then:
agent-loadout messages send inb_… --to team@example.com --subject "Daily digest" --text "$(cat digest.txt)" --label digest --idempotency-key "digest-$(date +%F)"
```

## Required permissions

| Capability    | Why it's needed                                              |
| ------------- | ------------------------------------------------------------ |
| `email:read`  | List and read incoming newsletters and attachments           |
| `email:send`  | Send the daily digest to the team                            |
| `compute:run` | *(Optional)* Run Chrome for browser-rendered pages or charts |

<Note>
  When the digest needs a rendered page or a chart, create a small machine with a 10-minute window — Chrome comes preinstalled. Use `host_machine_port` if the team should open the result directly in a browser.
</Note>
