A robust starter kit for building AI agents using OpenAI's Assistant API with on-chain capabilities. This toolkit provides a foundation for creating AI assistants that can interact with blockchain networks, execute smart contract functions, and handle various on-chain operations.
- Pre-configured OpenAI Assistant API setup
- Direct blockchain interactions through Viem
- TypeScript support for type safety
- Node.js (v18 or higher)
- TypeScript
- An OpenAI API key
- A wallet private key for the agent
- Bun
- Fork this repository
- Clone your forked repository:
git clone <your-forked-repo-url>
cd onchain-ai-starter
- Copy the environment configuration:
cp .env.example .env
- Install dependencies:
bun install
- Start the project:
bun run start
Create a new tool file under src/tools/<your-tool>.ts
. Follow the tool definition template:
Import and register your tool in src/tools/allTools.ts
:
import { yourTool } from './<your-tool>';
export const tools: Record<string, ToolConfig> = {
// ... existing tools
your_tool_name: yourTool
};
Add your tool's description and usage instructions in src/const/prompt.ts
.
We aim to build the largest open-source on-chain agent toolkit together! Your contributions are welcome and appreciated. Whether it's:
- Adding new tools and capabilities
- Improving documentation
- Fixing bugs
- Suggesting features
- Writing tests
Feel free to open issues and submit pull requests!
Follow me on Twitter: @0xSarthak13