---
title: "AI Agent Workflows"
description: "End-to-end prompt recipes and guardrails for automating static sites, WordPress staging updates, MariaDB migrations, and email onboarding with the Hosted EZ MCP Server."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.hostedez.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Agent Workflows

Once you connect your AI client to the [Hosted EZ MCP Server](/automation/mcp-server), your agent can chain multiple Hosted EZ tools into safe, repeatable operational workflows. Below are battle-tested recipes and safety practices.

## 1. Provision & Configure a Static SPA with Custom Domain

Use this workflow when launching a React, Vite, Vue, or Svelte single-page application:

> **Prompt:** "Create a new Hosted EZ Static site named `Acme App` with SPA fallback enabled, Clean URLs disabled, a `/404.html` fallback page, and `Cache-Control: public, max-age=31536000, immutable` on `/assets/*`. Attach `app.acme-example.com` and show me any DNS records I need to add, plus the SFTP connection details so I can configure GitHub Actions."

**Tools your agent chains:**

1. `create_site` (`app: "static"`, `staticConfig` with `spaFallback: true` and `customHeaders`)
2. `connect_domain` (`siteId`, `domain: "app.acme-example.com"`)
3. `get_site_sftp` (`siteId`) — retrieves `sftp.hostedez.com:22` and `sftp_<slug>` username
4. `add_site_sftp_key` (`siteId`, `label`, `publicKey`) — registers your CI deploy key
5. After deploying via archive upload or SFTP, use `list_site_deployments` and `rollback_site_deployment` for instant atomic rollbacks if a release regresses.

## 2. Safe WordPress Plugin Update via Backup & Staging

Never test risky plugin or core upgrades directly in production. Have your agent take a backup, verify the upgrade in staging, and promote cleanly:

> **Prompt:** "Take an on-demand backup of `sit_acmeshop` labeled `pre-wp-update`, wait until it is ready, then create a staging clone. Run `wp plugin update --all` on the staging site, check `wp plugin list`, and wait for my approval before pushing staging to live."

**Tools your agent chains:**

1. `create_site_backup` (`siteId: "sit_acmeshop"`, `label: "pre-wp-update"`)
2. Poll `list_site_backups` until the new backup's status is `ready`
3. `create_staging_site` (`siteId: "sit_acmeshop"`)
4. `run_site_command` on the staging site ID (`command: "wp plugin update --all"`, `timeoutSeconds: 180`)
5. `run_site_command` (`command: "wp plugin list --status=active"`) to verify versions
6. After human review on `https://staging-<slug>.hostedez.site`: `push_staging_to_live` (`includeFiles: true`, `includeDatabase: true`) — which also purges live caches automatically.

## 3. MariaDB Schema Audit & Safe SQL Migration

Let your agent inspect live tables, export a portable SQL backup, and run targeted migrations:

> **Prompt:** "Inspect the database linked to `sit_acmeportal`, list the largest tables, export a schema-only backup first, then add an index on `orders(created_at)` and confirm it with `SHOW INDEX FROM orders`."

**Tools your agent chains:**

1. `list_databases` → locate the `db_...` ID linked to `sit_acmeportal`
2. `get_database_usage` (`databaseId`, `refresh: true`) & `list_database_tables` (`databaseId`)
3. `export_database_sql` (`databaseId`, `schemaOnly: true`)
4. `run_database_query` (`databaseId`, `sql: "CREATE INDEX idx_orders_created_at ON orders (created_at);"`)
5. `run_database_query` (`databaseId`, `sql: "SHOW INDEX FROM orders;"`)

> **Large SQL dumps**
>
> MCP `import_database_sql` supports inline SQL/gzip dumps up to **4 MiB** and `export_database_sql` supports up to **2 MiB**. For larger database imports (up to **64 MiB** upload / **256 MiB** decompressed), use [Database Studio](/databases/mariadb#sql-import-sql-and-sqlgz) in `app.hostedez.com`.

## 4. Onboard Branded Company Email with Tested Filters

Set up a complete custom domain email workspace and verify filter rules before real mail arrives:

> **Prompt:** "Enable email for `acme-example.com` with DMARC policy `quarantine`, create `support@acme-example.com` and `billing@acme-example.com`, alias `info@acme-example.com` to `support@acme-example.com`, set white-label webmail hostname `webmail.acme-example.com` with brand name `Acme Mail`, create a filter rule moving `[URGENT]` subjects to `Priority` with the `$Important` flag, and dry-run test that filter."

**Tools your agent chains:**

1. `enable_email_domain` (`domain: "acme-example.com"`, `dmarcPolicy: "quarantine"`)
2. `verify_email_domain_dns` (`domainId`)
3. `create_mailbox` (for `support` and `billing`) & `create_email_alias` (`sourceLocalPart: "info"`)
4. `update_email_branding` (`domainId`, `webmailHostname: "webmail.acme-example.com"`, `brandName: "Acme Mail"`) & `verify_webmail_hostname`
5. `create_email_filter_rule` (`mailboxId`, conditions on `subject` containing `[URGENT]`, actions `fileinto` + `addflag`)
6. `test_email_filters` (`mailboxId`, sample subject `"[URGENT] Checkout error"`) to confirm delivery folder and flags without sending live email.

## Safety Guardrails for Autonomous Agents

- **Use read-only scopes when auditing**: Request only `account:read sites:read` during OAuth consent for read-only reporting or monitoring agents.
- **Require human confirmation on destructive tools**: Instruct your agent in `AGENTS.md` or `.cursor/rules` to always ask before calling `delete_site`, `delete_database`, `delete_email_domain`, `delete_mailbox`, `push_staging_to_live`, or `restore_site_backup` (which also enforces `confirm: true`).
- **Handle one-time secrets carefully**: Tools like `rotate_site_sftp_password`, `create_mailbox`, and `reset_mailbox_password` return plaintext passwords once. Never ask agents to commit those values into source control.
- **Poll asynchronous jobs**: `create_site`, `create_site_backup`, and `restore_site_backup` execute asynchronously—poll `get_site` or `list_site_backups` rather than assuming immediate completion.
- **Give agents fresh docs**: Point your coding agent at [https://docs.hostedez.com/llms.txt](https://docs.hostedez.com/llms.txt) so it checks current Hosted EZ limits and flags before calling tools.

Source: https://docs.hostedez.com/automation/agent-workflows/index.mdx
