# What Were Our Numbers Last Month? An Investor-Update App's Read-Only Metrics From Each Startup's Neon Database

Investor-update software makes one agent per startup that runs read-only SQL on the founder's Neon database and returns last month's signups and active accounts.

[Run this on Rush](https://cloud.getrush.ai/run/draft-monthly-metrics-for-investor-update/neon/). Opens the console with this prompt ready to send. Connect Neon there first.

## What the agent does

This is for a company that sells software to startup founders for writing their monthly investor update. The update always opens with the same few numbers: new signups, active accounts, accounts that pay, and how each moved since last month. Many of those founders keep their product's data in Postgres on Neon, so on the first of every month someone opens a SQL console and rewrites last month's queries. The software company saves one agent as a template that names the Neon MCP server and holds instructions to run read-only queries and show every query it ran, then makes one agent from it per startup with `POST /o/{org}/agents {"template": "<template id>", "name": "metrics-<startup id>"}`. Before saving the template, the company connects Neon to its own account with `POST /me/connections {"type": "mcp", "name": "neon", "url": "https://mcp.neon.tech/mcp", "auth": {"mode": "oauth"}}`.

A founder connects Neon once from the software's settings. The backend calls `POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "neon"}` and opens the `authorize_url` in a popup, where the founder signs in on Neon's own page. Neon's docs say an OAuth sign-in can choose read-only scope on that page, which removes the tools that write and leaves `SELECT` queries and schema inspection, and that the sign-in can be limited to one project. The settings page asks the founder to choose both. In read-only mode Neon also withholds connection strings, so neither the software company nor Rush ever holds a database password.

During setup the founder tells the software what each number means in their schema, and the backend passes that in the prompt: which table holds accounts, which column marks the signup time, what counts as active (an event in the last 30 days, a login, a paid subscription). On a run the agent calls `get_database_tables` and `describe_table_schema` on each table named, so a column that was renamed since last month shows up as a clear message rather than a wrong number. It then runs each count with `run_sql`, one `SELECT` per statement, for last month and the month before, passing the project id as Neon's server asks on a connection that is not limited to one project.

It returns each metric with its value for both months, the change, and the exact SQL that produced it, so the founder can paste the query into Neon's console and get the same row. It writes nothing: read-only mode means the server has no tool that could, and the template's instructions also forbid selecting rows of personal data such as emails or names, only counts. Revenue, which usually lives in a billing system rather than the product's database, is left for the founder.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "<agent id>",
  "input": "Compute metrics for October 2026 and September 2026 from Neon project winding-river-12345678, database neondb. Definitions from the founder: signups = rows in public.accounts with created_at in the month; active accounts = distinct account_id in public.events with occurred_at in the month; paying accounts = rows in public.subscriptions with status 'active' on the last day of the month (started_at <= that day and (ended_at is null or ended_at > that day)). First call get_database_tables and describe_table_schema for public.accounts, public.events and public.subscriptions; if a column above is missing, say so and skip that metric. Run each count with run_sql as a single SELECT returning one row. Never select emails, names or any column other than what a count needs. Return only JSON: {metrics: [{name, october, september, change_percent, sql}], skipped: [{name, reason}]}. Do not run anything but SELECT."
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

The answer is JSON in the session's `result` and in the `run.completed` webhook. The software drops the numbers into the top of the founder's draft update, each with a small link that shows its query, and the founder reads them before anything is sent to investors.

What the founder checks: that the definition still matches how they talk about the business (a test account or an internal team counted as active is the usual surprise), any metric listed under `skipped`, and a large swing, which is more often a data change, such as a backfill, than a real one. The numbers are the founder's own data counted the founder's way; what they mean for the company is the founder's to say. The transcript shows each tool call and its rows.

## Run it on every first working day of the month

The company's scheduler sends one `POST /o/{org}/sessions` per connected startup on the first working day of each month, with that startup's agent id as `agent`, its project id, database and definitions in `input`, and a `request_id` that is a UUID v5 of the startup id and the month, so a retried job starts no second run. Runs past the key's concurrent limit are created `queued` and start as earlier ones finish.

A founder who edits a definition in the software can press Recalculate, which starts the same request for that one startup at once. Each month's run stays readable from the session list, so last quarter's numbers can be traced to the queries that made them.

## Why run it on Rush?

A BI connector would ask each founder for a database connection string and keep it on the software company's servers. Here the founder signs in to Neon on Neon's page, in read-only mode, and that sign-in is connected to the founder's own agent only: a run for one startup cannot reach another startup's database, and the founder can end it from Neon at any time.

The company keeps one template. A new metric the product offers, such as accounts lost in the month, is one `PATCH` to the template that reaches every startup's next run. `GET /o/{org}/sessions?agent=<agent id>` lists one startup's runs and their `total_cost_usd`, what each run's model calls cost, so the company can add up the feature's model cost per customer; compute comes from the same credits but is not on the session.

## Frequently asked questions

### Can the agent change or delete the founder's data?

Not when the founder chooses read-only on Neon's consent page: Neon's server then removes every tool that writes and refuses to hand out connection strings. The template's instructions and the prompt also allow only `SELECT`.

### Will these queries slow down the founder's production database?

They are a few counts once a month. A founder with a read replica can point the agent at it, since Neon's `run_sql` takes a `compute_id` and otherwise uses the read-write compute.

### Does the founder need a Rush account?

No. They sign in to Neon once from the software's settings. The agent, its runs and the bill belong to the person who created the software company's API key.

### What if the founder's data is not on Neon?

This template names Neon only. Rush also lists other database MCP servers, such as Supabase and PlanetScale, and the company would save a template per database, each with the same instructions.

## More Neon jobs

- [How Much Neon Did Each Client Use Last Month? A Software Agency's Usage Report for Invoices](https://getrush.ai/run/bill-each-client-for-neon-usage/neon/)

## More jobs like this: Run an agent per customer task

- [Draft Replies to Customer Order Questions in an Online Store's Gmail](https://getrush.ai/run/draft-replies-to-order-questions/gmail/)
- [How Does Real Estate Marketing Software Draft Posts in Each Realtor's Buffer When a Listing Goes Live?](https://getrush.ai/run/draft-social-posts-for-each-new-listing/buffer/)
- [What Happened on My Renovation This Week? A Contractor App Drafts Each Homeowner's Update From the Contractor's monday.com Board](https://getrush.ai/run/draft-weekly-homeowner-job-updates/monday/)
- [Draft Each Restaurant's Weekly Specials Posts as Buffer Drafts](https://getrush.ai/run/draft-weekly-specials-posts/buffer/)
- [How Does Time-Tracking Software Draft Each Consultant's Weekly Timesheet From Their Microsoft Calendar?](https://getrush.ai/run/draft-weekly-timesheet-from-calendar/microsoft-calendar/)

## Keep reading

- [Connect Neon to Rush once, then name it on any run](https://getrush.ai/integrations/neon/)
- [Start your first run from the developer API quickstart](https://getrush.ai/docs/quickstart/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
