Skip to content

Build and test a routine with Claude ​

Describe the business outcome in plain language. Claude inspects the account, writes and validates the workflow, shows you exactly what will be saved, and stages its schedule or trigger only after the routine is ready.

  • What you'll build β€” A custom MyChatBot routine using Claude Code and the account-scoped Agents MCP. The same process works for a two-step helper or a workflow that fans out across hundreds of records.
  • Who it's for β€” The person designing the process. You do not need to know YAML, agent slugs, connector schemas, cron syntax, or the available model aliases before you start.
  • Time & plan β€” About 20–40 minutes for a first useful version. You need an Agents balance; a preview calls models and is billed like an ordinary run.

Claude is the authoring workspace. MyChatBot remains the system of record and the runtime: its Agents MCP exposes the current routine contract and account configuration, while the saved routine runs on MyChatBot Agents.

What Claude can set up ​

Through the Agents MCP, Claude can inspect andβ€”after showing you the proposed changeβ€”configure:

  • custom and Library agents;
  • skills, including their instructions, scripts and references;
  • OAuth and Sales Platform connectors;
  • read-oriented Business Knowledge sources;
  • custom routine YAML;
  • disabled schedules and triggers, followed by a separate enable action.

Claude cannot receive connector secrets. An OAuth tool returns a consent URL for you to open; API keys and authenticated custom-MCP headers belong in the MyChatBot app. It also cannot use the Agents MCP to read your leads, emails, or other customer records.

1. Connect Claude Code ​

Open Agents, choose any Agent, open Tasks, and click Connect Claude or Codex. Create an access key and copy the Claude Code command shown by the app. It has this shape:

bash
claude mcp add --transport http \
  --header "Authorization: Bearer mcp_YOUR_ACCESS_KEY" \
  mychatbot-agents "https://api.mychatbot.app/api/mcp/agents"

Use the command generated for your account; do not paste the key into a prompt, document, repository, or screenshot. The key grants account-wide access to the narrow tools exposed by this MCP server. Revoke it through support if it is exposed.

2. Give Claude the outcome, not a guessed implementation ​

Start with the business rule, representative volume, allowed effects, and the definition of success. For example:

text
Build a routine that finds clients with no activity in 30 days, evaluates each
one, and produces an ordered action list. Expect 200–500 clients. It may read
Sales Platform data but must not message clients or change records in version 1.
Run it every Monday at 09:00 Europe/Kyiv, but leave the schedule disabled until
I approve the final result.

Use the MyChatBot Agents MCP. Inspect my existing setup before proposing new
agents, skills, knowledge, or connectors. Follow the complete routine authoring
and dry-run process, and explain any boundary the preview did not test.

This gives Claude room to reuse what already exists. Avoid prescribing an agent slug, model alias, or connector name unless it is a real requirement; the account inventory is the source of truth.

3. Make Claude inspect before it writes ​

Claude should perform this read-only discovery first:

  1. Call get_routine_authoring_context and read the Markdown URLs it returns, especially the complete Routine YAML reference.
  2. Call get_account_authoring_inventory.
  3. Call list_routines, then get_routine for anything it may reuse or change.
  4. Call get_agent or get_skill before proposing a full replacement.

The inventory lists effective agents and models, skill metadata, configured connector state, Business Knowledge metadata and trigger sources without returning credentials or contacting providers. Claude should prefer reusing these resources over creating near-duplicates.

A reusable starter prompt

The connection dialog includes a complete starter prompt with the required read-before-write, approval, validation and preview rules. The Agents MCP reference keeps the same prompt in copyable form.

4. Configure only what the routine needs ​

If something is missing, ask Claude to propose the smallest supporting change and wait for your approval before making it.

  • For OAuth, Claude calls start_connector_authorization; you open the returned URL and finish consent yourself.
  • For a Sales Platform domain, Claude can call connect_sales_platform_connector.
  • For a secret-bearing connector, Claude must direct you to the app. Never send the secret through an MCP argument or chat message.
  • A separately approved probe_connector performs a real connection handshake and lists tools. It does not invoke a tool or prove that customer data can be read or written.

Refresh the account inventory after a connection or configuration change.

5. Draft, validate and review the complete routine ​

Claude writes the same YAML accepted by the built-in editor. It should call validate_routine until valid: true, then show you:

  • the complete canonical YAML, not a summary or partial diff;
  • which Agent and model runs each leaf step;
  • the maximum static Agent-call estimate when calculable;
  • the effective foreach concurrency and nested parallel width;
  • every read, write, message, call, publication, schedule and trigger it expects;
  • any assumption it could not verify from inventory.

Approve create_routine or update_routine only after that review. Claude then calls get_routine_readiness and resolves every blocker before testing. Readiness checks references and configuration; it does not contact connector providers or inspect customer data.

6. Preview the workflow graph ​

Ask separately before Claude calls start_routine_dry_run. The preview is persisted in routine history, consumes Agents balance, and runs the real sequence, parallel, loop, condition, router, and foreach control flowβ€”but AgentOS removes all tools, connectors, skills, Business Knowledge and account memory first.

Use the preview to test:

  • prompt hand-offs through {input} and {previous};
  • branch and route selection;
  • loop termination;
  • item aliases and result aggregation;
  • output shape and model quality.

Do not use it as evidence that Gmail, a CRM, Sales Platform data, or any external write works. A preview must have a statically calculable worst case of at most 25 Agent calls. For a dynamic batch, first save and preview the same routine with a two- or three-item literal foreach list, then update it to the real items: "{previous}" source and validate again.

7. Perform the narrow live check in MyChatBot ​

The Agents MCP deliberately has no β€œrun live now” tool. When the preview looks right, open the routine in MyChatBot and run it once with the narrowest safe input that can exercise the real reads.

For a routine that will eventually write or message:

  1. keep the first live version read-only or draft-only;
  2. use sandbox/test data where the external provider supports it;
  3. inspect the routine history and connector results;
  4. add the explicit effect only after the read path is proven.

Approval fields are not currently a live safety boundary

The YAML accepts approval, but the runtime-wide review switch currently keeps approval and output-review pauses off by default while continuation is being repaired. In that mode, owner-authored instructions run unattended. Do not put a message, call, publication, deletion, or live record change into an enabled routine merely because the YAML contains approval: true.

8. Stage automation, then enable it separately ​

Ask Claude to create the schedule or trigger only after the saved routine is ready. The MCP always creates it disabled, even if a prompt asks to enable it at creation time.

Review the staged resource:

  • correct routine and account;
  • cron and IANA timezone, or connector event and filters;
  • run message or event message template;
  • frequency and trigger rate limit;
  • live effects and expected cost at normal volume;
  • what the preview and live check didβ€”and did notβ€”prove.

Then give a separate approval for set_routine_schedule_enabled or set_trigger_enabled. Enabling a connector-event trigger may create a real subscription with the provider.

A good final handoff from Claude ​

Before you finish the authoring session, ask Claude for a compact runbook:

text
Summarize the final routine, its agents and dependencies, validated limits,
expected calls per run, live effects, preview evidence, remaining untested
assumptions, schedule or trigger state, how to stop it, and how to retry only
failed batch items. Do not include credentials or secret URLs.

Keep that summary with the business owner. The routine YAML remains the executable source of truth in MyChatBot.

Pick an example ​

See also ​