# Add an AI agent to the app you built in Replit

There are two steps. Step 1 works from any chat. Step 2 needs the Replit App on your computer.

**Step 1: create the agent from a chat.** In Claude, ChatGPT or Cursor, add the remote MCP server `https://vatio.ai/mcp` as a connector, sign in with a Vatio account and ask for the agent. It is created in a preview you can try. Nothing reaches your users until you publish it. Details: [Vatio in Claude and ChatGPT (MCP)](https://vatio.ai/docs/mcp).

**Step 2: build the agent into the app.** Push the Replit App to GitHub, clone the repository, open it in Claude Code or Cursor and run:

```text
npx @vatio-ai/skills
/vatio-init
```

`/vatio-init` reads the app and creates the agent, or finds the one from step 1. Then ask your coding agent to put the web widget in the app. `/vatio-improve` is the daily routine afterwards ([Improve your agent](https://vatio.ai/docs/improve)). Vatio runs the conversations.

## Get your project into Claude Code or Cursor

1. In your Replit App, open the **Tools** section, select **+** and choose **Git**.
2. In the Git pane, initialize a repository if there isn't one, connect it to GitHub and push your code.
3. Clone the repository on your computer and open the folder in Claude Code or Cursor. You need Node.js 20 or newer.

Replit doesn't pull from GitHub on its own: after you push from your computer, you bring the changes in with **Pull** in the Git pane. On a paid Replit plan there is another way: add an SSH key in the **SSH** section of your project's **Developer** tools, and Cursor or VS Code opens the Replit App directly, with changes synced both ways as you make them.

In Claude Code, run the first command in a terminal in the project and the second in Claude Code. In Cursor or Codex, ask it to use vatio-init. The first time vatio-init pushes the agent, your browser opens to sign in with email, Google or GitHub.

## What vatio-init finds in a Replit project

vatio-init first looks for a `vatio.yml` in the repository. If there is one, the agent already exists and it works on that one. Then it reads the app. In a Replit App that usually means:

- **Your server's routes.** The API your app already calls. The agent's tools can call it to read or change a user's data.
- **A database behind it.** Replit's database is PostgreSQL, reached through your server. Tools don't talk to the database; they call the routes in front of it.
- **Sign-in.** Replit Auth, where your users sign in with a Replit account, or Clerk Auth, with accounts of your own.
- **Your pages.** Help text, pricing and policies can become knowledge entries.

Vatio runs your tools from its servers, so they call your published app, at its `replit.app` address or your own domain. Replit's development preview is private by default, and a tool can't reach your computer. Your backend's address is a secret kept in Vatio, not in the repository.

## Your users, signed in

Replit Auth and Clerk don't hand Vatio a session it can read, so your server signs a short-lived token for whoever is signed in. `vatio auth --new-key` creates the key pair: `identity.pub` stays in the repository and `vatio.yml` names it, and `identity.pem` goes into your server as a secret. Vatio holds only the public half, so it can check a token but never create one. Your coding agent can add the signing endpoint.

Store the private key in Replit's **Secrets**, and add it again in the **Publishing** pane: secrets set in the Project Editor don't carry over to the published app.

For the token format and private tools, see [Authentication](https://vatio.ai/docs/authentication/) and [Private tools](https://vatio.ai/docs/authentication/tools).

## Put the agent in your app

Your coding agent adds the [web widget](https://vatio.ai/docs/channels/widget): a script tag, or the `@vatio-ai/widget` package mounted when the page loads. Your page asks your server for the token and hands it to the widget with `widget.identify(token)`, or `null` when the user signs out.

Origins: every publishable key accepts any `https` subdomain of `replit.dev` and `replit.app`, Replit's development and published addresses, without listing them. When your app moves to a custom domain, add that domain: run `vatio keys origins` or use **Settings → API keys** in the inbox. A page on an origin the key does not accept gets `origin_not_allowed`, and the browser console names the origin to add.

Use preview's key while you try the agent, and switch to a live key when you publish.

## Keep building in Replit

Commit `vatio.yml`, `tools/`, the knowledge, `identity.pub` and your app's changes, and push. In Replit, use **Pull** in the Git pane to bring them in, and resolve any conflict it highlights. Git commands in Replit's Shell show up in the Git pane too.

- **Keep the agent's files in the repository.** They are the agent: vatio-init and `/vatio-improve` change them from your clone, and Vatio deploys what they say.
- **Pull before you work.** Before running vatio-init or `/vatio-improve` again, push what you built in Replit since and pull it into your clone.
- **Republish for your users.** Changes in the Project Editor don't replace the live app until you select **Republish**. Do it when your coding agent changed a route a tool calls.

If a change in Replit renames a route a tool calls, that tool's calls start failing. `vatio tools --env live` shows each tool's errors.

## Try it, then publish

vatio-init links to the inbox, where **Try the agent** opens, with WhatsApp, Instagram and a web chat. The web chat is a visitor who isn't signed in, so it only reaches public tools. To try what a signed-in user gets, run your app in Replit's preview with the preview's widget in it and sign in as a test user. The tools call your published app, so use a test account.

When it does what you want, tell your coding agent to publish, switch the widget to a live key and **Republish** in Replit. Pricing: https://vatio.ai/pricing.

## Sources

Checked on 14 October 2026.

- [Replit: Using the Git pane](https://docs.replit.com/features/workspace-tools/git-interface)
- [Replit: SSH](https://docs.replit.com/features/workspace-tools/ssh)
- [Replit: Auth](https://docs.replit.com/learn/projects-and-artifacts/auth)
- [Replit: Storage and databases](https://docs.replit.com/learn/projects-and-artifacts/storage-and-databases)
- [Replit: Publish your app](https://docs.replit.com/build/publish-your-app)
- [Replit: Troubleshoot publishing](https://docs.replit.com/build/troubleshooting)

## Frequently asked questions

### My Replit app uses Replit Auth or Clerk. Can the agent know who is signed in?

Yes. Your app's server already knows who is signed in, so it signs a short-lived token for that user with a key from `vatio auth --new-key` and hands it to the chat widget. Your coding agent can add that endpoint. Vatio verifies the token with the public key and forwards it to your API on every call a private tool makes, and your API reads the user from it.

### Does the Vatio widget work on replit.app and replit.dev?

Yes. Every publishable key accepts any `https` subdomain of `replit.app` and `replit.dev` without listing them. When your app moves to a custom domain, add that domain to the key's origins.

### How do changes get back into Replit?

Through the same GitHub repository. After your coding agent pushes from your computer, use **Pull** in the Git pane of your Replit App, and republish in Replit when the change should reach your users. On a paid Replit plan, Cursor can instead open the Replit App over SSH, with changes synced both ways as you make them.

## Related guides

- [v0 apps](https://vatio.ai/docs/guides/ai-agent-for-v0-apps): Connect your v0 project to GitHub, add the agent to the Next.js app, and allow your vercel.app address.
- [Build an AI agent](https://vatio.ai/docs/guides/build-an-ai-agent): Instructions, knowledge, tools and publishing.
- [An AI chat for your web app or site](https://vatio.ai/docs/guides/ai-chat-widget-for-your-website): The web widget in your app.
- [Improve your agent](https://vatio.ai/docs/improve): Report mistakes in the inbox and fix them with /vatio-improve.
