The core value of an ambient agent is the loop it runs autonomously: find a candidate, validate it, deploy it, monitor it, learn from it. This guide walks through each step of that loop and explains what the agent does, what you see in the UI, and what the quality gates prevent.

The autonomous strategy loop

Scan markets → Research candidate → Backtest → Quality gate → Deploy paper → Monitor → Alert-triggered exit → Post-exit review

Each step is a distinct tool call the agent makes. You can observe the full trace in the wake log after any session.

Step 1: Scan for opportunities

On each wake, the agent can call scan_market_opportunities to survey the current market. This tool scans the agent's watchlist (or the broader NSE universe if the mission is broad) and identifies instruments showing potential setups based on:

  • Price action relative to key levels (EMAs, VWAP, support/resistance)
  • OI accumulation or unwinding in options
  • Volume anomalies vs average
  • Relative strength against sector / index

The scan returns a ranked list of candidates with the setup type (momentum, mean-reversion, breakout, trend-following) and a confidence score.

Step 2: Research the candidate

For promising candidates, the agent calls research_tick_strategy_candidate. This is a one-shot research tool that:

  1. Pulls the recent price and OI history for the instrument
  2. Runs a quick backtest on a strategy that matches the identified setup type
  3. Computes the quality tier (A/B/C/D) based on Sharpe, profit factor, and out-of-sample metrics
  4. Returns a structured research report: thesis, backtest summary, risk parameters, recommended position size

The agent reads this report and decides whether it meets the mission's quality gate.

Step 3: Quality tiers

Every research result is assigned a quality tier before deployment can proceed:

TierProfit FactorSharpeMeaning
A≥ 2.0≥ 1.5Strong edge. Deploy confidently.
B≥ 1.5≥ 1.0Solid edge. Deploy with standard sizing.
C≥ 1.2≥ 0.7Marginal. Deploy only if mission allows C.
D< 1.2< 0.7No edge. Do not deploy.

The mission contract specifies the minimum acceptable tier. If the research comes back as tier D, the agent records it in the missed-alpha ledger and moves on.

Step 4: Market impact gate

Before deploying, the agent runs a market impact check on the candidate instrument. This catches situations where the strategy looks good on paper but would fail in practice:

  • Spread check: bid-ask spread too wide relative to expected P&L per trade
  • Depth check: order book too thin to fill the required quantity without slippage
  • Noise-to-stop ratio: intraday noise exceeds the stop-loss distance (stop fires immediately on entry noise, not on adverse price action)

If any gate fails, the deployment is rejected with a specific reason. The agent does not try to work around the gate; it stands down and records the rejection.

Step 5: Deploy to paper

A candidate that passes the quality gate and market impact checks is deployed via deploy_tick_strategy_candidate. The deployment:

  • Creates a paper position record in the database
  • Sets entry price, quantity, and direction
  • Arms a stop-loss alert and target alert automatically
  • Records the deployment on the opportunity board

From the Paper tab you'll see the new position appear with live P&L updating on every tick.

Step 6: Monitor the position

After deployment, the agent arms alerts that wake it on key events:

  • Target hit: price reaches the expected profit target and the agent reviews and executes exit
  • Stop-loss hit: price triggers the stop and the agent exits to protect capital
  • Deployment trade fired: any fill on the paper position and the agent confirms and adjusts

The agent also runs periodic monitoring passes via monitor_tick_strategy_deployment to check whether the position's market context has changed materially since entry.

Step 7: Exit and post-exit review

When a position closes, whether by target, stop, or session end, the agent calls generate_post_exit_review. This produces:

  • P&L breakdown (entry price, exit price, quantity, gross P&L, slippage estimate)
  • Whether the thesis held (was the price action consistent with the setup?)
  • What the agent would do differently next time
  • Updated beliefs about the instrument

The review is recorded in the agent's belief table and the missed-alpha ledger (for losses), so the agent improves across sessions.

Session-end close (EOD)

At 15:20 IST, the ambient worker sends a day_end signal. The agent closes all open intraday positions before 15:30 to avoid holding into the close. For daily-bar strategies (e.g. EMA crossover deployed at end-of-day), the position carries over to the next session.

What you see in the UI

After any session you can review the full trace in the Ambient tab:

  • Each wake with its reason and timestamp
  • Tools the agent called and their outputs
  • Decisions made (deploy / stand-down / exit)
  • Current open positions and aggregate P&L
  • Opportunity board with all candidates (watching, deployed, rejected)

The wake log is verbose enough to audit every decision. If the agent made a call you disagree with, you can read exactly why.

Pausing or stopping an agent

You can pause an agent from the Ambient tab at any time. A paused agent stops receiving wakes but keeps its beliefs and deployments intact. Unpausing resumes the wake cycle.

Stopping an agent closes all its paper positions and retires it. Its findings remain available for review.

Next steps