I created ai_trader, an autonomous trading system that demonstrates practical agentic AI in action. The system analyzes market news, generates trading signals with confidence scores, and executes paper trades through Alpaca’s API.
Key Architecture Components
The system comprises five main parts: a CLI interface (Typer + Rich), abstract strategy base classes, SQLite logging, Alpaca paper trading integration, and Claude as the signal generator. This modular design allows easy strategy expansion without modifying core execution logic.

Claude’s Role
Rather than simply answering questions, Claude analyzes recent market news and returns structured JSON containing:
- Trading signal (BUY/SELL/HOLD)
- Confidence score (0.0-1.0)
- Analytical reasoning
The prompt engineering uses low temperature (0.3) for consistency and includes explicit instructions encouraging decisiveness, as the model initially defaulted to HOLD recommendations too frequently.
Safety Guardrails
Before execution, the system enforces:
- 70% confidence threshold minimum
- 10% maximum position size limits
- HOLD signal filtering
- Paper trading as the default mode
Every signal and trade gets logged to SQLite for analysis—critical for understanding Claude’s behavior patterns over time.
Practical Lessons
After generating 500+ signals, key takeaways include the value of paper trading for iteration, the need to calibrate confidence score distributions, and how comprehensive logging reveals strategic patterns and cost implications (~$15 annually for API calls).