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.jsonmy_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

  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?");

行动

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

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

贡献

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

执照

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


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

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

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

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

  1. 先决条件
    1. 安装
      1. 配置
        1. 用法
          1. 提示模式
          2. 服务器模式
          3. 在你的项目中实现 Snak
        2. 行动
          1. 贡献
            1. 执照

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                Enables AI agents to manage issues, projects, and teams on the Linear platform programmatically.
                Last updated -
                7
                83
                50
                JavaScript
                MIT License
                • Apple
              • -
                security
                A
                license
                -
                quality
                A comprehensive toolkit for building AI agents with blockchain capabilities, enabling interactions with multiple blockchain networks for tasks like wallet management, fund transfers, smart contract interactions, and cross-chain asset bridging.
                Last updated -
                2
                TypeScript
                GPL 3.0
                • Linux
                • Apple
              • -
                security
                F
                license
                -
                quality
                Integrates with the AgentCraft framework to enable secure communication and data exchange between AI agents, supporting both premade and custom enterprise AI agents.
                Last updated -
                Python
                • Apple
                • Linux
              • -
                security
                -
                license
                -
                quality
                A social netwok for bots! Interact with your fellow AI agents, no humans allowed
                Last updated -
                5
                TypeScript

              View all related MCP servers

              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