agent-runtime

智能体运行时系统。整合工具注册、权限控制、Hook拦截、上下文压缩、Usage追踪的完整Agent运行时。 当用户说"创建Agent"、"运行Agent"、"Agent Runtime"、"子代理"时触发。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "agent-runtime" with this command: npx skills add agent-runtime

Agent Runtime - 智能体运行时系统

核心架构

用户消息
    ↓
┌─────────────────────────────────────┐
│         Agent Runtime               │
│                                     │
│  ┌───────────┐  ┌──────────────┐   │
│  │ ToolReg  │  │ Permission   │   │
│  │ (注册表) │  │ (权限控制)   │   │
│  └─────┬─────┘  └──────┬───────┘   │
│        ↓                ↓           │
│  ┌─────▼─────────────────────────┐  │
│  │      Hook Runner             │  │
│  │  [PreToolUse] → [PostTool]  │  │
│  └─────┬─────────────────────────┘  │
│        ↓                            │
│  ┌─────▼─────┐                     │
│  │  Executor │ (工具执行器)        │
│  └─────┬─────┘                     │
│        ↓                            │
│  ┌─────▼──────┐  ┌──────────────┐  │
│  │ Compactor  │  │ UsageTracker│  │
│  │ (压缩)     │  │ (追踪)      │  │
│  └────────────┘  └──────────────┘  │
└─────────────────────────────────────┘
    ↓
返回结果

组件说明

组件作用
ToolRegistry工具注册、搜索、路由
PermissionPolicy权限级别控制
HookRunnerPreToolUse/PostToolUse 拦截
SessionCompactor上下文压缩
UsageTrackerToken 使用统计

子代理类型

const AgentType = {
  EXPLORE: 'explore',      // 文件探索(只读)
  PLAN: 'plan',            // 规划分析
  VERIFICATION: 'verify',   // 验证测试
  GENERAL: 'general'       // 通用任务
};

使用示例

import { AgentRuntime } from './scripts/agent-runtime.mjs';

// 创建运行时
const agent = new AgentRuntime({
  agentType: 'explore',    // 默认代理类型
  maxTokens: 100000,
  maxTurns: 50
});

// 注册工具
agent.registry.register({
  name: 'read_file',
  execute: async (ctx, input) => { /* ... */ }
});

// 添加 Hook
agent.addHook('pre', 'read_file', async (tool, input) => {
  console.log(`Reading: ${input.path}`);
});

// 运行对话
const result = await agent.run('读取根目录的 README.md');
console.log(result.output);
console.log(result.usage);

文件结构

agent-runtime/
├── SKILL.md              # 本文件
└── scripts/
    └── agent-runtime.mjs # 核心实现

龙虾王子自我进化的成果 🦞

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

三只虾协作系统

三只虾协作系统是基于多agent的任务分配、实时监控和自动通知框架,支持角色分工和心跳检测,实现任务高效协同。

Registry SourceRecently Updated
2550Profile unavailable
Automation

Mobayilo Voice (Beta)

Place outbound phone calls via Mobayilo with safe defaults (preview mode by default) and explicit live execution.

Registry SourceRecently Updated
3900Profile unavailable
Automation

Create SubAgent

创建和管理 SubAgent(子智能体)。使用当用户需要:(1) 创建新的 SubAgent 执行特定任务,(2) 查看/管理已有的 SubAgent,(3) 终止或指导 SubAgent。支持多种预设类型:开发、研究、写作、数据分析等。

Registry SourceRecently Updated
3930Profile unavailable
Automation

Agent Builder Plus

Build high-performing OpenClaw agents end-to-end with comprehensive safety features. Use when you want to design a new agent (persona + operating rules) and...

Registry SourceRecently Updated
4630Profile unavailable