EXAMPLE / Agents

Draft freely. Send with approval.

Follow one contract boundary through a workflow and an in-memory MCP transport.

Test fixtureIntermediate
PATTERN EXPLORER

Follow the pattern. Inspect its limits.

Explore the source walkthrough, its evidence and the choices you would make in your own application.

SOURCE WALKTHROUGHRead the operation in its authored order
Choose a point to look closer
01 / Source walkthrough

Separate the two operations

The source defines draftAndSend.draftMessage and draftAndSend.sendMessage. Drafting is automation-safe; sending declares its approval requirement.

An exploration of the inspected source; no example is executed here.

1 / 4

The situation.

A reference agent drafts a message, waits for approval, and invokes sendMessage. The MCP smoke test uses a real MCP server and client over an in-memory transport. The actual handlers remain deterministic fixture logic.

What you will learn

  • Separate an automation-safe draft from an approval-required action.
  • Expose an existing operation registry through MCP.
  • Check valid, absent, and tampered receipt cases without a live messaging provider.

Follow the operation.

  1. 01

    Separate the two operations

    The source defines draftAndSend.draftMessage and draftAndSend.sendMessage. Drafting is automation-safe; sending declares its approval requirement.

  2. 02

    Inspect the workflow

    The example connects draft, approval wait, send, and receipt stages through the WorkflowDevkit adapter. This is a composed reference flow, not an invitation feature in the minimal starter.

  3. 03

    Inspect the MCP boundary

    The smoke test registers the operation registry as MCP tools, then calls sendMessage with valid, absent, and tampered receipt evidence. It expects success only for the valid case.

  4. 04

    Read what send actually does

    The bound handler derives a message ID and returns status sent in memory. To send through a real provider, supply your own port and preserve the same execution boundary.

What the source demonstrates.

  • The source smoke fixture drives a real MCP server/client over linked in-memory transports.
  • The fixture asserts APPROVAL_REQUIRED for missing and tampered receipts.
  • The same registry gate is used by the MCP adapter rather than a second hand-written approval path.

What it does not establish.

  • Delivery of a Slack message, email, invitation, or other network request.
  • A fresh successful run or production human approval system.
  • That the minimal example includes MCP; this is a separate source package.

Bring it into your environment.

Use the exact source context and prerequisites below. A source walkthrough is not a verified public-package installation recipe.

  • Access to the inspected source repository and a checkout at the cited revision.
  • The repository's Bun workspace dependencies and required generated package exports. These instructions were inspected; the examples were not executed in this review.

Working directory: examples/draft-and-send-agent

PACKAGE-LOCAL COMMANDS
bun test src/mcp-smoke.test.ts src/draft-and-send.workflow.test.ts

The source fixtures inspect workflow sequencing and successful versus denied MCP calls with deterministic handlers.

Test and handler source inspected; not executed here.

Read the related guide →

Make the pattern your own.

  • Bind the side-effecting operation to your own provider port.
  • Issue approval evidence through a trusted application flow.
  • Test changed input, absent evidence, and rejected evidence before real delivery.
SOURCE CONTEXT

Inspect the evidence.

Reviewed 2026-10-27 · b67c376f

Pinned source links require repository access; publication and anonymous package availability were not checked for this example.

Declared maturity
beta in package manifest
Catalogue registration
Source package exists; absent from inspected generated registry
Inline preview
Not registered
Execution in this review
Not rerun
Production qualification
Not assessed
Your view

Make room for your context.

Shape the presentation around this moment. You can change it whenever you need.

Your context

The different parts of you

Choose a starting point

A useful mix of context, visuals and gentle guidance.

Tune each dimension
Each dimension can change independently. Product permissions and available actions stay unchanged.

Support the way you begin and return

Tune your support

Reading comfort

Choose your language

Interface language changes text only. Markets, prices and workflows keep their own settings.

Translation coverage

Original source

Navigation151
Graph616
Categories378
Portfolio833
Examples2,035
Source preview1,542

More translations will be added as content is reviewed.

This preference is saved on this browser.

Search the website

Useful starting points

No results. Try a shorter phrase, an operation name or another search area.

A LITTLE ROOM TO EXPLORE

Find something to explore.

Open a closer look on this page, try a different perspective, or follow the detail into its own page.

How previews and controls work
01

Look before you leave

Hover a link or focus it with Tab to see a preview. Clicking the original link or pressing Enter always opens its destination.

02

Stay with the context

Move into the preview to explore its sections. Use Alt + ↓ from a focused link to enter it with the keyboard. Escape closes it.

03

Open the possibilities

Disclosure rows, perspective choices and highlighted controls reveal more. Your view changes reading comfort and the context you explore.

A separate button for a closer look

Show small preview buttons beside links where there is room. Tap the eye to inspect, or tap the link to go straight there. This choice stays in this tab.

No browsing history is collected. Reduced motion follows your device and Your view.