In nearly every unattended trading setup, the first dashboard shows whether the agent process is running. That is useful, but it does not show whether an order was accepted, whether a partial fill changed exposure, or whether the agent has stopped receiving market data. A process can look healthy while its view of the account is wrong.
Monitoring needs to answer three separate questions: is the agent functioning, does its internal state match the broker, and is its behaviour still inside defined risk limits? Different approaches cover different parts of that problem. Combining them is usually more reliable than expecting one dashboard or alert service to detect every failure.
Monitor outcomes, not process uptime
A heartbeat only proves that a component sent a message recently. It does not prove that the component made progress. An agent can heartbeat while stuck retrying an order, processing stale quotes or writing an error that nobody sees. Track progress signals alongside availability: the timestamp of the last market event processed, the last broker response, and the last order-state transition.
Useful monitoring starts with a small set of measurements tied to trading outcomes:
- Market data age: measure the age of the newest usable quote, not merely whether a socket is connected. A threshold might be 2 to 5 seconds for a liquid intraday strategy, adjusted for the venue and bar interval.
- Order acknowledgement time: record time from request submission to broker acknowledgement. Alert on a sustained rise above the normal range, not one slow response.
- State agreement: compare expected open orders, fills and positions with broker-reported state.
- Risk headroom: track exposure, open-order notional and loss limits against explicit caps.
Keep a correlation ID from the strategy decision through the API request, broker acknowledgement and fill event. Without it, an operator may see an alert but be unable to connect it to the decision that created the order. Log timestamps in UTC and preserve both the agent's event time and the time the monitoring service received it.
Compare four monitoring approaches
Logs and metrics are the easiest place to start. Structured logs explain what the agent attempted; metrics expose rates, latency and error counts across time.
They are good for diagnosis and trend detection. They are weaker at detecting a missing event if both the trading process and its telemetry path have failed together.
A heartbeat watchdog runs separately and expects a fresh signal from the agent. It can detect a dead process or stalled loop quickly. Set the timeout above ordinary scheduling and network jitter.
For example, a 10-second heartbeat with a 30-second timeout is less likely to page on one delayed packet than a 1-second heartbeat with a 2-second timeout. A watchdog still cannot verify a fill or account position unless it checks an independent source.
Broker-state reconciliation queries or subscribes to the broker's view of orders, executions and positions, then compares it with the agent's ledger. This finds lost acknowledgements, partial fills and missed cancel responses. It is the strongest option for correctness, but may be limited by API rate limits, delayed reports or incomplete historical data. Reconciliation should use stable order IDs and tolerate events arriving out of order.
An external observer combines health checks with broker queries and can notify an operator or invoke a constrained control. Its separation matters: if it shares the agent's process, credentials, queue and network path, one failure can disable both. This approach adds moving parts and requires careful permissions, but it can notice a failure the agent itself cannot report.
Compare typical latency and cost
The ranges below are typical market ranges for a small deployment, not audited costs for a named provider. Direct monthly cost varies with log volume, retention, cloud region and the number of strategies. It excludes engineering time, market data, broker fees and any charge for a separate risk service.
| Approach | Typical detection latency | Typical direct cost per month | Main blind spot |
|---|---|---|---|
| Logs and metrics | 10 seconds to 5 minutes | $10 to $150 | Telemetry can fail with the agent |
| Heartbeat watchdog | 10 to 60 seconds | $5 to $75 | Running does not mean trading correctly |
| Broker-state reconciliation | 5 seconds to 5 minutes | $20 to $250 | API limits or delayed broker updates |
| Independent observer and escalation | 10 seconds to 2 minutes | $50 to $500 | More components and permission paths |
These categories overlap. A cloud monitoring bill may cover both logs and alert routing, while an observer's cost may mainly be the compute and broker API calls it uses. The useful comparison is not the lowest bill. It is the cost of detecting a specific failure within the time available to contain it.
For example, if a strategy can add exposure every few seconds, a five-minute reconciliation interval is too slow to act as its primary control. If it places one order per day, a one-second paging target may add cost and noise without reducing meaningful risk. Match monitoring cadence to the rate at which exposure can grow.
Make state checks independent
Reconciliation should compare records, not just totals. Matching net position alone can hide an unintended open order offset by an existing position.
Compare each working order by client and broker ID, side, quantity remaining, limit price and status. Compare executions by execution ID, then recompute position and average price from fills. Treat a missing or duplicated event as a discrepancy to investigate, not as permission to submit another order.
Use both event-driven updates and periodic snapshots where the broker supports them. A streaming connection reduces detection delay, while a snapshot can repair gaps after reconnects. Track sequence numbers or event cursors if available. On a sequence gap, mark local state uncertain, request a fresh snapshot and prevent new risk-increasing orders until the comparison is resolved.
Keep the observer's access narrow. Read-only credentials are enough for most checks.
If the observer can cancel orders, isolate that capability from the agent's order-placement credentials and log every intervention. A separate service is not independent if it relies on the same in-memory ledger or silently trusts the agent's calculation.
Paper trading helps test event handling and alert thresholds before live deployment, but it cannot reproduce every broker outage, exchange queue or production permission error. A controlled agentic paper trading environment is available from Agentic Trading Index, with plans from $9.99 a month. Treat it as a place to exercise monitoring logic, then validate broker-specific state behaviour in the intended environment.
Set alerts around decisions
An alert should state what happened, what account or strategy is affected, when it began, and what action is permitted. "API error" is not enough. A useful notification might say that a cancel request has had no acknowledgement for 20 seconds, name the order ID, show the last known status and link to the relevant event trail.
Separate informational signals from conditions that require intervention. Common severity levels are:
- Notice: a transient data delay or elevated latency that resolved without a position discrepancy.
- Warning: repeated rejects, a stale quote beyond the strategy's limit, or a mismatch that remains unresolved after one fresh snapshot.
- Critical: an unknown working order, exposure beyond a hard cap, missing broker connectivity while orders remain live, or a loss limit breach.
Choose the response before wiring up the alert. Pausing new entries is often safer than killing the process, because a process exit may leave working orders untouched. Cancelling orders may also fail during a broker outage, so specify what the system should verify afterwards. A kill switch needs defined semantics: block new orders, cancel eligible working orders, reconcile resulting fills, and report any residual position. Do not treat a notification as a control unless something is assigned to act on it.
Reduce alert fatigue with persistence windows, deduplication and recovery messages. Page on a threshold breach that persists for a chosen interval, except for hard risk limits where immediate action is required. Record every suppressed or grouped event so that quiet dashboards do not conceal repeated faults.
Use a checklist before leaving it unattended
Run these checks in paper or a low-risk environment before relying on unattended monitoring. Include broker-specific behaviours, especially around partial fills, reconnects and cancel requests.
- Define expected data, order and position state, including what counts as stale or unknown.
- Test a dead process, a live but stalled loop, a dropped data stream and a broker disconnect separately.
- Simulate an acknowledgement that arrives late, a partial fill, a duplicate event and a missed cancel response.
- Verify reconciliation after a connection gap, including the handling of unknown orders and sequence gaps.
- Check that alert payloads include account, strategy, instrument, order ID, timestamps and the last known state.
- Exercise each intervention and confirm its result from broker-side state, not from the agent's own log.
- Review API rate limits, alert delivery failures, escalation ownership and the procedure for restoring normal operation.
Keep a record of test results and the thresholds in force. Review them when order frequency, instruments, broker behaviour or deployment topology changes. The question worth asking in the next team meeting is: which broker-side state proves the agent is safe to leave unattended, and what independent action follows when that proof is missing?
Frequently Asked Questions
How do you monitor an unattended trading agent?
Track process progress, market data age, broker acknowledgements, order and position state, and risk limits. Use an independent reconciliation service where possible, then define what the system does when it finds stale or inconsistent state.
How often should a trading bot reconcile positions?
Set the interval according to how quickly the strategy can increase exposure and the broker API's rate limits. A fast intraday strategy may need event-driven updates plus snapshots every few seconds or minutes, while a slower strategy may tolerate longer intervals.
What should an alert do when a broker API disconnects?
It should identify affected accounts and live orders, block new risk-increasing orders if required, and report the last confirmed broker state. After reconnection, reconcile orders, fills and positions before resuming normal trading.