Skip to main content

Sign-up Review Agent

View as Markdown

This agent reviews each new Dex Cloud sign-up with admins in Slack. It applies their decision on the account and sends the applicant a welcome email.

SDKs: TypeScript and Go, in its own repository: superdurable-apps/dex-signup-agent-demo

Shows: agent sessions, Connectors as Tools, a Connector Trigger, a wait of days for a person, and Time Travel.

Product requirements

  1. It looks the applicant up on GitHub and on their profile page or website.
  2. It posts a review in a Slack channel: a recommendation to approve or reject, its reasons, and a draft welcome email.
  3. It waits, for minutes or days, for a reviewer to reply in the review's thread.
  4. A reviewer replies approve, reject <reason>, or hold. Any other reply is feedback on the email, and the agent posts a new draft.
  5. After the approval, a reviewer replies send. The agent sends the latest draft from the team's Gmail.
  6. The agent posts a summary in the thread and ends the review.

Flow design

Each sign-up gets one agent session, a Flow with the ID signup-review-<accountId>. A loop in the Worker lists the pending sign-ups registered since a configured cutoff, every 30 seconds by default. It starts a session for each one, with the sign-up data as the first message. The start uses the fixed Flow ID, disallows its reuse, and treats an already started review as done, so each account gets one review.

The application is the agent's prompt and nine tools. Each tool's effect class decides how Dex runs it:

ToolWhat it doesEffect classRuns in
github_user, fetch_profileRead the applicant's GitHub profile and web pagereadCallTool, with retries
post_review, post_draft, reply_in_threadPost the review, a new draft, or a note in Slacknon_idempotent_writeCallSingleAttemptTool, with bounded resends
approve_account, reject_accountDecide the account, then post the outcome in the threadnon_idempotent_writeCallSingleAttemptTool, with bounded resends
send_welcome_emailSend the latest draft with Gmailnon_idempotent_writeCallSingleAttemptTool, with bounded resends
finish_reviewEnd the session once the account is decidedidempotent_writeCallTool, with retries

The Slack and Gmail tools come from the official Slack and Gmail Connectors, so the app has no Slack or Gmail client code. Each operation's manifest sets its effect class. The Slack and Gmail write operations used here allow at most three sends per call.

The same prompt and tools run on three harnesses: Pi and the Claude Agent SDK in TypeScript, and Eino in Go. With the Claude Agent SDK, one RunModel Step runs a turn segment, with the model calls and the reads inside it. Each write runs in its own Step. Agent SDK adapters shows which Steps each one runs.

Wait for a reviewer

After post_review, the session waits in AwaitUserMessage without holding a Worker.

The Slack Connector's threadReplyCreated Trigger delivers the replies. It keeps only thread replies from the listed reviewers, finds the session that owns the thread, and sends the reply through the session's send_user_message RPC. Each reply wakes the session for one turn.

Recover a failed email send

The welcome email should go out once. When Gmail's answer is lost, the Gmail Connector searches Sent Mail and sends again only when it finds no copy, at most three times for the call. When Gmail rejects the message, nothing was sent and the call fails.

If the outcome is still unknown, Dex records the call as outcome_unknown and does not run it again. The agent asks the admins in the thread to check Sent Mail. The tool also refuses another send of a draft that this review recorded as sent or unknown.

To send it, first confirm in Sent Mail that the email did not go out, and fix the cause, such as an expired Gmail connection. Then use Time Travel: move the session back to right before the send. The session's records go back with it, and the send runs again in the same run as a new attempt.

Run it

The agent runs from its own repository, outside the playground that Run an example from the playground starts. You need Node.js 22.19 or later, dexcli, a Slack app, and a Gmail account to send from.

These steps run the TypeScript harnesses. For the Go Eino harness, run make run-eino from the repository root in step 4; it needs Go 1.26 or later.

  1. Start Dex with dexcli dev.
  2. In Dex Web, open Connectors and add two connections: review-slack for Slack and welcome-gmail for Gmail.
  3. Copy .env.example to .env, and fill in the review channel, the reviewers, and the model settings.
  4. Run npm ci && npm start.
  5. Reply in the review's thread in Slack, and watch the session signup-review-<accountId> in Dex Web.

The repository lists every setting, the Slack app's scopes, and how to run the agent on Dex Cloud.

Next