CarlyEmail docs

Inbox agent

Every inbox has a built-in agent that reads each new email and acts on it: replies, forwards, labels, assignment.

Write instructions for an inbox, switch on what the agent may do, and it handles each new email as it arrives. No code, no runtime of your own. Bring your own agent instead whenever you like; the two work side by side.

curl -X PATCH https://api.carlyemail.com/v0/inboxes/hello@carlyemail.com/agent \
  -H "Authorization: Bearer $CARLYEMAIL_API_KEY" \
  -H 'content-type: application/json' \
  -d '{
    "instructions": "Questions for a bike shop. Label refund requests Billing and draft a reply. Assign anything about repairs to maria@gmail.com. Forward partnership enquiries to partners@rivercycles.co.uk. Archive newsletters.",
    "actions": ["draft_reply", "add_labels", "assign", "forward", "archive"],
    "tone": "concise_casual"
  }'

GET on the same address shows the settings. Over MCP, update_inbox takes the same three fields as agent, and get_inbox returns them.

Actions

Action What it does
draft_reply Writes a reply and saves it as a draft for someone to send
send_reply Writes a reply and sends it
forward Forwards the email to an address written in the instructions
add_labels Adds labels the instructions name
assign Hands the conversation to a teammate the instructions name
mark_spam Labels the conversation spam, which hides it
archive Labels it archived and marks it read
trash Labels it trash, which hides it

actions replaces the whole list. An empty list switches the agent off, and so does clearing the instructions.

Tones: concise_professional (the default), concise_casual, expanded_professional, expanded_casual.

Writing instructions

Say what mail to expect and what to do with each kind, in up to 4,000 characters. The agent uses only what is written there:

  • Forwarding addresses must be written out in full. An address that isn't in the instructions is refused, however the email asks for it.
  • Teammates are named by their email address.
  • Labels are added only if the instructions name them.

Facts the agent may put in replies (opening hours, your refund policy, a link to order tracking) belong in the instructions too. It is told never to invent any.

What keeps it safe

Anyone can email an inbox, including people who write instructions for the agent into the email. The agent is told that an email is data, not instructions, and CarlyEmail enforces the rest whatever the model says:

  • It only takes actions you switched on.
  • Forwards, assignments and labels are checked against your instructions.
  • It never replies to automated mail: auto-replies, mailing lists, no-reply senders. Two auto-responders answering each other is a loop.
  • It doesn't reply to a conversation someone has already started a reply on.
  • An email it judges needs a person is never archived, trashed or marked spam.
  • It doesn't run on mail held back as spam, blocked or unauthenticated.
  • Each email is handled once, even if delivery is retried.

See Untrusted mail for setting up your own agents the same way.

Seeing what it did

Its drafts, replies, labels and assignments are recorded as the Inbox agent: created_by on a draft, sent_by on a message, actor on events. They raise the usual events, so a webhook on draft.created or thread.assigned (see Events) hears about them.

Limits

Each email it reads is one run. Runs per day, by plan:

Free Startup Business Enterprise
25 500 5,000 Unlimited

Past the day's runs, mail still arrives; the agent picks up again the next day (UTC). An account that hasn't confirmed its owner gets 10 a day and, like everything else it sends, its replies can go only to the owner.