Agentic Trading Index

Monitoring an unattended trading agent without constant oversight

Trading workstation showing charts and order status for monitoring an unattended trading agent
Photo by AlphaTradeZone on Pexels

The agent can keep running after its assumptions stop being true. A feed may go stale, an order may remain partly filled, or a broker may reject requests while the strategy continues to calculate signals.

Monitoring has to detect those conditions and change what the system is allowed to do. A dashboard that only shows profit and loss will not do that.

For an operator, the useful question is not whether the process is alive. It is whether the agent has fresh inputs, a coherent view of its orders and positions, and enough control to stop placing new risk. Treat monitoring as part of the trading system, not as a separate reporting layer.

Monitor the trading state, not just the process

A heartbeat tells you that a process has reported in. It does not prove that market data is current or that orders are reaching the broker.

Record timestamps and identifiers at each boundary: feed receipt, signal creation, risk check, order submission, broker acknowledgement, fill update and position reconciliation. These events let an operator locate where progress stopped.

Keep a durable event log with a correlation ID for each decision and order. Include the instrument, strategy version, market-data timestamp, intended quantity, limit price, risk decision, broker response and subsequent fills. Avoid logging credentials or full account tokens. A structured record is more useful than a line of text saying that an order failed.

Measure at least four separate states:

  • Data: last update time, sequence gaps, spread and whether the instrument is in a valid trading session.
  • Orders: submitted, acknowledged, rejected, partially filled, cancelled and unknown status, including the age of each open order.
  • Account: positions, cash or buying power, realised and unrealised P&L, and exposure by instrument and strategy.
  • Agent: current mode, last completed decision, error rate, queue depth and the version of code and configuration in use.

Broker events can arrive late or out of order. The agent should not assume that a timeout means an order was rejected. It may have reached the venue even if the acknowledgement was lost.

Query broker state using the client order ID or broker order ID before retrying. Otherwise, a retry can create a duplicate position.

Set thresholds around failure modes

Thresholds depend on venue, instrument and API behaviour. The figures below are typical ranges for operational starting points, not universal limits. Measure normal behaviour in the intended environment, then set thresholds against its distribution. A liquid listed product with streaming quotes needs different freshness limits from a slower market or a polling-only API.

SignalTypical rangeOperator response
Market-data age1-5 seconds for active instrumentsBlock new orders if the feed exceeds the strategy's allowed age.
Order acknowledgement100 milliseconds-2 secondsMark the request as unknown, then query broker state before retrying.
Heartbeat interval5-30 secondsAlert after two or three missed heartbeats; use a separate watchdog.
Position reconciliation15-60 seconds, or after fillsCompare local positions with broker positions and pause on material mismatch.
Open-order ageStrategy-specific, often 30 seconds-5 minutesReview, cancel or reprice only under an explicit policy.

Do not alert on every small deviation. Separate a warning, which asks for investigation, from a trigger that changes system behaviour.

For example, one delayed quote may justify a warning; a feed beyond the configured maximum age should block new entries. A position mismatch should normally stop additional risk until the account is reconciled.

Set risk limits independently of the strategy's own signal logic. Typical controls include maximum order size, maximum gross exposure, per-instrument limits, a daily loss threshold and a cap on order rejections. Loss thresholds should account for open positions and mark-to-market changes, not just closed trades. Keep the limits outside agent-generated configuration and require a controlled deployment to change them.

Build an alert path that can stop trading safely

An alert is useful only if it reaches an operator with enough context to act. Route urgent events through a channel with acknowledgement and escalation.

Include the account, strategy, affected instrument, last successful event, current position and the control already taken. Avoid sending secrets or sensitive account data to general chat channels.

Use severity levels with explicit actions. A stale feed can disable new entries while allowing protective exits. A broker connection loss may require cancelling nothing automatically, because the system cannot confirm cancellation. A breached loss limit can block new orders and notify the operator. The safe action differs by failure mode; a universal restart button is not a risk policy.

Use these steps to make the monitoring path testable:

  1. Define the allowed state transitions. Specify what the agent may do after a stale feed, rejected order, disconnection, position mismatch or breached limit.
  2. Give each order a stable client ID. Persist it before submission so recovery can look up the original request rather than issue a duplicate.
  3. Reconcile after uncertainty. On restart or timeout, fetch open orders, fills, balances and positions from the broker before resuming order generation.
  4. Separate stop controls. Provide a kill switch that blocks new orders, and a distinct procedure for cancelling working orders or flattening positions. Test both.
  5. Exercise failures on a schedule. Simulate missing data, delayed acknowledgements, rejected orders, partial fills and process restarts. Check that alerts arrive and the configured control takes effect.

Recovery should be conservative. Restarting a process can restore service, but it does not restore a correct view of the account. Keep the system in a restricted mode until broker state is reconciled and the cause of the failure is understood. Paper trading can exercise alert routing and recovery logic without placing live orders. A paper-trading environment can be part of that test loop, provided its order and fill behaviour is treated as a simulation rather than proof of live execution.

Make monitoring operable during an incident

Operators need a compact status view, not a wall of charts. Show whether new orders are enabled, the last fresh market-data timestamp, broker connection state, open orders, current positions, exposure and the most recent risk decision. Make the state visible in one place, while preserving detailed event history for investigation.

Track both technical and trading measures over time:

  • Data age and sequence gaps by feed and instrument;
  • Submission-to-acknowledgement latency and rejection rate;
  • Time spent with orders in an unknown or partially filled state;
  • Difference between agent-recorded and broker-reported positions;
  • Alert delivery time, acknowledgement time and false-alert rate.

Review alert noise after each operating period. If an alert fires repeatedly without changing decisions, adjust its threshold or remove it.

Do not mute a control merely because it is inconvenient. Record who changed a threshold, when it changed and what evidence supported the change.

Before expanding unattended hours or order size, run the same monitoring and recovery procedures under realistic load. A paper environment such as agentic paper trading can help test the operator workflow, while venue-specific limits and live broker behaviour still need separate validation. The essential test is simple: can the system detect that its view is wrong, stop adding risk, and leave enough evidence for a person to diagnose the cause?

In automated trading, observability often arrives after the strategy.

Frequently Asked Questions

What should I monitor in an unattended trading agent?

Monitor market-data freshness, order state, broker connectivity, positions, exposure, risk limits and agent health. Store timestamps and identifiers so each decision can be traced through submission, acknowledgement and fills.

How often should a trading agent reconcile positions?

A common starting range is every 15 to 60 seconds, with an additional reconciliation after fills, reconnects or uncertain order outcomes. Tune the interval to the broker API, strategy speed and cost of acting on a mismatch.

What should happen if a broker API request times out?

Treat the order state as unknown, not rejected. Query the broker using the stable client order ID before retrying, because the original request may have reached the broker without returning an acknowledgement.

Should an automated trading agent restart after a failure?

A restart should not automatically resume trading. First restore broker state, reconcile positions and open orders, check data freshness, then allow the agent to resume only if its configured safety conditions are met.