Snak

by KasarLabs
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Allows agents to send notifications and alerts to Discord channels, particularly for autonomous monitoring mode.

  • Support for Google Gemini AI models to power agents that interact with and monitor the Starknet blockchain.

  • Provides a ready-to-use NestJS server with web interface for agent interaction and monitoring.

一个用于创建可与 Starknet 区块链交互的 AI 代理的工具包。它既可以作为 NPM 包使用,也可以作为带有 Web 界面的即用型 NestJS 服务器使用。支持多家 AI 提供商,包括 Anthropic、OpenAI、Google Gemini 和 Ollama。

快速入门

先决条件

  • 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文件:
# 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" #Node Configuration # optional by default : production NODE_ENV="YOUR_NODE_ENV" # Agent additional configuration POSTGRES_USER="YOUR_POSTGRES_USER" POSTGRES_PASSWORD="YOUR_POSTGRES_PASSWORD" POSTGRES_ROOT_DB="YOUR_POSTGRES_ROOT_DB" POSTGRES_HOST="YOUR_POSTGRES_HOST" POSTGRES_PORT="YOUR_POSTGRES_PORT"
  1. 创建您的 agent.config.json
{ "name": "Your Agent name", "bio": "Your AI Agent Bio", "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,", "chat_id": "Your Agent Chat-id for isolating memory", "autonomous": "Your agent is autonomous or not", "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"

服务器模式

运行服务器:

# 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"

可用模式

|交互模式|自主模式| |---|---|---| |提示模式|✅|✅| |服务器模式|✅|❌|

在你的项目中实现 Snak

  1. 安装 snak 包
#using npm npm install @starknet-agent-kit # using pnpm pnpm add @starknet-agent-kit
  1. 创建代理实例
import { StarknetAgent } from 'starknet-agent-kit'; const agent = new StarknetAgent({ 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: 'auto', agentconfig: y, }); const response = await agent.execute("What's my ETH balance?");

行动

要了解有关操作的更多信息,您可以阅读此文档部分。套件中全面的界面将提供所有可用插件及其操作的易于浏览的目录,使发现和使用更加简单。

要向代理添加操作,您可以轻松按照此处的分步指南进行操作

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

MIT 许可证 - 有关详细信息,请参阅 LICENSE 文件。


有关详细文档,请访问docs.kasar.io

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

构建由 Starknet 提供支持的强大且安全的 AI 代理。

  1. Prerequisites
    1. Installation
      1. Configuration
        1. Usage
          1. Prompt Mode
          2. Server Mode
          3. Implement Snak in your project
        2. Actions
          1. Contributing
            1. License
              ID: fk0cmc0rul