Agent SDK

Convert a Grok Build automation

View as Markdown

Convert a dashboard Automation when you want to edit its behavior as code, test it locally, or deploy it as an Agent SDK project. To change only the prompt or the trigger, stay in the dashboard.

Convert and run locally

init --from automation:<url> creates a project with the Automation's prompt, model, and any schedules, channels, and account connections it can represent. It prints warnings and setup steps for the rest.

Text

agent-sdk login
agent-sdk init --from \
  automation:https://cursor.com/automations/0a1b2c3d-0000-1111-2222-333344445555

cd nightly-triage
agent-sdk dev

Try the agent in the playground before you reconnect a live trigger. The CLI reference covers the other options.

Reconnect account-backed actions

For an HTTP or SSE MCP server, the converter writes a connection by name, without its URL or credentials. Connect the same server under MCP in Grok Build, sign in on the local host, and the agent uses its tools through your account.

TypeScript

// bot/mcp-connections/linear.ts
import { defineConnection } from "@grok/agent-sdk/connections";

export default defineConnection({
  cursorAccount: true,
  servers: ["Linear"],
});

Bring a Slack trigger online

Once you create the Slack app, the agent answers mentions in the same thread. For a channel watch, also subscribe the app to channel posts:

Text

agent-sdk slack create --dir . --channel-posts

The converter keeps the watch allowlist. If a warning says the Automation also filtered messages by text, add that check to the channel's onChannelPost hook.

Bring a GitHub trigger online

The generated GitHub channel keeps simple filters such as PR actions, branches, and repositories, and a hook whose condition depended on dashboard-only context returns null until you replace it. This converted CI trigger wakes only when the suite fails:

TypeScript

import {
  defaultGitHubAuth,
  githubChannel,
} from "@grok/agent-sdk/channels/github";

export default githubChannel({
  cursorAccount: { repos: ["acme/api"] },
  webhookEvents: ["check_suite"],
  onCheckSuite: (ctx, suite) => {
    if (suite.conclusion !== "failure") {
      return null;
    }
    return { auth: defaultGitHubAuth(ctx) };
  },
});

Replay a failing PR before you connect live delivery:

Text

agent-sdk github replay acme/api#42 --dir . --events '*' --conclusion failure

Grok Build-account delivery carries PR and comment events. Push, issue, and CI triggers need webhook delivery through a GitHub App or github forward, as the GitHub guide explains.

Work through the checklist

The converter doesn't carry every behavior over. Before you turn on a live trigger, go through the warnings and setup steps it prints:

  • A setup step names something you have to connect or configure.
  • A Verify: step names a dashboard action with no matching tool. Run the agent and confirm the same external write happens.
  • A .todo.md file marks a connection you have to replace.
  • Credentials, webhook registration, and Automation memory never carry over.

Keep the source Automation enabled while you work, and when you deploy, disable it before you turn on the same live triggers. The converter doesn't support Grok Build-managed Automations.


Last updated: November 23, 2026