How takumashin/pa-agent works
PA Agent is a price-action analysis application with Web and desktop interfaces. The main workflow is to select a market and timeframe, obtain candle data, submit an analysis, and view the resulting diagnosis, decision, and chart annotations. Its documented capabilities also include chat commands for quick analysis and bar-by-bar tracking, editable decision trees, and extensible skills. The graph emphasizes the Web entry point and shared analysis components; some subsystem links rely on README descriptions or SOURCE INDEX references rather than inspected implementation excerpts.
Main entry points: two_stage.py Two-stage analysis · app.py FastAPI app · agent_chat.py Agent chat API · app_context.py App context
Components 29
Web application
- FastAPI app
pa_agent/web/app.py - Agent chat API
pa_agent/web/routes/agent_chat.py - Analysis API
pa_agent/web/routes/analysis.py - Chart API
pa_agent/web/routes/chart.py - Decision tree API
pa_agent/web/routes/decision_tree.py - Conversation sessions
pa_agent/web/session_manager.py
Analysis and AI
- App context
pa_agent/app_context.py - Two-stage analysis
pa_agent/orchestrator/two_stage.py - Prompt assembly
pa_agent/ai/prompt_assembler.py - AI client
pa_agent/ai/deepseek_client.py - JSON validation
pa_agent/ai/json_validator.py - Decision tree engine
pa_agent/ai/decision_tree.py - Strategy routing
pa_agent/ai/router.py - Extensible skills
pa_agent/skills/registry.py - Charting AI tools
pa_agent/web/agent_tools.py - Free chat
pa_agent/orchestrator/free_chat.py
Market data
- Market data sources
pa_agent/data/base.py - Candle buffer
pa_agent/data/kline_buffer.py - Candle frames
pa_agent/data/base.py - Live chart
pa_agent/gui/chart_widget.py
Trading domain
- Analysis records
pa_agent/records/pending_writer.py - Experience library
pa_agent/records/experience_reader.py - Settings and secrets
pa_agent/config/settings.py - Decision tree projects
pa_agent/dtree/project.py
Desktop interface
- Desktop workbench
pa_agent/gui/main_window.py
Other components
- Trader
- Web client
- DeepSeek-compatible API
- Market data provider
Connections 34
- Trader → Web client: uses
- Web client → FastAPI app: requests
pa_agent/web/app.py - FastAPI app → App context: bootstraps
pa_agent/web/app.py - FastAPI app → Agent chat API: registers
pa_agent/web/app.py - FastAPI app → Analysis API: registers
pa_agent/web/app.py - FastAPI app → Chart API: registers
pa_agent/web/app.py - FastAPI app → Decision tree API: registers
pa_agent/web/app.py - Agent chat API → Charting AI tools: uses tools
pa_agent/web/routes/agent_chat.py - Agent chat API → Extensible skills: loads skills
pa_agent/web/routes/agent_chat.py - Agent chat API → Conversation sessions: persists chats
- Analysis API → Two-stage analysis: starts analysis
- App context → Market data sources: connects source
pa_agent/app_context.py - App context → Candle buffer: creates buffer
pa_agent/app_context.py - App context → AI client: configures client
pa_agent/app_context.py - Market data sources → Market data provider: fetches candles
- Candle buffer → Candle frames: holds bars
pa_agent/data/kline_buffer.py - Two-stage analysis → Prompt assembly: assembles prompts
pa_agent/orchestrator/two_stage.py - Two-stage analysis → AI client: requests analysis
pa_agent/orchestrator/two_stage.py - AI client → DeepSeek-compatible API: sends prompts
pa_agent/ai/deepseek_client.py - Two-stage analysis → JSON validation: validates output
pa_agent/orchestrator/two_stage.py - Two-stage analysis → Strategy routing: routes strategies
pa_agent/orchestrator/two_stage.py - Two-stage analysis → Decision tree engine: uses decision tree
pa_agent/orchestrator/two_stage.py - Two-stage analysis → Experience library: loads experience
pa_agent/orchestrator/two_stage.py - Two-stage analysis → Analysis records: writes results
pa_agent/orchestrator/two_stage.py - Prompt assembly → Candle frames: formats candles
pa_agent/ai/prompt_assembler.py - Charting AI tools → Live chart: draws annotations
- Decision tree API → Decision tree projects: edits projects
- FastAPI app → Settings and secrets: loads configuration
- Trader → Desktop workbench: uses
- Desktop workbench → Two-stage analysis: runs analysis
pa_agent/gui/main_window.py - Desktop workbench → Live chart: shows chart
pa_agent/gui/main_window.py - Trader → Free chat: requests chat
- Free chat → AI client: requests response
pa_agent/orchestrator/free_chat.py - Free chat → Prompt assembly: builds context
pa_agent/orchestrator/free_chat.py