# Running a query or action: `jadpo call`

Where Rails has an interactive `rails console`, Jadpo has a one-shot
command. `jadpo call` runs one query or action against your local database
as a caller you name, with JSON in and out, so your agent can script it.

```text
$ jadpo call todos_for_owner --as 0192…a7 --input '{"owner_id":"0192…a7"}'
{"items":[{"id":"0192…f1","title":"Buy milk"}],"next":null}

$ jadpo call complete_todo --as 0192…a7 --input '{"todo_id":"0192…f1"}' --rollback
{"id":"0192…f1","completed_at":"2026-10-12T09:20:00Z"}
rolled back
```

## Policy always applies

`--as <user id>` signs in as that user, through the same principal, the
record of who is calling, that a route would build
([The principal](the-principal.md)). Without `--as`, the
caller is someone who isn't signed in. Nothing switches policy off, so
what works here also works through a route.

## Writes, on your machine only

An action may write. `--rollback` runs it inside a transaction and then
rolls the transaction back, like Rails' `--sandbox`. As with
[seeds](seeds.md), `jadpo call` refuses to run against any
environment marked production.

Every call is recorded in the timeline, so `jadpo trace` and `jadpo why`
work on it.
