In-app AI assistant¶
Private implementation paths
Code paths like resources/js/components/ and src/Ai/ refer to the private ohlcx/trading-app package. Authorized contributors clone the package or run composer install in a host app.
The trading UI includes a drawer-based AI assistant with three modes. It streams responses over SSE from Laravel AI agents.
Related docs
agents.md— full agent/tool matrix, MCP bridge, tests- MCP overview — OHLCX MCP server (Cursor /
php artisan mcp:start ohlcx)
Where it lives in the app¶
- UI:
resources/js/components/AgentAssistantDrawer.jsx— maps mode to API route, renders chat, handles streaming. - Mode toggle:
resources/js/components/RightSidebar.jsx— opens the drawer and switches Support / Trading / AI Assistant (unified). - Backend:
src/Http/Controllers/Api/Agents/AgentController.phpin the trading-app package - Routes:
routes/ai-agents.phpisrequired from packageroutes/api.php(hosts should not duplicate this include)
Modes and endpoints¶
| Label in UI | Internal agentType |
HTTP | Middleware |
|---|---|---|---|
| AI Support Assistant | support |
POST /api/ai/agents/support |
throttle:60,1 |
| AI Trading Assistant | trading |
POST /api/ai/agents/trading |
auth:sanctum, throttle:60,1 |
| AI Assistant | auto |
POST /api/ai/agents/assistant |
throttle:60,1 |
Support uses SupportKnowledgeAgent (knowledge base tools only; no account data).
Trading requires a logged-in session (Sanctum). Uses TradingAssistantAgent with the user’s strategies, accounts, and KB; Pro builds add live market/sector/calendar tools when APP_VERSION=pro (and matching frontend env — see agents.md).
AI Assistant (auto) uses UnifiedAssistantAgent: KB always; if the browser session is authenticated, it can also use strategies, accounts, signals, activities, analysis, news; Pro adds the same market-family tools as trading.
Prerequisites for local use or recording¶
- Dependencies and env — Follow OHLCX Pro setup or OHLCX Light setup (private repos).
- Knowledge base content — e.g.
php artisan trading-app:seedso KB-backed answers are substantive. - AI providers — Keys configured per
config/ai.php/.env(e.g.OPENAI_API_KEY,ANTHROPIC_API_KEY). - Assets —
npm run devornpm run buildso the trading UI loads. - App URL — Serve the app (e.g.
php artisan serveor your usual host); ensureVITE_APP_URLmatches.
Optional realtime stack (Horizon, Reverb) from the main README is not required for the assistant HTTP endpoints themselves, but matches a full trading demo environment.
Laravel AI tools (in-app agents)¶
Agents call a read-focused set of Laravel AI tools in src/Ai/Tools/. There are 17 registered name() strings; which appear depends on agent, auth, and Light vs Pro.
Authoritative table: agents.md — AI tool names (section AI tool names).
Summary groups:
- Knowledge base:
search_knowledge_base_articles,get_knowledge_base_article_by_slug - Trading / account (authenticated): strategies, brokerage accounts, signals, strategy activities, analysis, news
- Pro-only markets: markets, tickers, sectors, calendar, market balance, sector balance
MCP (IDE / Cursor): prompts and tools¶
The in-app drawer is separate from the OHLCX MCP server. If you are automating or testing from Cursor:
- Machine-readable catalog: MCP tools index.json — lists every MCP tool name, admin flags, and MCP prompts.
- MCP prompts:
user-info(authenticated sessions),trading-terminology,support-knowledge-base. - LLM bridge tools:
run-support-agent(no MCP auth required for listing),run-trading-agent(authenticated MCP session only). - Data tools: 80+ additional MCP tools (CRUD, admin, messaging, etc.) — see MCP tool catalog.
For deterministic data without an LLM, prefer direct MCP data tools; use bridge agents when you want the same agents as the app with multi-step tool use.
Video demo script (copy-paste messages)¶
Use this sequence for a balanced demo: product overview, KB, orders/terminology, authenticated trading data, optional Pro markets, unified mode, and a follow-up turn.
Before recording: Log in for Trading and unified-account sections. For the optional Pro step, set APP_VERSION=pro and matching Vite app version per agents.md; otherwise skip step 6 or narrate “Pro feature.”
-
Support mode — Open the assistant; confirm title AI Support Assistant.
Message:In one short paragraph, what is OHLCX and who is it for? -
Knowledge base
Message:How do I search the knowledge base from the app, and what's the difference between support requests and reporting an issue? -
Product depth / orders
Message:Walk me through placing an OCO equity order at a high level, and link any caveats from the docs. -
Trading mode — Switch to AI Trading Assistant (requires login).
Message:Summarize my linked brokerage accounts and my trading strategies. If you can't access something, say what's missing. -
Signals
Message:What signals do I have lately, and how would you suggest I use them alongside my strategies? -
Optional (Pro)
Message:List available markets and give me a one-line description of the first five. -
AI Assistant (unified) — Switch to AI Assistant.
Message:I want a single checklist: onboarding tasks I should complete, then anything specific you can infer about my account from tools. -
Follow-up (conversation memory)
Message:Expand only the highest-priority item from that checklist and point me to the right KB article slug or title if you found one.
Developers¶
- Tests: Testing AI and MCP