# Build your first app

Source: https://docs.autessa.com/docs/guide/tutorials/first-app

> A todo list app with an agent that reads your email every night and files each message as a task — built end to end in about 40 minutes.

# Build your first app

By the end of this tutorial you'll have a real product: a todo app you can open in your browser, fed by an agent that reads your unread email every night and quietly turns it into tasks. You describe the app in plain language — Autessa's AutoBot writes it.

Here's the shape of what you're building:

- An **AutessaDB table** called `Tasks` — the single source of truth.
- An **agent** with three tools: read unread Gmail, insert a task, mark the email as read.
- A **scheduled job** that runs the agent every night at 2 AM.
- A **web app**, generated from one prompt, that shows and manages the tasks.

The magic is that these four pieces don't know about each other directly — they all just meet at the table. The agent writes rows; the app reads them; you check things off. That's the Autessa pattern in miniature, and once you've built it you'll recognize it everywhere.

> You'll need an Autessa account at [builder.autessa.com](https://builder.autessa.com) and a Gmail account you're willing to connect. Total time: about 40 minutes. If you've never created a tool or agent before, the [Quickstart](/docs/guide/quickstart.md) is a gentler on-ramp — but you can also just start here.

## Step 1 — Create the Tasks table

Everything meets at the table, so the table comes first. (This order matters for a second reason too: in Step 8 the AutoBot will *discover* this table by name — it has to exist before the app is built.)

Go to **AutessaDB → Tables → Create Table**, name it `Tasks`, and add these columns:

| Column | Type | Why |
| --- | --- | --- |
| `title` | Short Text | The task, in a few words |
| `notes` | Long Text | Detail pulled from the email body |
| `done` | Boolean | What the app's checkbox toggles |
| `source` | Short Text | `"gmail"` for agent-created tasks, `"manual"` for yours |
| `email_from` | Short Text | Who sent it |
| `email_subject` | Short Text | The original subject line |
| `email_message_id` | Short Text | Dedupe key — one task per email, ever |

You don't need a "created" column: every AutessaDB table automatically carries `id`, `created_at`, and `last_updated`, managed by the system (timestamps are UTC). If you ever want a *custom* date column — say, a due date — store it as Short Text holding an ISO-8601 UTC string; the built-in timestamps are the only date-typed columns a table has.

Prefer to delegate? Open the **DB Copilot** (the Autobot button on the Tables page) and paste:

```text title="DB Copilot prompt"
Create a table called Tasks with columns: title (short text), notes (long text),
done (boolean), source (short text), email_from (short text),
email_subject (short text), email_message_id (short text).
```

Either way, you should end up looking at an empty Tasks table. Empty is correct — the agent fills it.

## Step 2 — Create the agent

The agent is the heart of this build, so create it next — the tools it will use come right after. Go to **Build → Agents → New agent**, name it `EmailTaskAgent`, and give it a description a future teammate (or a manager agent) would understand: *"Reads unread email and files actionable messages as tasks in the Tasks table."*

Then the instructions — the agent's standing orders, so be specific about the sequence and the judgment calls:

```text title="EmailTaskAgent instructions"
Today is @@{currentDate}.

Your job is to turn unread email into tasks.

1. Call Read Unread Emails.
2. For each message, decide whether it is actionable — something the user
   needs to do, reply to, review, or pay. Skip newsletters, promotions,
   receipts, and automated notifications.
3. For each actionable message, call AddTask exactly once:
   - title: a crisp task phrase (max ~10 words), not the raw subject line
   - notes: one or two sentences of context from the subject and body
   - source: "gmail"
   - email_from, email_subject: from the message headers
   - email_message_id: the message's id
4. After filing a task, call Mark Email as Read with that message's id.
   Also mark skipped messages as read so they are not reconsidered tomorrow.
5. Finish with a one-line summary: how many emails you read, how many
   tasks you created.
```

That first line uses `@@{currentDate}` — a [built-in variable](/docs/guide/agentic/environment-variables.md#built-in-variables) that resolves to today's date at run time, so the agent never has to guess what day it is.

Notice the instructions name three tools — **Read Unread Emails**, **AddTask**, **Mark Email as Read** — that don't exist yet. That's deliberate: you've defined *what* the agent does; the next three steps give it its hands.

## Step 3 — Connect Gmail

Tools that touch your email need a live connection to your Gmail account, so the connection comes first. Go to **Connectors → Gmail**, name the connection (something like `MyGmail`), and click through the Google sign-in. When you're back, the connector card shows your Gmail address — you're connected.

A connector is just the authorized pipe; it does nothing by itself. Tools built on top of it are what agents actually call — and that's the next step.

## Step 4 — Mint the email tools

Now the shortcut most people miss: on the Gmail connector, open **Create Gmail Tools**. This modal creates ready-made, pre-wired tools against this connection — no configuration screens. Select:

- **Read Unread Emails** — lists your unread messages with sender, subject, and full body (up to 10 by default).
- **Mark Email as Read** — takes a message id, marks that email read.

Marking emails read is how the nightly agent avoids processing the same message twice: what's been filed is no longer unread.

Then hand them to your agent: open `EmailTaskAgent`, click **Import Existing Tool**, and attach both.

## Step 5 — Create the AddTask tool

The agent needs one more ability: writing a row into your Tasks table. Go to **Build → Tools → New tool**, name it `AddTask`, and choose the type **AutessaDB Insert**.

In the configuration, pick the `Tasks` table. For each column you now choose between a fixed value and a variable — this is the important part:

- `title`, `notes`, `source`, `email_from`, `email_subject`, `email_message_id` → toggle **Use Variable** on each, which binds them to `@@{title}`, `@@{notes}`, and so on.
- `done` → leave static, set to `false`. New tasks start open.

Those `@@{...}` placeholders become the tool's arguments. When the agent calls `AddTask`, it supplies a value for each one, and the row is written with exactly those values. One tool, reusable for any task from any caller.

Attach it the same way as before — **Import Existing Tool** on `EmailTaskAgent` — and the agent now has all three tools its instructions were written for.

## Step 6 — Test it while you watch

Send yourself two test emails with something actionable in each ("Can you review the Q3 pricing doc by Friday?", "Don't forget to send Dana the onboarding checklist"). Then, on the agent page, hit **Test** to open the streaming test window and type: *"Read my unread emails and file the actionable ones as tasks."*

_(interactive UI demo omitted)_

Watch the tool-call cards appear in order: **Read Unread Emails** first, then an **AddTask** per actionable message — you should see it fire once for each of your two test emails, with a title the agent wrote itself — then **Mark Email as Read**. When the summary arrives, open **AutessaDB → Tables → Tasks**: two new rows, ready for the app you're about to build.

If the agent filed something you'd have skipped (or skipped something you wanted), edit the instructions — the judgment lives in instruction 2's wording — and test again. This tighten-the-prompt loop is most of what "building an agent" means in practice.

## Step 7 — Put it on a schedule

Go to **Scheduled Jobs → Create**. Name it `NightlyEmailSweep`, then:

1. **Schedule**: choose **Cron → Daily**, set **2:00 AM**, and pick your timezone from the selector — the schedule runs in the timezone you choose, and the form shows the next three run times so you can sanity-check it. (The Advanced tab accepts a raw AWS six-field Quartz expression like `0 2 * * ? *`, if you ever need something the friendly builder can't say.)
2. **Action**: choose **Invoke Agent**, select `EmailTaskAgent`, and set the agent input to: *"Read all unread emails and add each actionable one as a task."*

Save, and the loop is closed: every night at 2 AM, your inbox gets triaged into the Tasks table while you sleep. The job's **History** page shows each run and what the agent did.

## Step 8 — Describe the app, watch it get built

Now for the part that feels like magic. Go to **App Builder → New App**, name it `TaskBoard`, add a short description, and create it. The editor opens on a working app scaffold — it already runs; it just doesn't do anything yet.

Open the **AutoBot** panel, click **Start New Conversation**, and paste:

```text title="AutoBot prompt"
Build a clean, minimal todo app backed by my existing AutessaDB table
called "Tasks".

- Show open tasks (done = false) newest first, each with a checkbox
  that toggles done.
- When a task's source is "gmail", show the email_subject and
  email_from underneath the title in smaller text.
- Let me add a manual task (title + optional notes, source "manual").
- Let me click a task to view and edit its notes.
- A small toggle reveals completed tasks.
```

Here's what happens next, and why each part exists:

1. The AutoBot replies with an **implementation plan** — a summary, numbered steps, and the files it intends to touch. This is your chance to redirect before any code is written.
2. Then comes a **changes card**: every file creation and edit as a reviewable diff. Click through them if you're curious — it's real React code, and it's yours.
3. Click **Apply Changes**, and the **live preview** re-renders. Your test emails from Step 6 are already sitting there as open tasks, subject lines and senders underneath, exactly as you asked.

Notice what you *didn't* do: you never told the app your table's ID, and you never configured data access. The AutoBot looked up your `Tasks` table by name and registered it in the app's `autessa.config.json` — the file that maps every Autessa resource an app uses. And the app reads and writes AutessaDB *as you*, through a short-lived credential Autessa hands the app at runtime. Your data never becomes anonymous — it's your session doing the reading.

Want to iterate? Just keep talking: *"Add a count of open tasks in the header"* — plan, diff, apply, preview. This conversational build loop is the whole App Builder workflow; there is no other editor you're secretly supposed to learn. (Full detail: [Vibecode AutoBot](/docs/guide/autobots/vibecode.md).)

## Step 9 — Publish and launch

The editor preview is private to you. To get a real, launchable app, click **Publish**. Publishing kicks off a build — the status shows **Building** for a minute or so, then the version flips to **Published**, and **Launch** opens your app at its own URL.

One architectural note worth knowing as your apps grow: your app reads the table as the signed-in user, while the nightly agent writes rows under your company's system identity. Two identities, one table — which is exactly why the table, not the app or the agent, is the source of truth.

## What you just built

Take stock, because this little todo app quietly used most of the platform:

- **AutessaDB** as the shared state everything meets at
- A **connector** turning your Gmail into agent-usable tools
- A **tool** with variable bindings (`@@{title}`, …) as a reusable write path
- An **agent** exercising judgment on your behalf, on a **schedule**
- An **app**, described in a paragraph and generated in a conversation

Every bigger thing you build in Autessa is this same pattern with more pieces.

## Where to next

- **Make it event-driven** — add a [trigger](/docs/guide/autessadb/triggers.md) on the Tasks table so that inserting a task fires a follow-up (a Slack-style notification tool, a daily digest, anything).
- **Ship it to others** — bundle the table, tools, agent, job, and app into a [marketplace listing](/docs/guide/marketplace/publishing.md) that another company can install in one click.
- **Embed the agent elsewhere** — call `EmailTaskAgent` from your own product via the [Agent API](/docs/api/agents.md), with keys from [Authentication](/docs/guide/authentication.md).

## Related

- [Quickstart](/docs/guide/quickstart.md) — the 15-minute version of this journey
- [App Builder](/docs/guide/platform/app-builder.md) — everything the editor can do
- [AutessaDB Tables](/docs/guide/autessadb/tables.md) — why the table is the center of gravity
- [Scheduled Jobs](/docs/guide/scheduled-jobs.md) — schedules beyond "nightly"
- [Tool Types](/docs/tools.md) — the full catalog of what agents can do

