# git8193/agentic architecture

> Architecture diagram of the GitHub repository git8193/agentic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/git8193/agentic
- Repository: https://github.com/git8193/agentic

## Overview

Upstox Agents is an offline, event-driven trading platform configured through a Python web console. Users choose an instrument, timeframe, indicator, strategy, and order agent; the engine builds the pipeline, market data feeds candles and indicators, strategies produce trading actions, and risk checks precede paper or live execution. The graph also preserves authentication, exports, replay, and supporting trading state. Some system-agent and broker wiring is documented but unsampled, so those relationships are omitted unless the README or an excerpt supports them.

Main entry points: [`app/engine.py`](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/app/engine.py) (Engine), [`ui/console.py`](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/ui/console.py) (Web console), [`system_agents/candles.py`](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/candles.py) (Candle builder), [`agents/strategies`](https://github.com/git8193/agentic/tree/claude/gracious-bell-n6bro8/agents/strategies) (Strategy agents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Console and setup"]
  node_console_ui["Web console<br/>[console.py]"]
  node_pipeline_builder["Pipeline builder<br/>[builder.py]"]
end

subgraph group_market["Market data"]
  node_instruments["Instrument master<br/>[instruments.py]"]
  node_market_feed["WebSocket feed<br/>[ws_feed.py]"]
  node_candles["Candle builder<br/>[candles.py]"]
end

subgraph group_pipeline["Trading pipeline"]
  node_pipeline_spec["Pipeline configuration<br/>[pipeline.py]"]
  node_engine["Engine<br/>[engine.py]"]
  node_indicator["Indicator agents"]
  node_strategy["Strategy agents"]
  node_position["Position state<br/>[position.py]"]
  node_event_bus["Event bus<br/>[bus.py]"]
end

subgraph group_execution["Execution and broker"]
  node_auth["Upstox authentication<br/>[auth.py]"]
  node_risk["Risk agent<br/>[risk.py]"]
  node_order_agent["Order agents"]
  node_rest["Upstox REST client<br/>[rest.py]"]
  node_paper_broker["Paper broker<br/>[paper.py]"]
end

subgraph group_support["Operations and records"]
  node_store[("Runtime store<br/>[store.py]")]
  node_analytics["Paper-trade analytics<br/>[analytics.py]"]
  node_replay["Market replay<br/>[replay.py]"]
  node_export["Exports<br/>[export.py]"]
  node_persistence["Persistence agent<br/>[persistence.py]"]
end

node_user(("Trader"))
node_upstox{{"Upstox"}}
node_browser(("Browser"))

node_user -->|"configures"| node_console_ui
node_console_ui -->|"opens builder"| node_pipeline_builder
node_console_ui -->|"adds pipeline"| node_engine
node_pipeline_builder -->|"creates config"| node_pipeline_spec
node_engine -->|"builds from"| node_pipeline_spec
node_engine -->|"uses"| node_instruments
node_engine -->|"uses"| node_auth
node_engine -->|"uses"| node_market_feed
node_market_feed -->|"streams market data"| node_upstox
node_market_feed -->|"provides ticks"| node_candles
node_candles -->|"loads and backfills"| node_rest
node_engine -->|"ensures candles"| node_candles
node_candles -->|"emits candle events"| node_indicator
node_engine -->|"constructs"| node_indicator
node_indicator -->|"publishes results"| node_strategy
node_engine -.->|"constructs"| node_strategy
node_strategy -->|"updates state"| node_position
node_strategy -->|"routes orders"| node_risk
node_risk -->|"checks then routes"| node_order_agent
node_order_agent -->|"places paper orders"| node_paper_broker
node_order_agent -.->|"places live orders"| node_rest
node_rest -->|"requests broker API"| node_upstox
node_auth -->|"exchanges login code"| node_upstox
node_console_ui -->|"serves downloads"| node_browser
node_engine -->|"uses analytics"| node_analytics
node_engine -.->|"supports replay"| node_replay
node_engine -.->|"supports exports"| node_export
node_engine -.->|"uses persistence"| node_persistence
node_candles -->|"stores candle data"| node_store
node_strategy -->|"records trades"| node_store
node_console_ui -->|"offers exports"| node_export

click node_console_ui "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/ui/console.py"
click node_pipeline_builder "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/ui/builder.py"
click node_pipeline_spec "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/pipeline.py"
click node_engine "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/app/engine.py"
click node_instruments "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/instruments.py"
click node_auth "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/auth.py"
click node_market_feed "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/ws_feed.py"
click node_candles "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/candles.py"
click node_indicator "https://github.com/git8193/agentic/tree/claude/gracious-bell-n6bro8/agents/indicators"
click node_strategy "https://github.com/git8193/agentic/tree/claude/gracious-bell-n6bro8/agents/strategies"
click node_position "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/position.py"
click node_risk "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/risk.py"
click node_order_agent "https://github.com/git8193/agentic/tree/claude/gracious-bell-n6bro8/agents/orders"
click node_rest "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/rest.py"
click node_paper_broker "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/paper.py"
click node_event_bus "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/bus.py"
click node_store "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/store.py"
click node_analytics "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/analytics.py"
click node_replay "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/replay.py"
click node_export "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/export.py"
click node_persistence "https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/persistence.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console_ui,node_pipeline_builder,node_browser toneBlue
class node_instruments,node_market_feed,node_candles toneAmber
class node_pipeline_spec,node_engine,node_indicator,node_strategy,node_position,node_event_bus toneMint
class node_auth,node_risk,node_order_agent,node_rest,node_paper_broker toneRose
class node_store,node_analytics,node_replay,node_export,node_persistence,node_user,node_upstox toneIndigo
```

## Components

### Console and setup

- [Web console](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/ui/console.py): `ui/console.py`
- [Pipeline builder](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/ui/builder.py): `ui/builder.py`

### Market data

- [Instrument master](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/instruments.py): `broker/instruments.py`
- [WebSocket feed](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/ws_feed.py): `broker/ws_feed.py`
- [Candle builder](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/candles.py): `system_agents/candles.py`

### Trading pipeline

- [Pipeline configuration](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/pipeline.py): `core/pipeline.py`
- [Engine](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/app/engine.py): `app/engine.py`
- [Indicator agents](https://github.com/git8193/agentic/tree/claude/gracious-bell-n6bro8/agents/indicators): `agents/indicators`
- [Strategy agents](https://github.com/git8193/agentic/tree/claude/gracious-bell-n6bro8/agents/strategies): `agents/strategies`
- [Position state](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/position.py): `core/position.py`
- [Event bus](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/bus.py): `core/bus.py`

### Execution and broker

- [Upstox authentication](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/auth.py): `broker/auth.py`
- [Risk agent](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/risk.py): `system_agents/risk.py`
- [Order agents](https://github.com/git8193/agentic/tree/claude/gracious-bell-n6bro8/agents/orders): `agents/orders`
- [Upstox REST client](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/rest.py): `broker/rest.py`
- [Paper broker](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/broker/paper.py): `broker/paper.py`

### Operations and records

- [Runtime store](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/core/store.py): `core/store.py`
- [Paper-trade analytics](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/analytics.py): `system_agents/analytics.py`
- [Market replay](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/replay.py): `system_agents/replay.py`
- [Exports](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/export.py): `system_agents/export.py`
- [Persistence agent](https://github.com/git8193/agentic/blob/claude/gracious-bell-n6bro8/system_agents/persistence.py): `system_agents/persistence.py`

### Other components

- **Trader**
- **Upstox**
- **Browser**

## Connections

- Trader → Web console: configures (evidence: `README.md`)
- Web console → Pipeline builder: opens builder (evidence: `ui/console.py`)
- Web console → Engine: adds pipeline (evidence: `ui/console.py`)
- Pipeline builder → Pipeline configuration: creates config (evidence: `ui/builder.py`)
- Engine → Pipeline configuration: builds from (evidence: `app/engine.py`)
- Engine → Instrument master: uses (evidence: `app/engine.py`)
- Engine → Upstox authentication: uses (evidence: `app/engine.py`)
- Engine → WebSocket feed: uses (evidence: `app/engine.py`)
- WebSocket feed → Upstox: streams market data (evidence: `README.md`)
- WebSocket feed → Candle builder: provides ticks (evidence: `README.md`)
- Candle builder → Upstox REST client: loads and backfills (evidence: `system_agents/candles.py`)
- Engine → Candle builder: ensures candles (evidence: `app/engine.py`)
- Candle builder → Indicator agents: emits candle events (evidence: `README.md`)
- Engine → Indicator agents: constructs (evidence: `app/engine.py`)
- Indicator agents → Strategy agents: publishes results (evidence: `README.md`)
- Engine → Strategy agents: constructs
- Strategy agents → Position state: updates state (evidence: `agents/strategies/ichimoku_s1_cloud_option/agent.py`)
- Strategy agents → Risk agent: routes orders (evidence: `README.md`)
- Risk agent → Order agents: checks then routes (evidence: `README.md`)
- Order agents → Paper broker: places paper orders (evidence: `agents/orders/paper/agent.py`)
- Order agents → Upstox REST client: places live orders
- Upstox REST client → Upstox: requests broker API (evidence: `README.md`)
- Upstox authentication → Upstox: exchanges login code (evidence: `broker/auth.py`)
- Web console → Browser: serves downloads (evidence: `README.md`)
- Engine → Paper-trade analytics: uses analytics (evidence: `app/engine.py`)
- Engine → Market replay: supports replay (evidence: `app/engine.py`)
- Engine → Exports: supports exports (evidence: `app/engine.py`)
- Engine → Persistence agent: uses persistence (evidence: `app/engine.py`)
- Candle builder → Runtime store: stores candle data (evidence: `system_agents/candles.py`)
- Strategy agents → Runtime store: records trades
- Web console → Exports: offers exports (evidence: `README.md`)
