Knot 智能体平台

Knot是一个AI-native智能体平台,核心创新在于取消传统Agent中央Loop,以append-only Journal作为唯一运行时事实源。插件通过事件协议订阅/写入Journal,实现完全解耦;模型仅是众多内容来源之一。其架构支持Android助手、Coding Agent等多场景,采用Go+容器化技术栈,提供Standalone/Cluster/Leaf三种部署模式,并通过Scriptling脚本语言与分层执行环境保障安全边界。

“Knot”这个名字在智能体语境下并不对应单一产品,至少存在三个互不相关的同名项目。其中与你此前讨论的 DSH 在架构哲学上形成直接对话关系的,是 getknot.dev 所代表的 Knot——一个以“没有中央 AgentLoop”为核心主张的智能体运行时与实验平台。以下围绕这一项目展开,并在末尾厘清其他同名项目以避免混淆。


一、问题意识:Loop 的膨胀与 Knot 的回应

DSH 的做法是把 Loop 拆成插件——主循环仍然存在,只是它的组装、参数和错误处理可以被替换。Knot 选择了更彻底的一条路:取消中央 Loop 本身。

它的诊断是:一个 Agent 的 Loop 从“构造上下文→调用模型→执行工具→交还结果”这个简单结构开始,随后记忆、审批、权限、压缩、重试、子 Agent、会话恢复、UI 逐一挤进同一个循环,中央流程越来越了解每一个组件,新业务逻辑越来越难以独立修改。DSH 的回应是让 Loop 可插件化;Knot 的回应是让 Loop 消失,让事件协议取代它。

二、核心机制:Journal 作为唯一的运行时事实

Knot 的全部设计围绕一个 append-only 的Journal 展开。它不是一个事后供人查看的 trace,而是参与运行本身:模型从中投影上下文,插件从中恢复状态,工具的结果写回其中,UI 和 todo 从中派生。

一条典型的 Android 助手轨迹看起来像一个完整的 AgentLoop:

user.message → context.dynamic → content.request → llm.request
→ llm.invoke → llm.generated → tool.call → tool.result
→ llm.request → … → assistant.message

但这些箭头没有被写在任何中央内核里。Context 插件响应用户消息,工具插件响应 tool.call,Flow 插件读取 tool.result 决定是否发起下一次 llm.request——每个插件只订阅自己关心的事件类型,完成职责后追加新事件或保持沉默。当本轮不再产生新事件时,Journal drain 进入空闲状态,Agent 的“一轮”自然结束。

一个插件甚至不需要认识另一个插件:

const reply = journal => {
  journal.subscribe('user.message', event => {
    journal.append('assistant.message', { content: `You said: ${event.data.content}` })
  })
}
const print = journal => {
  journal.subscribe('assistant.message', event => {
    process.stdout.write(`${event.data.content}\n`)
  })
}

reply 没有调用 print,print 也不知道 reply 存在。协议取代了调用依赖:Tool 只需要理解 tool.call、产出 tool.result,谁继续处理结果不是 Tool 需要关心的事。

这一设计的直接后果是模型不再是必经的控制中心。规则、分类器、小模型、普通程序、甚至人类,都可以在 Journal 上留下下一条事实来推动运行——LLM 只是众多“内容来源”之一。

三、架构代价与边界:谁拥有流程的“形状”?

取消中央 Loop 的代价是流程的可理解性从代码转移到了装配关系。Knot 的应对方式是:内核极小(公开版本中 Journal 内核仅 56 行),所有流程语义由插件组合决定,同一个内核通过装配不同的插件、工具、上下文和执行环境来支撑不同场景——Android 终端助手、Coding Agent、业务与个人助理共享同一套事件机制。

在 Coding Agent 场景(CASE2)中,“Coding 专属 Loop”同样不存在。CodingFlow 只在需要继续推理或完成任务时响应相应事实;Subagent 只是另一个拥有独立 Journal、模型配置和工作目录的 Session,父 Agent 通过 tool.result 接收它返回的摘要。这与 DSH 的 spawn 在效果上相近——上下文隔离、结果回传——但实现路径不同:DSH 依赖运行时显式 spawn 一个带 Preset 的子 Agent,Knot 依赖“另一个 Journal + 同一套事件协议”。

但这里有一个需要正视的边界:当没有中央 Loop 时,“当前这一轮应该继续还是结束”的判断权被分散到了各个 Flow 插件手中。Knot 用 Journal drain 作为空闲信号来终止一轮,这在短上下文终端控制场景中表现良好(CASE1 USB 真机连续 66 次请求中 65 次命中预期工具路径,未捕获异常为 0),但在开放式 Coding 工作流中,父子 Journal 的上下文组织、工具结果预算和推理成本仍是未解决的问题。事件的彻底解耦让行为可组合,但也让“为什么这一轮停下来了”的调试路径变长——它不再对应一段可以单步执行的循环代码,而是对应一组插件对事件流的不同响应模式的叠加。

四、技术栈与工程形态

Knot 的公开实现是 Go + 容器化 Space 的结构,与 DSH 的 TypeScript/Node 全栈形成对照。

服务端是单一的 Go 二进制,提供 Web UI、API 和资源管理。Agent 运行在容器内,通过 SSH/终端与 Server 通信,管理 Space 的生命周期。数据库支持 BadgerDB(嵌入式)、MariaDB 和 Redis,容器运行时支持 Docker、Podman、Nomad 和 Apple Container。

部署模式分三档:Standalone(单服务器 + 本地容器,适合小团队和开发测试);Cluster(多 Server 无 leader 设计,各节点持有自己的数据库,通过 gossip 协议同步变更);Leaf(本地节点连接中心集群,保留本地存储和执行以降低延迟,同时接受中心模板管理)。

脚本层基于 Scriptling(类 Python 语言),提供四种执行环境,安全边界逐层收紧:Local(knot run-script,完整主机访问);MCP(AI 工具脚本,os / pathlib / subprocess / sys 等系统访问库被移除,库仅从服务器获取);Remote(Space 容器内,容器级隔离);External(独立的 Scriptling 运行时)。这一设计将“AI 能调用的脚本”和“人类能执行的脚本”放在同一语言下,但用执行环境的库可用性来强制区分权限边界,而不是依赖脚本自身的声明。

五、与其他“Knot”的区分

项目性质关键特征
getknot.dev / liz-public/knot-agent无中央 Loop 的 Agent 运行时与实验平台Journal 内核 + 事件驱动插件,本文讨论对象
腾讯 Knot内部试用的 AI 任务助手自然语言任务指派,“需求—任务”衔接,探索性产品
raultov/knotRust 代码库索引器 / MCP Server向量 + 图数据库,为编码 Agent 提供代码库语义导航
paularlott/knot(getknot.dev 的服务端实现)Go 开发环境管理平台容器化 Space、MCP 聊天、Scriptling 脚本

需要说明的是,getknot.dev 的文档中同时存在“开发环境管理”和“Agent 运行时”两条产品线,二者共享 Go 服务端和 Space 容器基础设施,但“无中央 Loop 的 Journal 运行时”是 liz-public/knot-agent 这一独立公开仓库所阐述的架构主张,其插件公共接口和实验能力仍在演进中(Alpha 阶段)。如果讨论的是腾讯内部的 Knot 任务助手,目前仅有“自然语言发起任务指派”的有限公开信息,尚无架构层面的技术细节可供展开。

一句话概括 Knot(无 Loop 版本)与 DSH 的关系:DSH 保留了 Loop,但把它变成可替换的插件;Knot 取消了 Loop,让事件流本身成为运行时。两者都把“状态”交给 append-only 日志,都把“能力”交给插件装配,区别在于流程的形状是被写在可替换的 Loop 代码里,还是被写在 Journal 上谁响应什么事件的订阅关系里。前者更容易被单步调试,后者在理论上对“非模型驱动”的异构参与者更加中立——代价是“这一轮为什么这样走”从一个代码问题变成了一个装配问题。

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BlueSea 每日coding

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址