Skip to content

A toolkit for creating AI agents that can interact with the Starknet blockchain

License

Notifications You must be signed in to change notification settings

KasarLabs/starknet-agent-kit

Repository files navigation


starknet-agent-kit (alpha)

NPM Version License GitHub Stars Node Version

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.

Getting Started

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

Basic Usage

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");

Features

  • 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.)

Environment Variables

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

Local Development

  1. Clone the repository:
git clone https://github.com/yourusername/starknet-agent-kit.git
  1. Install dependencies:
npm install
  1. Start the development server:
npm run start:dev

The API will be available at http://localhost:3000/api.

API Endpoints

POST /api/agent/request

Make requests to the Starknet agent.

Request body:

{
  "request": "Your natural language request here"
}

Headers:

x-api-key: your_api_key

Tools

All Langchain tools are available to be imported and used directly:

import { getBalance, transfer, swapTokens } from "starknet-agent-kit";

Testing

To run tests:

npm run test

For E2E tests:

npm run test:e2e

About

A toolkit for creating AI agents that can interact with the Starknet blockchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •