Thank you for your interest in contributing to Starknet Agent Kit! We welcome all contributions, no matter how big or small.
- Repository Structure
- Getting Started
- Development Workflow
- Adding New Features
- Contributing Guidelines
- Testing
- Documentation
The Starknet Agent Kit is organized with the following structure:
.
├── client/ # Frontend application
├── src/ # Backend source code
│ ├── agents/ # Agent system implementation
│ ├── common/ # Shared utilities and error handling
│ ├── config/ # Configuration management
│ ├── lib/
│ │ ├── agent/ # Core agent functionality (START HERE)
│ │ │ ├── plugins/ # Protocol-specific implementations
│ │ │ │ ├── core/ # Core functionality (RPC, accounts, etc.)
│ │ │ │ ├── avnu/ # Avnu DEX integration (example)
│ │ │ │ └── ... # Other protocol integrations
│ │ │ ├── tools/ # Tool implementations
│ │ │ └── schemas/ # Validation schemas
│ │ └── ...
│ └── ...
└── test/ # Test files
- Fork and clone the repository:
git clone https://github.com/kasarlabs/starknet-agent-kit.git
cd starknet-agent-kit
- Install dependencies:
pnpm install
- Set up your environment variables:
cp .env.example .env
# Starknet configuration (mandatory)
STARKNET_PUBLIC_ADDRESS="YOUR_STARKNET_PUBLIC_ADDRESS"
STARKNET_PRIVATE_KEY="YOUR_STARKNET_PRIVATE_KEY"
STARKNET_RPC_URL="YOUR_STARKNET_RPC_URL"
# AI Provider configuration (mandatory)
AI_PROVIDER_API_KEY="YOUR_AI_PROVIDER_API_KEY"
AI_MODEL="YOUR_AI_MODEL"
AI_PROVIDER="YOUR_AI_PROVIDER"
# NestJS server configuration
SERVER_API_KEY="YOUR_SERVER_API_KEY"
SERVER_PORT="YOUR_SERVER_PORT"
# Agent additional configuration
DISCORD_BOT_TOKEN?="YOUR_DISCORD_BOT_TOKEN"
DISCORD_CHANNEL_ID?="YOUR_DISCORD_CHANNEL_ID"
- Start the development environment:
pnpm dev
-
Create a new branch following the convention:
git checkout -b feat/scope-your-feature
-
Make your changes while following project guidelines.
-
Commit using conventional commits:
git commit -m "feat(scope): add new feature"
-
Push your changes and create a pull request:
git push origin feat/scope-your-feature
- Create a new directory under
src/lib/agent/plugins/
:
src/lib/agent/plugins/your-protocol/
├── abis/ # Protocol-specific ABIs
├── actions/ # Protocol actions
├── utils/ # Utility functions
├── constants/ # Protocol constants
└── types/ # Type definitions
-
Implement your protocol's actions in the
actions/
directory following the existing patterns -
Create validation schemas in
schemas/
directory using Zod -
Register your actions in the toolkit registry
- Create a new action file in the appropriate protocol directory
- Define the action's schema using Zod
- Implement the action's functionality
- Register the action in the registry
Example:
StarknetToolRegistry.registerTool({
name: 'your_action_name',
description: 'Description of what your action does',
schema: yourActionSchema,
execute: youractionFunction,
});
Follow this documentation for more informations regarding Tools and Actions.
- Follow TypeScript best practices and use types appropriately
- Write clear commit messages following conventional commits
- Include tests for new Actions
- Update documentation for API changes
- Ensure all tests pass before submitting PR
- Follow the existing code style and formatting
- Run tests:
pnpm test
- Write tests for new features:
describe('YourFeature', () => {
it('should work as expected', async () => {
// Your test implementation
});
});
- Document all public APIs and functions
- Update README.md if adding new features
- Include examples in documentation
- Update CHANGELOG.md with your changes
- Use the provided error classes in
common/errors/
- Always return properly formatted JSON responses
- Include appropriate error messages and types
- Use Zod schemas for all inputs
- Include descriptive schema messages
- Handle edge cases appropriately
- Use meaningful variable and function names
- Keep functions focused and single-purpose
- Comment complex logic
- Follow the existing project structure
If you're stuck or have questions:
- Check existing issues and pull requests
- Create a new issue with a detailed description
- Tag appropriate maintainers
- Fill out the PR template completely
- Link related issues
- Ensure CI checks pass
- Request review from maintainers
- Address review comments
- Update documentation as needed
Thank you for contributing to Starknet Agent Kit!