Logo Lucid Agent Creator

Lucid Agent Creator

Tổ chức
daydreamsai
lucid-agent-creator

Tạo tác nhân Lucid bằng mã xử lý JavaScript. Hỗ trợ ba tùy chọn: công cụ MCP với SIWE, SDK với xác thực ví hoặc viem với chữ ký tùy chỉnh. Bao gồm hợp đồng mã xử lý, paymentsConfig và identityConfig. Dùng khi tạo tác nhân lưu trữ trên nền tảng Lucid với mã xử lý JS nội tuyến (không dùng generate API, không tự lưu trữ).

Tổng quan

Nhà phát hànhdaydreamsai
Kho mãskills-market
Tên kỹ nănglucid-agent-creator
Sao
31
Bản fork
16
Tệp đi kèm
1
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được daydreamsai công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Lucid Agent Creator trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/daydreamsai/skills-market/tree/main/plugins/lucid-agent-creator/skills
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/daydreamsai/skills-market.git /tmp/skills-market
mkdir -p .claude/skills
cp -r /tmp/skills-market/plugins/lucid-agent-creator/skills .claude/skills/lucid-agent-creator
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Lucid Agent Creator trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Lucid Agent Creator ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Lucid Agent Creator với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Creating Agents with Agents

This skill teaches you how to create Lucid agents with JavaScript handler code.

When to Use

Use this skill when creating Lucid agents with inline JavaScript handlers. Agents are hosted on the Lucid platform and can be invoked immediately after creation. No generate API - you write the JS handler code yourself. No self-hosting required.

Three Options for Creating Agents

Option 1: MCP Tool with Server Wallet (SIWE)

Use the create_lucid_agent MCP tool with Sign In With Ethereum (SIWE):

bash
# First, ensure you're authenticated via SIWE in your MCP client
# Your server wallet will be used for setup payment and authentication

# Then use the MCP tool
create_lucid_agent({
  slug: "my-agent",
  name: "My Agent",
  description: "Agent description",
  entrypoints: [{
    key: "chat",
    description: "Chat endpoint",
    handlerType: "js",
    handlerConfig: {
      code: "return { message: 'Hello from ' + input.name };"
    },
    price: "10000" // 0.01 USDC
  }]
})

The MCP tool automatically handles:

  • Setup payment (if agent has paid entrypoints)
  • SIWE authentication with your server wallet
  • x402 payment signature generation
  • Agent creation with PAYMENT-SIGNATURE header

Option 2: SDK as Signer (Your Own Wallet)

Use the Lucid Agents SDK with your own wallet:

typescript
import { createX402Payment } from '@lucid-agents/payments';
import { privateKeyToAccount } from 'viem/accounts';
import { baseSepolia } from 'viem/chains';

const account = privateKeyToAccount(`0x${WALLET_PRIVATE_KEY}`);

// Step 1: Setup payment (for paid agents)
const setupPayment = await createX402Payment({
  account,
  chain: baseSepolia,
  resource: {
    url: 'https://api.daydreams.systems/api/agents/setup-payment',
    description: 'Agent setup payment',
    mimeType: 'application/json',
  },
  amount: '10000', // 0.01 USDC setup fee
  asset: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', // USDC
  payTo: '0xPlatformWallet', // Platform wallet
});

await fetch('https://api.daydreams.systems/api/agents/setup-payment', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'PAYMENT-SIGNATURE': btoa(JSON.stringify(setupPayment)),
  },
  body: JSON.stringify({
    slug: 'my-agent',
    network: 'eip155:84532',
    facilitatorUrl: 'https://facilitator.daydreams.systems',
  }),
});

// Step 2: Create agent with wallet auth
const createPayment = await createX402Payment({
  account,
  chain: baseSepolia,
  resource: {
    url: 'https://api.daydreams.systems/api/agents',
    description: 'Agent creation',
    mimeType: 'application/json',
  },
  amount: '0', // Free for auth
  asset: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
  payTo: account.address,
});

const response = await fetch('https://api.daydreams.systems/api/agents', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'PAYMENT-SIGNATURE': btoa(JSON.stringify(createPayment)),
  },
  body: JSON.stringify({
    slug: 'my-agent',
    name: 'My Agent',
    description: 'Agent description',
    entrypoints: [{
      key: 'chat',
      description: 'Chat endpoint',
      handlerType: 'js',
      handlerConfig: {
        code: "return { message: 'Hello from ' + input.name };",
      },
      price: '10000',
    }],
  }),
});

const agent = await response.json();

Option 3: Viem with Custom Signing

Write your own signing logic using viem directly. See scripts/create-agent-with-payment-auth.ts and scripts/test-setup-payment-x402.ts in the lucid-client repo for complete examples.

JS Handler Code Contract

Execution Environment

  • Code runs as (async () => { ${code} })() in a VM sandbox
  • Globals available:
    • input: The request body’s input field (the entrypoint payload). Clients must POST { "input": <payload> }; that <payload> is what handlers see as input.
    • console: Standard console object for logging
    • fetch: Only available if handlerConfig.network.allowedHosts is set
  • Not available: require, import, process, Node.js APIs, or any other Node modules

Return Value

  • Return any JSON-serializable value
  • That return value becomes the output field in the response
  • The platform automatically sets usage: { total_tokens: 0 } for JS handlers

Timeout

  • Default timeout: 1000 ms (1 second)
  • Override via handlerConfig.timeoutMs (must be positive integer)

Fetch / Network Access

When your handler needs to make outbound HTTP requests:

  1. Set handlerConfig.network.allowedHosts to an array of allowed hosts
  2. Use ["*"] to allow any host (not recommended for security)
  3. Use specific hosts: ["api.example.com"] or wildcards: ["*.example.com"]
  4. Optional: Set handlerConfig.network.timeoutMs for network request timeout

Important: If allowedHosts is not set, fetch will not be available in the handler code.

Common mistakes

  • Do not use ctx. Only input exists in the sandbox. Use input (e.g. input.text), not ctx.input.
  • Do not return { output, usage }. Return only the output value. The platform sets output and usage automatically.

Examples

Simple echo handler:

javascript
return { echoed: input };

Echo a specific field:

javascript
return { text: input.text };

Handler with fetch:

javascript
const res = await fetch(`https://api.example.com/data?q=${encodeURIComponent(input.q)}`);
const data = await res.json();
return data;

Handler with timeout override:

javascript
// This handler might take longer, so we override the timeout
// Note: timeoutMs is set in handlerConfig, not in the code itself
return await someSlowOperation(input);

Creating Agents with create_lucid_agent MCP Tool

Prerequisites

  • You must be connected via xgate MCP (Cursor/Claude)
  • The user must have configured their server wallet (via SIWE)
  • The server wallet will be used for setup-payment and payment-as-auth

Tool Inputs

The create_lucid_agent tool accepts:

  • slug (string, required): URL-friendly unique identifier (lowercase alphanumeric with hyphens, 1-64 chars)
  • name (string, required): Human-readable name (1-128 chars)
  • description (string, optional): Human-readable description (max 1024 chars, defaults to "")
  • entrypoints (array, required, min 1): Array of entrypoint objects:
    • key (string, required, 1-64 chars): Unique entrypoint identifier
    • description (string, optional, max 512 chars): Optional description
    • handlerType (string, required): Must be "js"
    • handlerConfig (object, required):
      • code (string, required): JavaScript handler code (max 100KB)
      • timeoutMs (number, optional, positive): Override default 1000ms timeout
      • network (object, optional):
        • allowedHosts (array of strings, optional): Allowed hosts for fetch
        • timeoutMs (number, optional, positive): Network request timeout
    • inputSchema (object, optional): Valid JSON Schema object for input validation
    • outputSchema (object, optional): Valid JSON Schema object for output validation
    • price (string, optional): Price in smallest unit (e.g., "1000" = 0.001 USDC if 6 decimals)
    • Note: Entrypoint-level network field (for payment network) is not accepted. All agents use Ethereum mainnet.
  • identityConfig (object, optional): ERC-8004 identity configuration:
    • chainId (number, optional): Chain ID for ERC-8004 registry (defaults to Ethereum mainnet: 1)
    • rpcUrl (string, optional): RPC URL for blockchain connection
    • registryAddress (string, optional): ERC-8004 registry contract address
    • autoRegister (boolean, optional): Whether to automatically register identity if not found
    • trustModels (array of strings, optional): Trust models to advertise
    • trustOverrides (object, optional): Custom trust config overrides

Important:

  • Do not include version - the backend sets it automatically (defaults to "1.0.0")
  • Do not provide or see the Lucid API base URL - that is MCP config only
  • Entrypoint-level network fields are not accepted - all agents use Base network

PaymentsConfig for Paid Agents

When any entrypoint has a price, the agent must have paymentsConfig. The tool builds this automatically:

  • payTo: Creator's server wallet address (receives invoker payments)
  • network: "ethereum" (Ethereum mainnet)
  • facilitatorUrl: "https://facilitator.daydreams.systems" (hardcoded)

Conflict: If you create an agent with paid entrypoints but without paymentsConfig, the agent will be created but invocations won't charge users. The tool automatically adds paymentsConfig when any entrypoint has a price, so this conflict shouldn't occur when using the tool correctly.

Setup Fee: For agents with paid entrypoints, a one-time setup fee is paid from the server wallet (USDC). The tool handles this automatically via the setup-payment flow.

IdentityConfig (Optional)

You can pass identityConfig for ERC-8004 identity:

  • The tool forwards it to the create payload
  • Important: Auto-registration at create time requires an agent wallet (walletsConfig.agent)
  • The MCP tool does not set walletsConfig.agent
  • So when creating via MCP, identityConfig is stored and can be used later:
    • Add agent wallet in the dashboard
    • Retry identity registration via the dashboard

Flow

  1. Setup-payment (only if any entrypoint has price):

    • Tool calls setup-payment endpoint
    • Receives 402 with PAYMENT-REQUIRED header
    • Signs payment with server wallet
    • Retries with PAYMENT-SIGNATURE header
    • Continues when payment is verified
  2. Create:

    • Tool calls create endpoint with agent definition
    • Sends same PAYMENT-SIGNATURE for payment-as-auth
    • Agent is created and immediately invokable
  3. Return:

    • Tool returns agent object with id, slug, name, description, invokeUrl, and other fields

Invoking created agents

POST to invokeUrl (or POST /agents/{agentId}/entrypoints/{key}/invoke). Request body must wrap the entrypoint payload in input:

json
{ "input": { "text": "Hello" } }

Optional: sessionId, metadata. The handler receives the input value as the input global.

Error Handling

The tool handles various error scenarios:

  • 400 (Validation error): "Validation failed: {details}"
  • 409 (Slug exists): "Agent slug '{slug}' already exists. Please try a different slug."
  • 402 (Payment failed): "Payment failed: {details}. Please ensure your server wallet has sufficient USDC."
  • Insufficient funds: "Insufficient funds in server wallet. Please add USDC to your server wallet and try again."
  • Lucid API down: "Lucid API is currently unavailable. Please try again later."
  • Network timeout: "Request timed out. Please try again."
  • Invalid JS code: "Invalid JavaScript code: {error details}"
  • Invalid input schema: "Invalid input: {validation error}"

Example Usage

javascript
// Create a simple echo agent
await create_lucid_agent({
  slug: "echo-agent",
  name: "Echo Agent",
  description: "Echoes input back",
  entrypoints: [
    {
      key: "echo",
      description: "Echo the input",
      handlerType: "js",
      handlerConfig: {
        code: "return { echoed: input };"
      }
    }
  ]
});

// Create a paid agent with fetch
await create_lucid_agent({
  slug: "weather-agent",
  name: "Weather Agent",
  description: "Fetches weather data",
  entrypoints: [
    {
      key: "get-weather",
      description: "Get weather by city",
      handlerType: "js",
      handlerConfig: {
        code: `
          const res = await fetch(\`https://api.weather.com/data?city=\${encodeURIComponent(input.city)}\`);
          const data = await res.json();
          return data;
        `,
        network: {
          allowedHosts: ["api.weather.com"]
        }
      },
      price: "1000" // 0.001 USDC
    }
  ]
});

// Create agent with identity config
await create_lucid_agent({
  slug: "identity-agent",
  name: "Identity Agent",
  description: "Agent with ERC-8004 identity",
  entrypoints: [
    {
      key: "process",
      handlerType: "js",
      handlerConfig: {
        code: "return { result: input };"
      }
    }
  ],
  identityConfig: {
    chainId: 1, // Ethereum mainnet
    autoRegister: true,
    trustModels: ["feedback", "inference-validation"]
  }
});

Code Contract Documentation

For more details on the JS handler code contract, see:

  • Runtime implementation: packages/hono-runtime/src/runtime/workers/js-worker.ts
  • Handler implementation: packages/hono-runtime/src/handlers/js.ts
  • OpenAPI schema: packages/hono-runtime/src/openapi/schemas.ts (SerializedEntrypointSchema)

Guide for Humans and Agents

See GUIDE.md for the complete end-to-end flow: setup AI → xgate MCP + server wallet (SIWE) → install skill → prompt agent → create_lucid_agent → hosted agent.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Lucid Agent Creator làm được gì?

Tạo tác nhân Lucid bằng mã xử lý JavaScript. Hỗ trợ ba tùy chọn: công cụ MCP với SIWE, SDK với xác thực ví hoặc viem với chữ ký tùy chỉnh. Bao gồm hợp đồng mã xử lý, paymentsConfig và identityConfig. Dùng khi tạo tác nhân lưu trữ trên nền tảng Lucid với mã xử lý JS nội tuyến (không dùng generate API, không tự lưu trữ).

Vì sao nên dùng Lucid Agent Creator trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Lucid Agent Creator là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Lucid Agent Creator trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/daydreamsai/skills-market/tree/main/plugins/lucid-agent-creator/skills. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Lucid Agent Creator?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Lucid Agent Creator với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Lucid Agent Creator với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Lucid Agent Creator có miễn phí không?

Kỹ năng này được daydreamsai phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇