> Every Taji docs page as Markdown: https://docs.taji.is/llms.txt

# Have your agent place a `taji_sim` order

You ask your agent to buy a share on `taji_sim`. It stages the order and places it, the kernel parks the place until you approve it in the window, and the agent reads back that nothing is placed yet.

You need your agent [connected to Taji over MCP](https://docs.taji.is/guide/agent.md). The quickstart's [first order](https://docs.taji.is/guide/first-session.md#3-place-a-simulated-order) shows the same order from the ticket.

`taji_sim` does not hold your agent's orders by default, so you turn **Agent approvals** on for it first. Only you can: its route answers `local`, `page` and `sheet`, not your agent's token; you send it with your own, as [Read bars over the wire with curl](https://docs.taji.is/cookbook/wire-read-bars.md) does. `calls.json` sends that request first, then the wire request each of your agent's tool calls makes, in order; `{place.approval}` stands for the `approval` id in the place's answer:

```json file="examples/agent-sim-order/calls.json" title="calls.json"
[
  {"name": "approvals_on", "method": "POST", "route": "/verb/link/accounts/taji_sim/approvals", "body": {"on": true}},
  {"name": "bars", "method": "GET", "route": "/get/bars?symbols=equity:SPY&timeframe=D&limit=1"},
  {"name": "stage", "method": "POST", "route": "/verb/trading/taji_sim/draft/stage", "body": {"symbol": "equity:SPY", "side": "buy", "qty": 1, "order_type": "market", "price": "{bars.[-1].close}", "spot": "{bars.[-1].close}"}},
  {"name": "place", "method": "POST", "route": "/verb/trading/taji_sim/draft/place", "body": {"rev": "{stage.rev}"}, "shot": true},
  {"name": "approval", "method": "GET", "route": "/read/approvals/{place.approval}"},
  {"name": "order", "method": "GET", "route": "/read/trading/taji_sim/orders?limit=1"}
]
```

![Chart 1 of SPY with the agent's 1-share market buy staged on the price scale, the order ticket on the right, and the approval card over the chart: Your agent, sim, the route and rev, Decline and Approve](https://raw.githubusercontent.com/TajiAI/Taji/main/docs/cookbook/examples/agent-sim-order/shot.png)

You type:

> Buy 1 share of SPY on `taji_sim` at market, then tell me what happens to the order.

Each tool call is one request to the [wire](https://docs.taji.is/reference/wire.md#the-mcp-tools). The bridge adds the leading `/`, URL-encodes a `query` and sends every request with the agent token. The first request, `approvals_on`, is `POST /verb/link/accounts/taji_sim/approvals` with `{on: true}`: it answers the account's row, whose `approvals` reads `true`.

1. **`read {route: "get/bars", query: {symbols: "equity:SPY", timeframe: "D", limit: 1}}`** is `GET /get/bars?symbols=equity:SPY&timeframe=D&limit=1`, the price the agent stages against.
2. **`stage {route: "verb/trading/taji_sim/draft/stage", body: {symbol: "equity:SPY", side: "buy", qty: 1, order_type: "market", price: 142.62, spot: 142.62}}`** is `POST /verb/trading/taji_sim/draft/stage`. `stage` sends a trading route no venue hears, so nothing waits for you. The answer's `rev` is the draft's version, which placing it needs.
3. **`order {route: "verb/trading/taji_sim/draft/place", body: {rev: "<the stage's rev>"}}`** is `POST /verb/trading/taji_sim/draft/place`. `order` sends a trading route a venue hears. With Agent approvals on, the kernel does not send it: it parks it and answers 202.
4. **`read {route: "read/approvals/<id>"}`** is `GET /read/approvals/{place.approval}`, the approval the place answered with.
5. **`read {route: "read/trading/taji_sim/orders", query: {limit: 1}}`** is `GET /read/trading/taji_sim/orders?limit=1`, the account's newest order.

The wire answers the bars read in Arrow IPC; the bridge hands your agent these rows:

```json file="examples/agent-sim-order/bars.json"
[
  {
    "symbol": "SPY",
    "provider": "csv-source",
    "start_dt": "2026-12-03T00:00:00+00:00",
    "knowable": "2026-12-03T21:00:00+00:00",
    "open": 141.45,
    "high": 143.43,
    "low": 141.23,
    "close": 142.62,
    "volume": 5000000,
    "vwap": null,
    "trade_count": null,
    "up_volume": null,
    "down_volume": null
  }
]
```

The answer to the stage:

```json file="examples/agent-sim-order/stage.json"
{
  "node": "trading/taji_sim/draft",
  "rev": "01a24251-a8bf-76f7-882c-bea71e23fcbe"
}
```

The answer to the place, 202:

```json file="examples/agent-sim-order/place.json"
{
  "approval": "01a24251-a990-7366-a0fd-7bec3a7dceb8",
  "expires_at": 1796412577,
  "window": false,
  "summary": "SPY · BUY · MARKET · 1 shares · DAY on taji_sim"
}
```

- `approval` is the parked place's id, and `summary` is the order in the ticket's words.
- `expires_at` is the Unix second an hour after it parked. A card unanswered by then expires and sends nothing, and so does a restart.
- `window` is `false` because no page held the live feed open when this was captured. With Taji's window open it is `true`, and a card appears at the canvas's top centre: the agent, the order, the account, the minutes left, **Decline** and **Approve**.

The answer to the approval read:

```json file="examples/agent-sim-order/approval.json"
{
  "id": "01a24251-a990-7366-a0fd-7bec3a7dceb8",
  "route": "trading/taji_sim/draft/place",
  "body": {
    "rev": "01a24251-a8bf-76f7-882c-bea71e23fcbe"
  },
  "account": "taji_sim",
  "summary": "SPY · BUY · MARKET · 1 shares · DAY on taji_sim",
  "preview": null,
  "state": "pending",
  "parked_at": 1796408977,
  "expires_at": 1796412577,
  "by": null,
  "result": null,
  "agent": null,
  "why": "Approvals are on for this account."
}
```

- `state` is `pending`: the place has not been sent. `route` and `body` are the held request, the draft's `rev` among them.
- `why` is the gate's sentence for the account. `by` and `result` are `null` until someone answers it.
- `agent` names the chat whose bridge parked it, as `{session, agent, name}`, and is `null` here because the capture sends the requests from a script with your token, not from a chat. The gate parks every token but the by-hand one, so your agent's place parks the same way.

The answer to the orders read:

```json file="examples/agent-sim-order/order.json"
{
  "rows": [],
  "rows_total": 0
}
```

*Captured 2026-12-04 on a headless kernel reading a made-up daily series for SPY.*

- `rows` is empty: a parked place has placed nothing, so your agent can tell you the order is waiting for you and no more.
- You decide in the window. **Approve** sends the held place as your agent's, its own checks run then, and the approval turns `done` with the place's answer as its `result`. **Decline** turns it `declined` and sends nothing.
- Approving is by hand, in Taji's own window: no agent token and no script can do it, which is why the capture stops here.
- After you approve, your agent reads the same orders route again and finds the row, as the quickstart's [order read](https://docs.taji.is/guide/first-session.md#3-place-a-simulated-order) shows it: `state` `Acked` and `line_state` `WORKING`, then **Filled** when it fills. The fill is simulated.

## Change it

Ask for a limit order, and your agent stages one at 140; the place parks the same way:

```diff
-  {"name": "stage", "method": "POST", "route": "/verb/trading/taji_sim/draft/stage", "body": {"symbol": "equity:SPY", "side": "buy", "qty": 1, "order_type": "market", "price": "{bars.[-1].close}", "spot": "{bars.[-1].close}"}},
+  {"name": "stage", "method": "POST", "route": "/verb/trading/taji_sim/draft/stage", "body": {"symbol": "equity:SPY", "side": "buy", "qty": 1, "order_type": "limit", "price": 140, "spot": "{bars.[-1].close}"}},
```

Ask your agent to withdraw the order. It declines its own approval, which sends nothing and turns the approval `declined`:

```diff
   {"name": "approval", "method": "GET", "route": "/read/approvals/{place.approval}"},
+  {"name": "decline", "method": "POST", "route": "/verb/approvals/{place.approval}/decline"},
```

## Next

- [Connect your agent](https://docs.taji.is/guide/agent.md): what your agent may do without you, and what waits.
- [Trade](https://docs.taji.is/guide/trading.md#decide-what-your-agents-orders-do): where Agent approvals is set.
- [Orders](https://docs.taji.is/architecture/orders.md): how the kernel sends and fills an order.
