Empowering AI Agents on Solana
The crypto world is buzzing about Truth Terminal (GOAT) and other projects at the intersection of crypto and AI. While AI memecoins are getting attention, there is a bigger opportunity here - using AI to build safer, more sophisticated trading systems that work directly onchain.
Last weekend, we put this idea to the test at the "Hacking for Agentic Finance" hackathon. We built a simple command line interface (CLI) that lets an AI agent interact with the GLAM protocol. More specifically: Getting the agent to independently manage an index fund and swap between SOL and USDC.
What makes this interesting is our approach to security - we give an agent a clearly defined playground with strict boundaries. Fund managers can set exactly what their AI traders can and cannot do, keeping the assets safe while still letting the AI do its job.
Defining the Playing Field
First, we built a secure foundation using GLAM's fine-grained access control system. Think of it like a junior trader, that is only allowed to trade a specific market and is restricted to a maximum order size. This is crucial because it means even if something goes wrong, the agents cannot accidentally (or intentionally) do anything beyond their defined scope.
For this demo, we created two AI agents working in tandem, each with specific permissions:
- A manager agent trained to use the GLAM CLI and in charge of the fund strategy
- A trader agent executing commands and reporting results back to the manager
In this case the strategy is a simple index maintaining equal values of SOL and USDC. When the balance shifts, our agents automatically rebalance the portfolio - a straightforward but powerful demonstration of autonomous, secure, onchain portfolio management.
Letting the Agents Execute
Let us walk through what happened in our demo:
- We set up a fund and gave our AI agent permission to swap assets using Jupiter Protocol
- An investor added 0.2 SOL to the fund
- The manager agent analyzed the portfolio and noticed it was 100% weighted toward SOL
- It calculated the optimal trade to achieve the 50-50 split and instructed the code executor to swap 0.1 wSOL for USDC
- The transaction executed successfully, resulting in a balanced portfolio
The entire process happened automatically, with the AI agents communicating and executing trades while staying within their predetermined boundaries. You can verify this yourself - the fund and its transactions are fully visible onchain.
Unlocking New Possibilities
This simple demo is just the beginning. The same infrastructure can empower AI agents to:
- Monitor market indicators to time directional trades
- Manage complex portfolios across multiple cryptoassets
- Adapt strategies based on market conditions and risk metrics
- Execute trades across different protocols while optimizing for best execution
All while staying within boundaries enforced by fine-grained permissions and access controls.
The ecosystem is rapidly evolving. Coinbase's Dev SDK and Based Agent are building developer infrastructure, while Griffain - launched a few days ago on Solana - focuses on turning intent into onchain actions. At Variant's recent demo night, nine teams showcased their work at the intersection of crypto and AI.
It is early days, but things point to an intriguing future where AI agents can trade independently onchain while staying within carefully set guardrails. This combination of autonomous trading and robust security controls brings us closer to institutional-grade onchain asset management - where sophisticated strategies can be executed safely and transparently.
P.S. If you're interested in the technical details, check out our deep dive.