A NestJS-based toolkit for creating AI agents that can interact with the Starknet blockchain.
⚠️ Warning: This kit is currently under development. Please note that sharing sensitive information (private keys, personal data, etc.) with AI models involves inherent security risks.
npm install @nestjs/common @nestjs/core @nestjs/platform-fastify starknet @langchain/anthropic
You will need two things:
- A Starknet wallet private key (you can get one from Argent X)
- An Anthropic API key
import { StarknetAgent } from "starknet-agent-kit";
const agent = new StarknetAgent({
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
walletPrivateKey: process.env.STARKNET_PRIVATE_KEY,
});
// Execute commands in natural language
await agent.execute("transfer 0.1 ETH to 0x123...");
// Get balance
await agent.execute("What is my ETH balance?");
// Swap tokens
await agent.execute("Swap 5 USDC for ETH");
// Create account
await agent.execute("Create a new Argent account");
- Retrieve account infos (Balance, public key, etc)
- Create one or multiple accounts (Argent & OpenZeppelin)
- transfer assets between accounts
- Play with DeFi (Swap on Avnu)
- Play with dApps (Create a .stark domain)
- All RPC read methods supported (getBlockNumber, getStorageAt, etc.)
Create a .env
file with the following variables:
STARKNET_PRIVATE_KEY=your_private_key
PUBLIC_ADDRESS=your_public_address
ANTHROPIC_API_KEY=your_anthropic_api_key
RPC_URL=your_rpc_url
- Clone the repository:
git clone https://github.com/yourusername/starknet-agent-kit.git
- Install dependencies:
npm install
- Start the development server:
npm run start:dev
The API will be available at http://localhost:3000/api
.
Make requests to the Starknet agent.
Request body:
{
"request": "Your natural language request here"
}
Headers:
x-api-key: your_api_key
All Langchain tools are available to be imported and used directly:
import { getBalance, transfer, swapTokens } from "starknet-agent-kit";
To run tests:
npm run test
For E2E tests:
npm run test:e2e