Q AI is the intelligence layer of the YoorQuezt MEV platform. It provides natural language access to the MEV engine, agentic tool-use for automated operations, forensic analysis, and multi-provider LLM support. Q understands MEV strategies, blockchain state, and engine operations -- enabling operators, searchers, and partners to interact with the platform through conversation.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Clients │
│ Web Dashboard | TUI (yqtui) | CLI (yqctl) | SDKs │
└────────┬──────────────┬───────────────┬───────────────┬──────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ Q AI API (:9100) │
│ /chat | /chat/stream | /chat/confirm | /tools │
├─────────────────────────────────────────────────────────────────┤
│ Agentic Tool-Use Loop │
│ NL Input → Provider → Tool Calls → Execution → Response │
├──────────────┬──────────────────────────────────────────────────┤
│ MCP Server │ Tool Registry (40+) │
│ (16 tools) │ Engine | Bundle | Builder | Validator | Ops │
└──────┬───────┴──────────────┬───────────────────────────────────┘
│ │
▼ ▼
┌──────────────┐ ┌─────────────────┐ ┌──────────────────┐
│ MEV Engine │ │ WebSocket GW │ │ External APIs │
│ (:8080) │ │ (:9099) │ │ (chains, relays)│
└──────────────┘ └─────────────────┘ └──────────────────┘
Agentic Tool-Use Loop
Q AI uses an agentic loop where the LLM decides which tools to call based on the user's natural language query:
- User input -- natural language query arrives via API, TUI, CLI, or SDK.
- Context assembly -- Q gathers conversation history, user role, and available tools.
- LLM reasoning -- the provider (Claude, GPT, etc.) analyzes the query and selects tools.
- Tool execution -- Q executes the selected tools against the MEV engine and blockchain APIs.
- Result synthesis -- the LLM synthesizes tool results into a natural language response.
- Confirmation gate -- mutating actions require explicit user confirmation before execution.
Q AI Agents
| Agent | Role | Capabilities |
|---|---|---|
| Sentinel | Monitoring | Real-time MEV detection, mempool watching, anomaly alerts |
| Bundler | Execution | Bundle construction, simulation, submission, status tracking |
| Solver | Optimization | Intent solving, route optimization, gas estimation |
| Ops | Operations | Health monitoring, relay management, configuration, diagnostics |
RBAC (Role-Based Access Control)
| Role | Description | Tool Access |
|---|---|---|
admin | Full platform access | All tools |
operator | Engine operations | Engine, builder, validator, ops tools |
searcher | Bundle submission and monitoring | Bundle, simulator tools |
analyst | Read-only analytics | Read-only engine, analytics tools |
viewer | Basic read access | Health, status, public metrics |
Tools (40+)
Tools are organized by category:
Engine (5 tools)
engine_health-- Check engine health and uptimeengine_metrics-- Get Prometheus metricsengine_config-- View engine configurationengine_chains-- List connected chainsengine_status-- Comprehensive engine status
Bundle (10 tools)
bundle_submit-- Submit a bundle (mutating, requires confirmation)bundle_status-- Check bundle statusbundle_simulate-- Simulate a bundlebundle_cancel-- Cancel a pending bundle (mutating)bundle_list-- List recent bundlesbundle_profit-- Bundle profit breakdownbundle_history-- Historical bundle databundle_gas-- Gas estimation for bundlebundle_validate-- Validate bundle before submissionbundle_decode-- Decode bundle transactions
Builder (6 tools)
builder_blocks-- List recent blocksbuilder_block-- Get block detailsbuilder_pending-- View pending block templatebuilder_stats-- Builder statisticsbuilder_relays-- Connected relay statusbuilder_bids-- Recent builder bids
Validator (6 tools)
validator_auctions-- List auctionsvalidator_auction-- Auction detailsvalidator_bids-- Bids in an auctionvalidator_settlements-- Settlement historyvalidator_payouts-- Payout historyvalidator_stats-- Validator statistics
Operator (8 tools)
ops_health-- System health overviewops_relays-- Relay managementops_mempool-- Mempool inspectionops_peers-- Connected peersops_config-- Runtime configurationops_logs-- Recent log entriesops_alerts-- Active alertsops_diagnostics-- Run diagnostics
Analyst (7 tools)
analyst_profit-- Profit analyticsanalyst_strategies-- Strategy performanceanalyst_chains-- Per-chain analyticsanalyst_trends-- MEV trend analysisanalyst_competition-- Competitive analysisanalyst_gas-- Gas market analysisanalyst_forensics-- MEV forensic reports
MCP Ops (16 tools)
See Q AI -- MCP Server for the complete MCP tool reference.
MCP Server
Q AI includes a Model Context Protocol (MCP) server with 16 read-only tools for platform observability. See MCP Server.
Interfaces
| Interface | Description | Q AI Access |
|---|---|---|
| Web Dashboard | Browser-based UI | Chat widget, streaming responses |
| TUI (yqtui) | Terminal dashboard | Tab 6 - integrated chat |
| CLI (yqctl) | Command-line tool | Pipe output to Q for analysis |
| TypeScript SDK | @yoorquezt/sdk-mev | QMEVClient.chat() / chatStream() |
| Python SDK | yoorquezt-sdk-mev | QMEVClient.chat() / chat_stream_iter() |
| REST API | HTTP endpoints | /api/v1/chat, /api/v1/chat/stream |
Provider Architecture
Q AI supports multiple LLM providers with automatic fallback:
| Provider | Models | Best For |
|---|---|---|
| Anthropic | Claude Opus, Sonnet | Complex reasoning, tool-use, long context |
| OpenAI | GPT-4o, GPT-4-turbo | General purpose, fast responses |
| Meta | Llama 3 70B, 8B | Self-hosted, cost-effective |
| Mistral | Mistral Large, Medium | European compliance, fast |
| DeepSeek | DeepSeek V3, Coder | Code analysis, math-heavy queries |
Model selection strategy:
- Default: Claude Sonnet for balance of speed and quality.
- Complex queries: Automatic escalation to Claude Opus or GPT-4o for multi-step reasoning.
- High-throughput: Llama 3 8B or Mistral Medium for simple status queries.
- Fallback chain: Primary provider timeout triggers fallback to next provider.
Environment Variables
| Variable | Description | Default |
|---|---|---|
Q_AI_PORT | API listen port | 9100 |
Q_AI_ENGINE_URL | MEV engine URL | http://localhost:8080 |
Q_AI_GATEWAY_URL | Gateway WebSocket URL | ws://localhost:9099 |
ANTHROPIC_API_KEY | Anthropic API key | (required) |
OPENAI_API_KEY | OpenAI API key | (optional fallback) |
Q_AI_DEFAULT_MODEL | Default model | claude-sonnet-4-20250514 |
Q_AI_MAX_TOKENS | Max response tokens | 4096 |
Q_AI_TEMPERATURE | LLM temperature | 0.1 |
Q_AI_LOG_LEVEL | Log level | info |
Partner Integration Tiers
| Tier | Rate Limit | Features |
|---|---|---|
| Free | 100 req/day | Chat, read-only tools, basic analytics |
| Pro | 10,000 req/day | All tools, streaming, forensics, webhooks |
| Enterprise | Unlimited | Custom agents, dedicated instance, SLA, SSO |
See Partner Integration for details.
Example Queries
"What's the engine health?"
"Show me profit from the last 24 hours by chain"
"Simulate this bundle: [0xabc..., 0xdef...]"
"What MEV was extracted from block 19482300?"
"Show me the top 5 strategies by profit this week"
"Is there a sandwich attack pattern on Uniswap V3 WETH/USDC?"
"Submit this bundle to Flashbots relay" (requires confirmation)
"Compare relay performance over the last 7 days"
"What's the current gas market look like?"
"Generate a forensic report for wallet 0x1234..."