Skip to main content
Glama

Starknet を搭載した強力で安全な AI エージェントを作成するためのエージェントエンジン。NPM パッケージとすぐに使えるバックエンドの両方でご利用いただけます。

クイックスタート

前提条件

  • Starknetウォレット(推奨: Argent X

  • AI プロバイダー API キー (Anthropic/OpenAI/Google Gemini/Ollama)

  • Node.jsとpnpmがインストールされている

インストール

git clone https://github.com/kasarlabs/snak.git
cd snak
pnpm install

構成

  1. .env.exampleをコピーして.envファイルを作成します。

cp .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"
  1. AIモデルの設定(オプション): config/models/default.models.jsonファイルは、様々なタスク( fastsmartcheap )で使用されるデフォルトのAIモデルを定義します。このファイルをカスタマイズすることも、新しいモデル設定(例: my_models.json )を作成してエージェント実行時に指定することもできます。ファイル構造についてはconfig/models/example.models.jsonをご覧ください。

    エージェントは、モデル構成のproviderフィールドを使用して、 .envファイルからロードする API キーを決定します (たとえば、 provideropenaiの場合、 OPENAI_API_KEYロードします)。

  2. 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のツールを使用して、独自のエージェント構成を簡単に作成できます。

Related MCP server: AgentCraft MCP Server

使用法

プロンプトモード

プロンプトを実行します:

# 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を実装する

  1. snakパッケージをインストールする

#using npm
npm install @snakagent

# using pnpm
pnpm add @snakagent
  1. エージェントインスタンスを作成する

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をご覧ください。

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KasarLabs/snak'

If you have feedback or need assistance with the MCP directory API, please join our Discord server