AAGT: Advanced Agentic Trading Framework
A high-performance, production-ready Rust framework for building autonomous trading agents with advanced memory, risk management, and multi-provider support.
System Architecture
AAGT is built on a modular "Brain-Body-Nervous System" architecture designed for high reliability and multi-tenant security.
1. The Brain (Agent & Provider System)
- Pluggable Intelligence: Native support for 8 providers via a unified
Providertrait:- Cloud: OpenAI, Anthropic, Gemini, DeepSeek 🇨🇳, Moonshot 🇨🇳, OpenRouter
- Groq ⚡ - Ultra-fast inference (0.5s response) for real-time trading decisions
- Ollama 🔐 - Local execution for complete privacy and zero API costs
- Quota Protection: Built-in fuses (
max_history_messages,max_tool_output_chars) to prevent token bloat and control costs. - Context Management: Advanced sliding window history management to keep reasoning sharp and cost-effective.
2. The Memory (Dual-Layer Persistence)
- Context Layer (Short-Term): RAM + Atomic JSON - Fault-tolerant conversational state:
- Microsecond Access: In-memory
DashMapstorage for zero-latency dialogue. - Crash Safety: Atomic write-and-rename strategy guarantees zero data loss on power failure.
- Auto-Recovery: Instantly restores active sessions upon restart.
- Microsecond Access: In-memory
- Knowledge Layer (Long-Term): aagt-qmd - High-performance hybrid search engine:
- 100x faster search (5ms vs 500ms for 100K documents)
- BM25 + Vector hybrid retrieval (SQLite FTS5 + optional HNSW)
- 25% storage savings via content-addressable deduplication
- Token Efficient: Replaces massive context windows with precise, relevance-based retrieval (~90% token savings).
- Zero cloud dependencies - runs completely locally.
- Isolation Engine: Strict logical and physical data separation between different User IDs and Agent IDs.
- Memory Tools: Agents can actively
search_historyandremember_thisfor autonomous knowledge management.
3. The Guardrails (Risk & Policy)
- Risk Management: Pluggable safety checks (Transaction limits, Volume caps, Honeypot detection).
- Tool Policies: Fine-grained execution control (Auto-run vs. Requires-Human-Approval).
- Safety: Built on Rust's type-safety and ownership model to prevent common concurrency bugs in high-frequency trading.
4. Integration & Automation
- Strategy Pipeline: Decoupled Detection -> Analysis -> Execution workflow.
- Skill System: Expand agent capabilities via simple Rust functions using the
#[tool]macro. - Notification Bus: Real-time alerts via Telegram, Discord, and Webhooks.
Documentation & API
AAGT follows a strictly decoupled design. For detailed information on specific interfaces, methods, and configurations, please refer to our comprehensive API documentation:
Download / View API Reference (API_REFERENCE.md)
Key API Sections inside the Reference:
- Core Agent API: Building and running agents.
- Memory & Persistence: Managing state and long-term knowledge.
- Risk Control: Implementing trading safety checks.
- Multi-Agent Coordination: Orchestrating multiple expert agents.
Getting Started
use *;
use OpenAI;
use Arc;
async
Support the Project
If you find AAGT useful, consider supporting the developers:
Buy Me a Coffee: https://buymeacoffee.com/undeadundead
Crypto Donations:
- Solana:
9QFKQ3jpBSuNPLZQH1uq5GrJm4RDKue82zeVaXwazcmj - Base:
0x4cf0b79aea1c229dfb1df9e2b40ea5dd04f37969
License
MIT / Apache 2.0
Built with Rust | Production-Ready v0.1.3