Explain why revenue changed this week with AI

An agent pulls two weeks of metrics, calculates the changes with real commands and explains the likely drivers, with caveats.

  • Read-only connection
  • Shell
  • Budget cap

Watch a real run

A real run on Oct 7, 2026, replayed. Model: openai/gpt-6-luna.

Input
{
  "period": "last_week"
}
Succeededrun_9550d4a9f62feef78ceb948d1c55da88$0.004644 of $0.05
  1. Queuedbudget $0.05 reserved
  2. MicroVMmicroVM ready
  3. MicroVMworker started · shell on · web off
  4. Connectionanalytics GET /metrics?period=last_week
  5. Resultanalytics GET → 200
  6. Shell$ python3 - <<'PY' from decimal import Decimal metrics={ 'Signups':(294,196,0), 'Active users':(280…
  7. MicroVMmicroVM destroyed
  8. Succeeded3 model calls, 6,404 tokensRecorded output (English)

    Revenue fell $546.85 (2.34%) in 2026-W40 vs. 2026-W39

    MetricCurrentPreviousChange
    Signups294196+98 (+50.00%)
    Active users2,8032,521+282 (+11.19%)
    Revenue$22,853.85$23,400.70−$546.85 (−2.34%)
    Churned accounts880 (0.00%)

    Likely drivers

    • Signups and active users rose while revenue fell; this may mean user growth did not translate into higher revenue during the week.
    • Churned accounts were unchanged as revenue declined; the revenue drop may not be reflected in this churn count.

    What this data cannot tell us

    • It does not explain why revenue changed or show revenue per user, signup conversion, or churn rates.
  9. Worker destroyed$0.004644 charged, $0.045356 released
Model $0.000644 · Web $0.00 · Compute $0.004

Run it yourself

Open the sample in the playground with the whole request filled in. It runs on your own account, within the budget shown, against the same read-only sample systems.

Budget for this sample: $0.05

How it works

Models are poor at arithmetic, so the shell is on: the agent computes every difference and percentage in the sandbox instead of in its head. It then connects the movements (signups, active users, churn) to revenue, and says what the data cannot show.

What the agent can and cannot do

The permissions are part of the request. Anything not listed here is not available to the run.

SettingAllowed
Connections
analytics: GET only, at ephemer.al/api/samples/analytics-api
WebOff
ShellOn, inside the sealed machine
FilesNone
Zero data retentionOff: the record is kept for 30 days
Budget$0.05, a hard cap
Timeout120 seconds

Credentials never enter the machine: a broker adds them to each call and enforces the methods above.

The code

This is the exact request the sample sends. Set EPHEMERAL_API_KEY to a member key of your organization.

curl -X POST $EPHEMERAL_URL/v1/runs \
  -H "Authorization: Bearer $EPHEMERAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d @request.json
Full request body request.json

The same body, with the files inline.

request.json
{
  "prompt": "Explain how revenue changed in input.period. Call GET /metrics?period=<input.period> on the analytics connection. Use the shell to calculate the absolute and percentage change of each metric against the previous week; do not do arithmetic in your head. Reply in Markdown, at most 180 words: a headline with the revenue change in dollars and percent, a table of the four metrics with current, previous and change, then 'Likely drivers' (two bullets that link the metrics, worded as hypotheses) and 'What this data cannot tell us' (one bullet). Use only what the data returns and never guess; if a call fails or a field is missing, say so.",
  "input": {
    "period": "last_week"
  },
  "connections": {
    "analytics": {
      "type": "http",
      "url": "https://ephemer.al/api/samples/analytics-api",
      "auth": {
        "type": "bearer",
        "token": "sample_read_key"
      },
      "allowed_methods": [
        "GET"
      ],
      "instructions": "GET /metrics?period=last_week or period=2026-W40 returns signups, active_users, revenue_cents and churned_accounts for that ISO week, with the same figures for the week before. Amounts are in cents."
    }
  },
  "shell": true,
  "timeout_seconds": 120,
  "max_cost_micros": 50000
}

Read more

Related samples

esc

Nothing matches “”.