触须 – 一种自我延伸的实体,能够构建并注册自己的工具。
Tendril – a self-extending agent that builds and registers its own tools

原始链接: https://github.com/serverless-dna/tendril

## 蔓藤:一种自扩展的自主代理沙箱 蔓藤是一个使用AWS Strands Agents SDK和Tauri构建的自主代理系统,展示了自主工具发现、创建和复用。其核心原则是:代理*构建*所需工具,而不是依赖预定义的集合。 你提供一个任务,蔓藤首先检查能力注册表。如果存在合适的工具,则执行它。否则,蔓藤会自主编写一个新的工具(使用TypeScript),注册它,然后执行它——所有这些都不需要你的提示。每次会话后,注册表都会增长,使后续交互更有效率。 该系统仅利用三个引导工具和一个能力注册表(存储为文件),由Bedrock模型(Claude)驱动的Strands代理管理。通信通过标准输入/输出上的JSON-RPC进行。 蔓藤的设计注重简单性和控制,提供了一个使用Tauri和React构建的桌面应用程序,以及一个用于代码执行的沙盒Deno环境。它有力地展示了代理如何能够随着时间的推移动态地适应和扩展其能力。

## 触须:一种自我扩展的AI代理 触须是一个新的代理框架,旨在解决“何时”使用AI工具的问题,而不仅仅是“它做什么”。由walmsles创建,它是“代理能力模式”的一个“参考实现”,从三个工具开始,并动态地构建更多工具。 重要的是,触须避免直接代码执行;代理*必须*在执行任何任务之前创建并注册具有明确调用条件的新的工具,从而构建跨会话的持久注册表。这强制对能力进行显式控制。 有趣的是,开发者用五个本地模型(Qwen3-8B、Gemma 4等)测试了触须,并且*没有一个*成功完成自我扩展循环。对这些失败的分析可在[https://serverlessdna.com/strands/ai-agents/agents-know-what...](https://serverlessdna.com/strands/ai-agents/agents-know-what...)找到。 该项目使用AWS Strands、TypeScript、Bedrock、Deno、Tauri和React构建。一位评论者提出了对失控自我扩展和潜在安全风险的担忧。
相关文章

原文

A self-extending agentic sandbox that demonstrates the Agent Capability pattern — where the model discovers, builds, and reuses tools autonomously across sessions.

Built with AWS Strands Agents SDK and Tauri.

You ask Tendril to do something. It checks its capability registry. If a tool exists, it uses it. If not, it writes one, registers it, and executes it — all without asking. Next time you need the same thing, the tool is already there.

You: "fetch the top stories from Hacker News"

Tendril:
  → searchCapabilities("fetch url hacker news")    # nothing found
  → registerCapability(fetch_url, code)             # builds a tool
  → execute("fetch_url", {url: "https://..."})      # runs it by name
  → "Here are the top stories: ..."

You: "now fetch Lobsters and compare"

Tendril:
  → listCapabilities()                              # found: fetch_url ✓
  → execute("fetch_url", {url: "https://lobste.rs"})# runs it — no rebuild

The registry grows with use. Every session is smarter than the last.

The core of Tendril is a Strands agent with three bootstrap tools. That's it — three tools to rule them all.

tendril-agent/src/
├── agent.ts              ← Agent configuration (Strands model + tools)
├── index.ts              ← Orchestrator — wires loop to transport
├── loop/                 ← The agentic loop
│   ├── tools.ts          ← 4 bootstrap tools in cycle order
│   ├── prompt.ts         ← System prompt (autonomous behaviour rules)
│   ├── registry.ts       ← Capability registry (index.json CRUD)
│   └── sandbox.ts        ← Deno subprocess execution with sandboxing
└── transport/            ← Conversation framing + stream observation
    ├── protocol.ts       ← ACP JSON-RPC over stdio
    ├── stream.ts         ← SDK events → loop phases (think/act/observe)
    └── errors.ts         ← Provider error classification

agent.ts — Creates the Strands agent with a Bedrock model and three tools:

import { Agent } from '@strands-agents/sdk';
import { BedrockModel } from '@strands-agents/sdk/models/bedrock';

const agent = new Agent({
  model: new BedrockModel({ modelId: '...', region: '...' }),
  systemPrompt: TENDRIL_SYSTEM_PROMPT(workspacePath),
  printer: nullPrinter,   // suppress SDK stdout — we own the protocol
  tools: [
    listCapabilities(registry),
    registerCapability(registry),
    executeCode(registry, workspacePath, config),
  ],
});

index.ts — Observes the agentic loop and bridges it to the ACP protocol:

// The agentic loop runs inside agent.stream().
// We observe each phase and forward to the UI.
for await (const event of agent.stream(userText)) {
  const { phase, event: e } = classifyEvent(event);
  switch (phase) {
    case 'think':   emitUpdate(handleThink(e));    break;  // text delta
    case 'act':     emitUpdate(handleAct(e));      break;  // tool call
    case 'observe': emitUpdate(handleObserve(e));  break;  // tool result
  }
}

loop/prompt.ts — The system prompt that makes the agent autonomous:

BEFORE acting on any request:
1. Call searchCapabilities(query) to check if a relevant tool exists
2. If found: call loadTool(name) then execute(code, args)
3. If NOT found: you MUST build the tool yourself.

RULES:
- NEVER ask "would you like me to create a tool?" — just build it.
- If a tool fails, read the error, fix the code, and retry.
- NEVER answer from training data when a tool could get live information.

The "too many tools" solution

Most agent frameworks give the model a big bag of tools and hope it picks the right one. Tendril inverts this — the model always sees exactly three tools. It searches a registry, builds what it needs, and the registry grows over time. The tool surface never changes; the capabilities do.

┌─────────────────────────────────────────┐
│ Tauri Shell (Rust)                      │
│                                         │
│  ACP Host ──stdin/stdout──► Agent       │
│  (acp.rs)    NDJSON        (Node.js SEA)│
│     │                         │         │
│  Events  ◄── session/update ──┘         │
│  (events.rs)                            │
│     │                                   │
│  Tauri Events ──►  React Frontend       │
│                    (TailwindCSS v4)     │
└─────────────────────────────────────────┘

Agent internals:
  Strands SDK ── BedrockModel ── Claude
       │
  4 bootstrap tools
       │
  ┌────┴────┐
  │ Registry │ ←→ index.json + tools/*.ts
  └─────────┘
       │
  ┌────┴────┐
  │ Sandbox  │ ←→ Deno subprocess (scoped permissions)
  └─────────┘

Communication: JSON-RPC 2.0 over NDJSON (newline-delimited JSON) on stdin/stdout. The agent is a standalone process — the Tauri host spawns it as a sidecar.

Protocol: Implements the Agent Integrator Specification (ACP) — the same protocol used by Claude Code and similar agent hosts.

Component Technology
Desktop shell Tauri 2.x (Rust)
Frontend React 18 + TailwindCSS v4
Agent TypeScript (Node.js SEA binary)
Agent framework @strands-agents/sdk
Inference AWS Bedrock (Claude via Strands BedrockModel)
Code sandbox Deno (bundled, subprocess with permission flags)
Protocol JSON-RPC 2.0 / NDJSON over stdio
  • Node.js 22+ (for building the agent)
  • Rust toolchain (for Tauri)
  • AWS credentials configured for Bedrock access (~/.aws/credentials)
git clone https://github.com/serverless-dna/tendril.git
cd tendril
make dev

This will:

  1. Install dependencies (npm install for agent and UI)
  2. Build the agent (esbuild bundle)
  3. Download Deno (bundled as sidecar)
  4. Create sidecar shims with platform triple
  5. Launch Tauri dev mode

On first launch, pick a workspace folder. Configure your AWS profile and model in Settings.

All settings live at ~/.tendril/config.json:

{
  "workspace": "/Users/you/tendril-workspace",
  "model": {
    "provider": "bedrock",
    "modelId": "us.anthropic.claude-sonnet-4-5-20250514",
    "region": "us-east-1",
    "profile": "your-aws-profile"
  },
  "sandbox": {
    "denoPath": "deno",
    "timeoutMs": 45000,
    "allowedDomains": []
  },
  "agent": {
    "maxTurns": 100
  }
}

allowedDomains: empty = unrestricted network. Set ["api.example.com"] to restrict.

Capabilities are stored in the workspace as plain files:

~/tendril-workspace/
  index.json          ← registry (name, triggers, suppression rules)
  tools/
    fetch_url.ts      ← tool implementation (TypeScript, runs in Deno)
    summarize_text.ts
    parse_json.ts

Each capability has:

  • name: snake_case identifier
  • capability: one-sentence description
  • triggers: conversational signals that should invoke it
  • suppression: conditions that prevent invocation

The model writes these definitions. You can inspect, edit, or delete them — they're just files.

make dev       Build agent + sidecars, launch Tauri dev
make build     Build agent (esbuild bundle)
make test      Run agent tests (vitest)
make lint      tsc --noEmit + cargo clippy
make fmt       cargo fmt --check
make check     Full quality gate (fmt + lint + test)
make release   Quality gate + cargo tauri build
make clean     Remove all build artifacts
tendril/
  tendril-agent/        TypeScript Strands sidecar
    src/                Agent source (see "The Agent Loop" above)
    tests/              vitest tests
    package.json
    sea-config.json     Node.js SEA build config

  tendril-ui/           Tauri + React desktop app
    src/                React components + hooks
    src-tauri/          Rust backend (ACP host, event forwarding)
    package.json

  docs/                 Specs and reference implementations
  specs/                Feature specifications and plans
  Makefile

MIT

联系我们 contact @ memedata.com