AI Agent
Generate smart contracts from natural language descriptions and get AI-powered code suggestions.
Overview
AVM Studio's AI Agent helps you write smart contracts faster by understanding your intent and generating code accordingly. Whether you're starting from scratch or improving existing code, the AI can help.
Contract Generation
Describe what you want and get working code
Code Improvements
Get suggestions to optimize and fix issues
Interactive Chat
Ask questions and iterate on your code
Documentation Access
AI knows Algorand and PuyaTS documentation
Using the AI Agent
Access the AI Agent from the right sidebar in the editor. You can:
Generate New Contracts
Describe what you want to build:
1"Create a simple voting contract where users can vote for options
2and the creator can end the voting to determine the winner."
Modify Existing Code
Ask for specific changes:
1"Add a pause functionality that only the owner can use to
2temporarily disable all contract operations."
Ask Questions
Get help understanding code or concepts:
1"What's the difference between GlobalState and LocalState?
2When should I use each one?"
Edit Proposals
When the AI suggests code changes, they appear as "edit proposals" that you can review before applying.
Reviewing Proposals
- Diff view - See exactly what will change
- Accept - Apply the changes to your code
- Reject - Dismiss the suggestion
- Edit - Modify the suggestion before applying
Getting Better Results
Be Specific
The more context you provide, the better the results:
"Make a token contract"
"Create an ASA management contract that allows the creator to mint new tokens, burn tokens, and transfer admin rights to a new address"
Iterate
Start with a basic version and refine it through conversation. Ask for specific improvements.
Review Generated Code
Always review AI-generated code for correctness and security. The AI is helpful but not infallible.
Configuration
Configure AI settings in Settings → AI Assistant:
- Model selection - Choose which AI model to use
- API keys - Use your own API keys for unlimited usage
- MCP servers - Add custom tool servers
Supported Models
- Claude (Anthropic) - Recommended for code generation
- GPT-4 (OpenAI)
- Gemini (Google)
- Custom models via OpenRouter