# Setting up an AI agent for your app

> Add a chat assistant to your app that can look up and change data for each user.


An AI agent is a chat assistant that lives inside your app. Unlike a plain AI call, it can **use your app's data**: look up a user's orders, log a workout, open a support ticket.

## Ask for one

> "Add a support assistant that answers questions about the signed-in user's orders and can open a ticket if something is wrong."

Draftship writes the agent definition, gives it access to the right tables, and builds the chat interface.

## What you control

| Setting | Meaning |
|---|---|
| Instructions | Who the agent is, its tone, what it should and shouldn't do. |
| Greeting | The first message users see. |
| Data access | Which tables it can **read** and which it can also **write**. |

Change any of these by asking in the chat: "make the assistant more formal", "let the coach also update goals".

## Safety by design

The agent always acts **as the person chatting**. It can only see and change what that person could see and change in the app — your [data permissions](/docs/security/managing-data-permissions) apply to every lookup and write. A signed-out visitor's agent can't read private records.

## Review conversations

**Dashboard → AI agents** lists your agents with their data access and every conversation, including the lookups and changes the agent made.

## Skills

Skills are reusable instructions, like your refund policy or brand voice, written once and shared by your agents. Ask for one in the chat ("give the support agent a skill for our refund policy"). Draftship saves it in `draftship/agent-skills/<name>.md`. The agent always sees what each skill is for and reads the full instructions only when it needs them, which keeps replies fast. Up to 10 skills per agent.

## Memory

Memory is on by default. The agent saves short facts worth keeping, such as preferences or decisions, and brings them back in later conversations. Choose what it remembers:

- **Shared:** facts for everyone who chats with it ("We're closed on Sundays").
- **Per person:** facts about each signed-in user or Telegram contact ("Prefers short answers").
- **Both:** the default.

**Dashboard → AI agents → Saved memories** lists everything the agent remembers. Delete anything that's wrong. Agents never store passwords or payment details, and memory is trimmed automatically when it gets long.

## Who can chat

By default anyone can chat, including visitors who aren't signed in. For agents that handle personal data, ask for *signed-in users only*. Visitors then need to sign in first, and Telegram chats get a polite refusal.

## Telegram

Let people talk to your agent in Telegram:

1. In Telegram, message **@BotFather**, send `/newbot` and follow the steps. It gives you a token like `123456789:AA…`.
2. In **Dashboard → AI agents**, open **Connect Telegram** on the agent, paste the token and, optionally, a welcome message.
3. People open your bot (`t.me/<your_bot>`) and send `/start`.

The bot has the same tools and data access as the in-app chat, acting as a signed-out visitor. Each Telegram chat keeps its own conversation (it appears as *Telegram: @username* in your dashboard) and its own memories. Text messages are supported; voice notes and images aren't yet.

## Usage

Agent replies use AI and count against your limits, like other [AI in your app](/docs/logic/ai-in-your-app).
