搜索

PythonReactSEOPDF
GitHub Skill

openkbs

OpenKBS AI agent development framework. Use when creating, modifying, or deploying AI agents with backend handlers (onRequest, onResponse, actions.js), frontend components (contentRender.js), or elastic services (functions, postgres, storage, pulse). Trigger keywords: openkbs, kb, agent, handler, contentRender, elastic, memory, scheduled task.

open-kbs☆ 9 仓库 Stars1 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

OpenKBS Development

OpenKBS is a framework for building AI-powered applications - from simple agents to full-stack platforms.

Note: In OpenKBS, "KB" (Knowledge Base) and "Agent" are used interchangeably. Every agent has a unique kbId.

Two Usage Modes

1. Agent-Only Mode

Build a single conversational AI agent with backend handlers and custom UI.

openkbs create my-agent
openkbs push

Simplest way to get started - just an agent with memory, commands, and custom frontend.

2. Platform Mode (Full-Stack)

Build complete SaaS platforms that include agents plus additional infrastructure.

openkbs deploy          # Deploy from openkbs.json
openkbs stack status    # View deployed resources

Platform mode extends agent capabilities with:

  • Multiple Agents: Run several agents on one platform (in agents/ folder)
  • Elastic Functions: Serverless Lambda (Node.js, Python, Java)
  • Elastic Postgres: Managed PostgreSQL (Neon) for relational data
  • Elastic Storage: S3 buckets + CloudFront CDN for files
  • Elastic Pulse: Real-time WebSocket pub/sub
  • Whitelabel: Custom domains (example.com) with static site (site/ folder)

Architecture Note: The whitelabel is a special "service agent" with its own kbId that holds the entire cloud setup:

  • Domain configuration (domainParkingState)
  • Elastic services (Postgres, Storage, Pulse, Functions)
  • CloudFront distributions
  • SSL certificates

This whitelabel kbId is used in settings.json files throughout the project. User-facing agents in agents/ folder each get their own separate kbId when pushed.

Project Structure

Agent Structure
my-agent/
├── app/
│   ├── settings.json       # Agent configuration (model, itemTypes, MCP)
│   └── instructions.txt    # System prompt for LLM
├── src/
│   ├── Events/
│   │   ├── onRequest.js    # Pre-process user messages
│   │   ├── onResponse.js   # Parse LLM output, execute commands
│   │   ├── actions.js      # Command implementations
│   │   ├── onCronjob.js    # Scheduled periodic tasks
│   │   └── onPublicAPIRequest.js  # Webhook handler
│   └── Frontend/
│       ├── contentRender.js    # Custom React UI
│       └── contentRender.json  # Frontend dependencies
│
Platform Structure
my-platform/
├── agents/                        # Multiple AI agents
│   ├── marketing-assistant/       # Each agent has full structure
│   │   ├── app/
│   │   │   ├── settings.json
│   │   │   └── instructions.txt
│   │   └── src/
│   │       ├── Events/
│   │       │   ├── onRequest.js
│   │       │   ├── onResponse.js
│   │       │   └── actions.js
│   │       └── Frontend/
│   │           └── contentRender.js
│   └── support-agent/             # Another agent
│       ├── app/
│       └── src/
├── functions/                     # Serverless Lambda functions
│   └── api/
│       └── index.mjs
├── site/                          # Static site for whitelabel domain
│   └── index.html
└── openkbs.json                   # Elastic services config
openkbs.json
{
  "region": "us-east-1",
  "spa": "/app/index.html",
  "postgres": true,
  "storage": {
    "cloudfront": "media"
  },
  "pulse": true,
  "functions": [
    { "name": "api", "runtime": "nodejs24.x", "memory": 512, "timeout": 30 }
  ],
  "site": "./site"
}

Quick Commands

Agent Commands
openkbs create <name>    # Create new agent
openkbs push             # Deploy to cloud
openkbs pull             # Download from cloud
openkbs update skills    # Update this skill
Platform Commands
openkbs deploy           # Deploy all elastic services
openkbs stack status     # Show deployed resources
openkbs destroy          # Remove all resources (DANGEROUS)
Elastic Services
openkbs fn list          # List Lambda functions
openkbs fn push api      # Deploy function
openkbs fn logs api      # View function logs
openkbs postgres shell   # Connect to Postgres
openkbs storage ls       # List S3 objects
openkbs pulse status     # WebSocket status
openkbs site push        # Deploy static site
openkbs site spa /app/index.html  # Enable SPA routing
Domain & Whitelabel
openkbs ls                        # List all agents - find whitelabel kbId here
openkbs ls <kbId>                 # View full agent details
openkbs ls <kbId> domain          # Get just the domain name
openkbs ls <kbId> domainParkingState  # Get domain setup details
openkbs publish example.com       # Link agent to custom domain
openkbs unpublish example.com     # Unlink agent from domain

Quick domain lookup:

# 1. Find the whitelabel agent (usually named "AI White Label" or similar)
openkbs ls

# 2. Get its domain
openkbs ls 1ya6foz1a7q3 domain
# -> jobavion.com

Available fields: domain, domainParkingState, elasticPostgresHost, elasticStorageBucket, spaFallback, etc.

Image Generation Service

Generate images directly from CLI using OpenKBS AI services:

# Generate with GPT
openkbs service -m gpt-image -d '{"action":"createImage","prompt":"a logo"}' -o logo.png

# Generate with Gemini
openkbs service -m gemini-image -d '{"action":"createImage","prompt":"hero image"}' -o hero.png

# Edit existing image
openkbs service -m gpt-image -d '{"action":"createImage","prompt":"make it blue","imageUrls":["https://..."]}' -o edited.png

Available models:

  • gpt-image - OpenAI GPT Image (gpt-image-1.5)
  • gemini-image - Google Gemini Flash (gemini-2.5-flash-image)

Options for gpt-image:

Option Values Default
prompt (required) -
size "1024x1024", "1024x1536", "1536x1024", "auto" "auto"
quality "low", "medium", "high", "auto" "auto"
n Number of images 1
output_format "png", "jpg", "webp" "png"
background "transparent", "opaque", "auto" "auto"
output_compression 0-100 100
imageUrls Array of URLs for editing -

Options for gemini-image:

Option Values Default
prompt (required) -
aspect_ratio "1:1", "16:9", "9:16", "4:3", "3:4" "1:1"
imageUrls Array of URLs for reference -

Backend Handler Pattern

Commands are XML tags with JSON content that the LLM outputs:

<commandName>{"param": "value"}</commandName>

The handler.js parses these tags, matches regex patterns in actions.js, and executes async functions:

// actions.js pattern
[/<googleSearch>([\s\S]*?)<\/googleSearch>/s, async (match) => {
    const data = JSON.parse(match[1].trim());
    const results = await openkbs.googleSearch(data.query);
    return {
        type: 'SEARCH_RESULTS',
        data: results,
        _meta_actions: ["REQUEST_CHAT_MODEL"]  // Loop back to LLM
    };
}]

Meta Actions

Control flow after command execution:

  • ["REQUEST_CHAT_MODEL"] - Send result back to LLM for processing
  • [] - Display result to user, stop conversation

Memory System

Configure in settings.json:

{
  "itemTypes": {
    "memory": {
      "attributes": [
        { "attrName": "itemId", "attrType": "itemId", "encrypted": false },
        { "attrName": "body", "attrType": "body", "encrypted": true }
      ]
    }
  },
  "options": {
    "priorityItems": [{ "prefix": "memory_", "limit": 100 }]
  }
}

Priority items are auto-injected into LLM context.

Additional Resources

Reference Documentation
Ready-to-Use Patterns

Production-tested code blocks for common tasks:

Content & Media:

Memory & Storage:

Scheduling & Automation:

External Integrations:

Complete Examples

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!