Starknet 기반의 강력하고 안전한 AI 에이전트를 개발하는 에이전트 엔진입니다. NPM 패키지와 즉시 사용 가능한 백엔드로 제공됩니다.
빠른 시작
필수 조건
- Starknet 지갑 (추천: Argent X )
- AI 제공업체 API 키(Anthropic/OpenAI/Google Gemini/Ollama)
- Node.js와 pnpm이 설치되었습니다.
설치
지엑스피1
구성
.env.example
을 복사하여 .env
파일을 만듭니다.
그런 다음 .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 Model API Keys (mandatory) ---
# Add the API keys for the specific AI providers you use in config/models/default.models.json
# The agent will automatically load the correct key based on the provider name.
# Example for OpenAI:
OPENAI_API_KEY="YOUR_OPENAI_API_KEY" # (e.g., sk-...)
# Example for Anthropic:
ANTHROPIC_API_KEY="YOUR_ANTHROPIC_API_KEY" # (e.g., sk-ant-...)
# Example for Google Gemini:
GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
# Example for DeepSeek:
DEEPSEEK_API_KEY="YOUR_DEEPSEEK_API_KEY"
# Note: You do not need an API key if using a local Ollama model.
# --- General Agent Configuration (mandatory) ---
SERVER_API_KEY="YOUR_SERVER_API_KEY" # A secret key for your agent server API
SERVER_PORT="3001"
# --- PostgreSQL Database Configuration (mandatory) ---
POSTGRES_USER="admin"
POSTGRES_PASSWORD="admin"
POSTGRES_ROOT_DB="postgres" # Database used to create/manage the application database
POSTGRES_HOST="localhost"
POSTGRES_PORT="5454"
# --- LangSmith Tracing (Optional) ---
# Set LANGSMITH_TRACING=true to enable tracing
LANGSMITH_TRACING=false
LANGSMITH_ENDPOINT="https://api.smith.langchain.com"
LANGSMITH_API_KEY="YOUR_LANGSMITH_API_KEY" # (Only needed if LANGSMITH_TRACING=true)
LANGSMITH_PROJECT="Snak" # (Optional project name for LangSmith)
# --- Node Environment ---
NODE_ENV="development" # "development" or "production"
- AI 모델 구성(선택 사항):
config/models/default.models.json
파일은 다양한 작업( fast
, smart
, cheap
)에 사용되는 기본 AI 모델을 정의합니다. 이 파일을 사용자 지정하거나 새 모델 구성(예: my_models.json
)을 생성하여 에이전트 실행 시 지정할 수 있습니다. 자세한 구조는 config/models/example.models.json
파일을 참조하세요.에이전트는 모델 구성에서 provider
필드를 사용하여 .env
파일에서 로드할 API 키를 결정합니다(예: provider
가 openai
인 경우 OPENAI_API_KEY
로드합니다). config/agents/
디렉토리에 에이전트 구성 파일(예: default.agent.json
또는 my_agent.json
)을 만듭니다.
{
"name": "Your Agent name",
"group": "Your Agent group",
"description": "Your AI Agent Description",
"lore": ["Some lore of your AI Agent 1", "Some lore of your AI Agent 1"],
"objectives": [
"first objective that your AI Agent need to follow",
"second objective that your AI Agent need to follow"
],
"knowledge": [
"first knowledge of your AI Agent",
"second knowledge of your AI Agent"
],
"interval": "Your agent interval beetween each transaction of the Agent in ms,",
"chatId": "Your Agent Chat-id for isolating memory",
"maxIterations": "The number of iterations your agent will execute before stopping",
"mode": "The mode of your agent, can be interactive, autonomous or hybrid",
"memory": {
"enabled": "true or false to enable or disable memory",
"shortTermMemorySize": "The number of messages your agent will remember"
},
"plugins": ["Your first plugin", "Your second plugin"],
"mcpServers": {
"nxp_server_example": {
"command": "npx",
"args": ["-y", "@npm_package_example/npx_server_example"],
"env": {
"API_KEY": "YOUR_API_KEY"
}
},
"local_server_example": {
"command": "node",
"args": ["node /path/to/local_server/dist/index.js"]
}
}
}
snakagent 의 도구를 사용하여 간단히 자신의 에이전트 구성을 만들 수 있습니다.
용법
프롬프트 모드
프롬프트를 실행합니다:
# start with the default.agent.json
pnpm run start
# start with your custom configuration
pnpm run start --agent="name_of_your_config.json" --models="name_of_your_config.json"
서버 모드
서버를 실행합니다 :
# start with the default.agent.json
pnpm run start:server
# start with your custom configuration
pnpm run start:server --agent="name_of_your_config.json" --models="name_of_your_config.json"
사용 가능한 모드
|대화형 모드|자율 모드|
|---|---|---|
|프롬프트 모드|✅|✅|
|서버 모드|✅|✅|
프로젝트에 Snak을 구현하세요
- snak 패키지 설치
#using npm
npm install @snakagent
# using pnpm
pnpm add @snakagent
- 에이전트 인스턴스를 생성하세요
import { SnakAgent } from 'starknet-agent-kit';
const agent = new SnakAgent({
provider: new RpcProvider({ nodeUrl: process.env.STARKNET_RPC_URL }),
accountPrivateKey: process.env.STARKNET_PRIVATE_KEY,
accountPublicKey: process.env.STARKNET_PUBLIC_ADDRESS,
aiModel: process.env.AI_MODEL,
aiProvider: process.env.AI_PROVIDER,
aiProviderApiKey: process.env.AI_PROVIDER_API_KEY,
signature: 'key',
agentMode: 'interactive',
agentconfig: y,
});
const response = await agent.execute("What's my ETH balance?");
행위
액션에 대한 자세한 내용은 이 문서 섹션을 참조하세요. 키트의 포괄적인 인터페이스는 사용 가능한 모든 플러그인과 액션을 쉽게 탐색할 수 있는 카탈로그를 제공하여 검색 및 사용을 더욱 간편하게 만들어 줍니다.
에이전트에 작업을 추가하려면 여기의 단계별 가이드를 쉽게 따르세요.
기여하다
기여를 환영합니다! 풀 리퀘스트를 제출해 주세요.
특허
MIT 라이센스 - 자세한 내용은 LICENSE 파일을 참조하세요.
자세한 내용은 docs.kasar.io를 방문하세요.