kikocis/Based-Agent public
| .. | ||
| .pythonlibs/ | ||
| .gitignore | 3.0 KiB | |
| .replit | 244 B | |
| README.md | 6.0 KiB | |
| agents.py | 12.7 KiB | |
| evals.py | 1.0 KiB | |
| image.png | 6.4 KiB | |
| image.webp | 273.4 KiB | |
| poetry.lock | 262.6 KiB | |
| pyproject.toml | 615 B | |
| replit_zip_error_log.txt | 807 B | |
| run.py | 6.2 KiB | |
README.md
BasedAgent π
An experimental playground for autonomous blockchain interactions on Base Layer 2!
π Introduction
Welcome to BasedAgentβyour AI-powered companion for exploring the exciting world of autonomous blockchain interactions! Built on top of the Coinbase Developer Platform (CDP) and OpenAI's Swarm, BasedAgent lets you dive into autonomous on-chain actions like never before.
π Key Features
- π€ Autonomous Execution: The agent thinks, decides, and acts on the blockchain autonomously.
- π€ Token Management: Create and manage ERC-20 tokens with ease.
- π NFT Deployment: Deploy and mint NFTs autonomously.
- πΈ Asset Transfers: Transfer assets between addresses without manual intervention.
- π Balance Checks: Keep tabs on wallet balances on the fly.
- β½ ETH Faucet Requests: Automatically request testnet ETH when needed.
- πΌοΈ Art Generation via DALL-E: Generate stunning artwork using AI.
π‘οΈ Why BasedAgent?
Imagine an AI agent that not only interacts with the blockchain but does so creatively and autonomously. Whether you're a developer, a blockchain enthusiast, or someone curious about AI, BasedAgent offers a unique and exciting playground to:
- Experiment with autonomous agent capabilities.
- Explore on-chain actions without manual coding.
- Understand the potential of AI in blockchain interactions.
π Get Started in Minutes!
1οΈβ£ Prerequisites
- Python 3.7+
- Replit Core Account (optional, but recommended for easy setup). Contact sales@replit.com for a free uppgrade (just mention coinbase)
2οΈβ£ API Configuration
Add your secrets to Replit's Secret Manager or set them as environment variables:
CDP_API_KEY_NAME: Your CDP API key name.CDP_PRIVATE_KEY: Your CDP private key.OPENAI_API_KEY: Your OpenAI API key.
You can get the Coinbase Developer Platform API key here: https://portal.cdp.coinbase.com/ And the OpenAI key here: https://platform.openai.com/api-keys (note you will need to have a paid account)
3οΈβ£ Running the Agent
After adding your API Keys to the Secrets pane, you start the agent by pressing the green "βΆ Run" Button at the top of the editor

Alternatively, you can start the based agent manually by navigating to the Replit shell and running:
python run.py
4οΈβ£ Watch the Magic Happen! β¨
The Based Agent will start its autonomous loop:
- Wakes up every 10 seconds.
- Chooses an on-chain action based on its capabilities.
- Executes the action on the blockchain.
- Prints results in a user-friendly format.
π€ How Does BasedAgent Work?
BasedAgent leverages the power of AI to make decisions and interact with the blockchain autonomously. Here's what happens under the hood:
- Decision Making: The agent decides what action to perform next.
- On-Chain Interaction: Executes blockchain transactions using the CDP SDK.
- Art Generation: If needed, generates art using OpenAI's DALL-E.
- Feedback Loop: Analyzes results and plans the next action.
π§ Available Functions
Unlock a world of possibilities with these built-in functions:
Token Operations
create_token(name, symbol, initial_supply): Create a new ERC-20 token.transfer_asset(amount, asset_id, destination_address): Transfer assets to a specific address.get_balance(asset_id): Check the wallet balance of a specific asset.
NFT Operations
deploy_nft(name, symbol, base_uri): Deploy a new ERC-721 NFT contract.mint_nft(contract_address, mint_to): Mint an NFT to a specified address.
Utilities
request_eth_from_faucet(): Request ETH from the Base Sepolia testnet faucet.generate_art(prompt): Generate art using DALL-E based on a text prompt.
Advanced (Experimental)
create_liquidity_pool(token0_address, token1_address, fee_tier, amount0, amount1): Create a Uniswap V3 liquidity pool and add initial liquidity.
π₯ Live Demo
Curious to see BasedAgent in action? Here's a sneak peek:
Starting autonomous Based Agent loop...
System: It's been 10 seconds. I want you to do some sort of onchain action based on my capabilities. Let's get crazy and creative!
Based Agent: I've decided to deploy a new NFT collection!
deploy_nft(name="Cyber Artifacts", symbol="CYART", base_uri="https://example.com/metadata/")
Successfully deployed NFT contract 'Cyber Artifacts' (CYART) at address 0xABC123... with base URI: https://example.com/metadata/
π€ Behind the Scenes
BasedAgent uses:
- Coinbase Developer Platform SDK: For seamless blockchain interactions.
- OpenAI Swarm: Powers the agent's autonomous decision-making.
- DALL-E: Generates art from textual descriptions.
β οΈ Disclaimer
This project is for educational purposes only. Do not use with real assets or in production environments. Always exercise caution when interacting with blockchain technologies.
π Contributing
We welcome contributions! If you have ideas, suggestions, or find issues, feel free to:
- Open an issue on our main GitHub repository: Swarm-CDP-SDK.
- Submit a pull request with your enhancements.
π€ Contact & Support
Have questions or need assistance?
- Lincoln Murr: lincoln.murr@coinbase.com
- Kevin Leffew: kevin@replit.com
π Additional Resources
- Coinbase Developer Platform: Documentation
- OpenAI Swarm: Learn More
- Base Layer 2: Explore Base
β€οΈ Acknowledgements
BasedAgent is made possible thanks to:
- Coinbase Developer Platform SDK: Documentation
- OpenAI Swarm (experimental): Documentation
- Community Contributors
Unleash the power of AI on the blockchain with BasedAgent! π
Happy Building! π©βπ»π¨βπ»
DISCLAIMER HERE?