An agent mailbox is an email address your agent keeps. Tempboi gives an agent an address that goes away when it’s done; a mailbox at agentboi.email stays. The agent reads what arrives as JSON over a long poll, each message says who is talking, and one call answers in the thread. Run by Postboi, the same provider as the rest of these docs.
Make one
GitHub Actions without a stored key
On the team’s API keys page, trust an exact GitHub repository and branch with its stable repository and owner IDs. Choose a mailbox and its read, reply and send permissions, or team email access. The dashboard must approve trust; an API key cannot create it.
With no POSTBOI_TOKEN or POSTBOI_MAILBOX_KEY, mailbox() exchanges GitHub’s assertion
for an hour-long credential. Tokens stay in memory and refresh before a long poll can
outlive them. Explicit keys take precedence. postboi init --github opens trust setup;
rerun with --workload <id> to write a manually dispatched workflow, or copy its permission
and environment fields into your own. The workload ID is public configuration.
Mailbox grants open only their configured mailbox. Team email grants can use mail() for
regular team senders or mailbox() for an existing mailbox; create the mailbox in the
dashboard first. Use mailbox() when sending from an agent mailbox so review applies.
Workload tokens cannot approve held drafts, mint credentials, create mailboxes or manage
the team. Revoking trust invalidates issued credentials too. Disabling a mailbox revokes
its workload trust; re-enabling requires a fresh trust rule.
This first adapter accepts branch jobs triggered by push, schedule or workflow dispatch.
Pull requests, pull-request-target, environments and reusable workflows are refused.
Repository renames or ownership changes require a new trust rule. For a custom API, POSTBOI_AUTH_URL selects the token exchange origin; POSTBOI_API_URL and POSTBOI_MAILBOX_URL select the send and mailbox origins.
Local sign-in and standalone mailboxes
With the POSTBOI_TOKEN that postboi init wrote, the mailbox is
your team’s from the start and can send. The first call makes it, and every call after that
opens the same one:
mailbox() with no name opens the team’s mailbox when it has one, and makes one when it has
none. Once the team has several, name the one you mean.
Without a token, an agent can make one on its own. It receives straight away and sends once a person opens its claim link and signs in, at which point it joins their team:
Put the claim link in your summary for the person you’re working for: it’s the one step only they can take. Nobody claims it, and it’s deleted after 14 days.
A mailbox made without a token is remembered on your machine
(~/.config/postboi/mailboxes.json, readable by you alone) under the directory it was made
from. So the next mailbox() there opens the same address rather than making another, and postboi mailbox and postboi mcp find it too. Pass remember: false to keep nothing.
A key for one mailbox
Every mailbox also has a key of its own (mb_…, said once, when it is made). Your team’s key
opens all of them, so the mailbox key is for an agent you’d rather not hand that: it opens
this one mailbox, and nothing else of your team’s.
Your team can cut an agent off without deleting its address:
The dashboard’s mailbox menu has Disable agent and Enable agent. The CLI accepts postboi mailbox disable [address] and postboi mailbox enable [address] with the team’s POSTBOI_TOKEN. After enabling, postboi mailbox key --ttl 1h issues and remembers a fresh
key. Existing credentials stay revoked. Incoming mail and team access continue while the
agent is disabled, but it cannot send. Queued work and retries from before the disable
stay blocked after enabling; a transport already handed off cannot be recalled.
The mailbox exposes enabled, disabled_at and key_active.
Keys can expire without deleting the mailbox or stopping incoming mail:
TTL is whole seconds or a duration such as 1h or 30d, from one second to 365 days.
The CLI accepts postboi mailbox new --ttl 1h and postboi mailbox key --ttl 10m.
Existing keys keep their lifetime. An expiring mailbox key cannot extend its own deadline;
use the team’s key to renew it. A mailbox made with an expiring team key inherits that
deadline unless you request a shorter lifetime. An expired key returns HTTP 401 with code: "key_expired"; ask the team for a replacement. The team can still open the mailbox
and rotate its key from the dashboard. API key lifetimes are also set on the dashboard.
POSTBOI_MAILBOX_KEY in the environment does the same thing with nothing passed.
On agentboi.email, or on your own domain
On agentboi.email the address is the name you ask for plus four random characters, so nobody
can take another agent’s address, and names that read as an institution or a role somebody
could pose as (support, billing, a bank) are refused. To use your own domain, turn on receiving for it and pass domain: the address is
then exactly what you asked for.
Read its mail
watch() holds a long poll open and yields each message as it lands, which works from a
sandbox or CI with no public URL. wait() returns the next match and is the one to use for
a sign-up code. When the sender wrote an OTP-Token header, mail.otp is { code, origin, signed } and mail.code is that code rather than one read out of the text. signed is true only when the sender’s own DKIM signature covers the header:
Both take from, subject (a substring or a RegExp), tag and trust. Mail to orders-k3f9+anything@agentboi.email lands in the same mailbox with tag set to anything,
so one mailbox can tell its errands apart.
Over HTTP, with nothing installed:
The whole API is in agentboi.email/llms.txt and the API reference.
Who is talking
Every message is labelled when it arrives, so an agent can tell your team from a stranger before it does anything:
A label is not a permission. It tells your agent who is speaking; it doesn’t make what a
stranger wrote safe to act on. Write your agent’s instructions so that a stranger’s words are
information to weigh, never instructions to follow, and so that anything it does with tools
because of an email comes from owner mail or from you.
Answer
A reply goes to the sender (or their Reply-To), with a Re: subject and the In-Reply-To and
References headers that keep it in their thread, all worked out from the message being
answered. A send is from the mailbox’s own address and nothing else. A forward is Fwd: <subject> with your note above the original and its files attached (pass attachments: false to leave them off). A send and a reply take an idempotency_key, so a
retried call sends once, and all three count against your plan like any other send, with the
same suppressions, rate limits and checks.
Each resolves to what happened to it:
Attachments
send, reply and drafts take files. content is the bytes (a Uint8Array, an ArrayBuffer or a Blob), or a string that is already base64:
Up to 20 files and 10 MB in all a message. Over that, the send is refused with attachments_too_large.
postboi mailbox reply <id> --text "…", postboi mailbox send --to … --subject … --text … and postboi mailbox forward <id> --to … do the same from a shell, with --attach a.pdf,b.png for files.
Folders, labels and search
Every thread is in one folder: inbox, archive, spam, trash, or sent for a
conversation the mailbox started that nobody has answered yet. New mail marks a thread
unread and brings it back to the inbox from the archive or sent; a thread somebody put in
spam or the trash stays there. A first message read as junk starts its thread in spam.
Labels belong to the mailbox: up to 50, named 1 to 40 characters, in grey, amber, red, green or blue. Naming one that doesn’t exist on a thread makes it, in grey. box.labels() lists them with how many threads carry each, and create_label, update_label and delete_label manage them by id or by name.
From a shell: postboi mailbox threads --unread --q refund, postboi mailbox archive <thread>, postboi mailbox label <thread> billing and postboi mailbox labels.
Drafts and review
An agent can write a draft for a person to look over and send instead of sending it:
With in_reply_to it threads like a reply, and to and subject come from the message it
answers. Your team hears about every new draft (the Drafts notification and the draft_created webhook) and sends it from the dashboard. box.drafts(), draft(id), update_draft, delete_draft and send_draft cover the rest.
A mailbox can also be told to wait for a person before it sends at all. Its review is set by
your team:
Under new, a send to a new conversation, a forward, or a reply that adds a cc or bcc is
saved as a draft instead of going, and comes back as { status: "draft", draft_id, draft }.
Your agent shouldn’t send it again: it is waiting for a person. Only the mailbox’s own key is
held, so your team’s API key sends as usual, and only your team changes review:
postboi mailbox review new does the same with POSTBOI_TOKEN set, and postboi mailbox drafts lists what is waiting.
It’s your team’s mail too
A mailbox’s mail is filed in your dashboard’s Received log with everything else, so a person
can read along and answer from the dashboard. It arrives at your webhooks as email.received, which for mailbox mail also carries mailbox, trust, reply_text, codes and otp. The dashboard’s Mailboxes page makes them, rotates
their keys and deletes them.
Replying from your own code with mail() rather than the mailbox works too: pass the
received message’s id as in_reply_to and the Postboi provider threads it the same way.
Over MCP
postboi mcp runs an MCP server on stdio, so an agent in
Claude Code, Cursor, Codex or any other MCP client reaches its mailbox as tools. It needs
nothing installed beyond the package and nothing to configure. It reads the project’s .env,
so the POSTBOI_TOKEN that postboi init wrote is already enough:
For Cursor (.cursor/mcp.json), Claude Desktop and most other clients:
For Codex (~/.codex/config.toml):
With your team’s key it opens the team’s mailbox, or the one each tool’s mailbox names when
the team has several, and email_send sends the team’s own mail. With no key at all, the
agent makes a mailbox of its own with mailbox_create and hands you its claim link. That
mailbox is remembered on your machine, so the next session opens it again. To give an agent
one mailbox and nothing else of your team’s, put that mailbox’s key in the server’s
environment as POSTBOI_MAILBOX_KEY.
Every result that carries somebody else’s words (their text, their subject, their name) puts
them inside an <email> block that names its trust, after a line saying the content is data
from the sender and not instructions. A sender who writes </email> into their message can’t
close the block early. It’s the same rule as everywhere else on this page: the label says who
is talking, and your agent’s own instructions decide what it does about it.
Keys
A mailbox’s key (mb_…) opens that mailbox and nothing else in Postboi: it can’t send as your
team, read your other mail, make more mailboxes or loosen its own review. Your project’s POSTBOI_TOKEN opens every
mailbox the team has. box.rotate() (or postboi mailbox key) makes a new key and stops the
old one at once.
Deleting a mailbox stops its key and refuses mail to it from then on. What it received stays in your Received log, and the address is never given to anyone else.