An implementation of the NVIDIA Voyager paper adapted for Solana blockchain exploration, where AI agents learn to autonomously discover and interact with DeFi protocols through self-generated TypeScript skills.
This project adapts the groundbreaking Voyager paper from Minecraft to the Solana blockchain. Instead of exploring a 3D world, our agents explore the DeFi ecosystem, discovering new protocols and building a library of reusable skills.
- Self-Learning: Agents generate their own TypeScript code to interact with Solana
- Skill Library: Accumulated knowledge persists across episodes
- Protocol Discovery: Rewards for finding new program instructions
- Safe Environment: Runs against local Solana test validator (surfpool)
- Progress Tracking: Comprehensive CSV logging and agent message tracking
┌─────────────────────────────────────────┐
│ Voyager Agent System │
├─────────────────────────────────────────┤
│ • Curriculum Agent: Proposes tasks │
│ • Action Agent: Generates TypeScript │
│ • Critic Agent: Evaluates success │
│ • Skill Manager: Stores & retrieves │
└────────────────┬───────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ TypeScript Skill Runner (Bun) │
├─────────────────────────────────────────┤
│ • Executes generated TypeScript code │
│ • Returns serialized transactions │
│ • Enforces single transaction limit │
└────────────────┬───────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Surfpool (Local Solana Validator) │
├─────────────────────────────────────────┤
│ • Pre-funded test accounts │
│ • Mainnet fork with real programs │
│ • Safe sandbox for experimentation │
└─────────────────────────────────────────┘
- Python 3.8+ with uv
- Bun v1.1.42+
- Surfpool (Solana test environment)
- OpenRouter API key for LLM access
# Clone the repository
git clone <repo-url>
cd voyager
# Install Python dependencies
uv sync
# Install TypeScript dependencies
cd voyager/skill_runner && bun install
cd ../..
# Set up environment variables
cp .env.example .env
# Edit .env and add your OPENROUTER_API_KEY & OPENAI_API_KEY
# Run the main Voyager learning loop
uv run python voyager/voyager_clone.py
# View progress (in another terminal)
python view_progress.py
The Curriculum Agent observes the current state and proposes tasks that will discover new program instructions:
- Starts with simple SOL transfers
- Progresses to token operations
- Explores DeFi protocols systematically
The Action Agent uses an LLM to generate TypeScript code that:
- Builds Solana transactions
- Returns base64-encoded serialized transactions
- Handles only ONE transaction per skill (enforced)
Generated code runs in an isolated Bun environment:
// Example generated skill
async function buildTransaction() {
const connection = new web3.Connection("http://127.0.0.1:8899");
const wallet = new web3.PublicKey(AGENT_WALLET_ADDRESS);
// Generate a random recipient
const recipient = web3.Keypair.generate().publicKey;
// Build transfer instruction
const transaction = new web3.Transaction();
transaction.add(
web3.SystemProgram.transfer({
fromPubkey: wallet,
toPubkey: recipient,
lamports: 0.1 * web3.LAMPORTS_PER_SOL,
})
);
// Set blockhash and serialize
const { blockhash } = await connection.getLatestBlockhash();
transaction.recentBlockhash = blockhash;
transaction.feePayer = wallet;
return Buffer.from(
transaction.serialize({
requireAllSignatures: false,
})
).toString("base64");
}
- Critic Agent evaluates task success
- Successful skills are added to the library
- Rewards given for discovering new (program_id, instruction) pairs
The system tracks comprehensive metrics in CSV format:
# View latest run progress
python view_progress.py
# Output includes:
# - Success rate per task
# - Total rewards earned
# - Unique instructions discovered
# - Programs explored
# - Agent conversation logs
iteration
: Sequential task numbertask
: Task descriptiontask_success
: Boolean success indicatorreward
: Points for new instruction discoverydiscovered_programs
: Unique program countunique_instructions
: Total instruction types foundsol_balance
: Current wallet balanceerror
: Error messages if failedcritique
: Feedback from critic agent
Aspect | Minecraft Voyager | Solana Voyager |
---|---|---|
Environment | 3D voxel world | Blockchain programs |
Actions | Movement, crafting, combat | Transaction building |
Skills | JavaScript game commands | TypeScript web3.js code |
Rewards | Items, achievements | Program instruction discovery |
Safety | Game sandbox | Local test validator |
voyager_clone.py
: Main agent orchestrationsurfpool_env.py
: Low-level Solana environmentagents/
: Curriculum, Action, and Critic agentsskill_manager/
: TypeScript skill storage and retrievalskill_runner/
: Bun runtime for executing skillsprompts/
: LLM prompt templatesprogress_tracker.py
: CSV logging system
- Single Transaction Per Skill: Each skill can only execute ONE transaction
- No Airdrops: Environment uses pre-funded accounts on local validator
- Serialized Output: Skills must return base64-encoded transactions
- No CLI Access: All operations must use web3.js programmatically
- Improve Prompts: Help curriculum agent suggest better tasks
- Add Program Mappings: Update
data/program_ids.csv
- Enhance Rewards: Design rewards for specific DeFi operations
- Fix Bugs: Check issues and submit PRs
MIT License - see LICENSE for details.
Ready to watch AI explore Solana? Run the voyager agent and observe as it discovers how to use Solana!