# Brynth

## Give your agent an address in one command

```bash
npx brynth init
```

Brynth is I/O for AI agents: one address to receive, one key to act, one record of everything. `init` asks for your email, sends you a sign-in link, creates a project, connects Claude Code and Codex with a key each, installs the Brynth skill in the current folder and prints a test webhook. Then ask your agent: "Check my Brynth inbox." See the [Quickstart](/quickstart.md).

## From a webhook to an email, with a person in the loop

A Stripe webhook reports a failed payment. Your agent writes to the customer, your policy asks you first, you approve on Telegram, the email leaves, and every step is in the ledger.

1. Stripe posts `invoice.payment_failed` to `https://hooks.brynth.ai/w/…`. Brynth checks the signature, drops duplicates and queues the event.
2. The agent reads and claims it:

```text
inbox_list({source: "stripe"})
inbox_claim({event_id: "evt_…"})
```

3. The agent writes to the customer:

```text
email_send({
  to: ["billing@customer.example"],
  subject: "Your payment did not go through",
  text: "Hi, the card on file was declined. You can update it here: …"
})
```

4. Your policy has this rule, so Brynth asks you before sending:

```json
{
  "rules": [
    { "match": { "tool": "email_send", "to_domain_not_in": ["acme.example"] }, "effect": "require_approval" }
  ]
}
```

5. Telegram shows you the recipients, the subject and the start of the text, with buttons to approve, deny or ask for more context. You approve within `wait_seconds` (45 by default), so `email_send` returns `{"status": "queued", "request_id": "req_…", …}` and the email leaves from `acme@in.brynth.ai`. Approve later and `email_send` returns `pending`; the email leaves once you approve.
6. The agent closes the event with `inbox_ack({event_id: "evt_…", result: "Reminder sent"})`.
7. The ledger has every step, each with who did it and when: `ledger_query({subject: "evt_…"})` shows the event, `ledger_query({subject: "req_…"})` the request and your decision, and a query on the `message_id` (`msg_…`) of an entry in the `messages` that `email_send` returns shows that email. `ledger_verify()` checks that nothing was changed afterwards.

The customer's reply comes back to the same inbox as an `email.received` event.

## What is in the box

- [Inbox](/concepts/events.md): webhooks and email with one envelope, deduplication, leases and retries.
- [Requests and policy](/concepts/requests-and-policy.md): approvals and questions by email or Telegram, rules for what needs a person.
- [Disk](/guides/files-and-state.md): key-value, files and task state per project.
- [Email sending](/guides/send-email.md) from your project's address.
- [Ledger](/concepts/ledger.md): a hash-chained record of every effect.

Brynth runs in the EU. The CLI and the skill are open source under the MIT License. Agents can read these docs as Markdown: start from [llms.txt](/llms.txt).
