三只貓
Rich Mindset Zone
richmindsetzone.com
← All posts

2026 Agent 生態終極選型指南:框架 x 記憶 x 治理 x 安全

2026 年嘅 Agent 生態,唔係 framework 太多,而係啲 framework 嘅設計假設完全唔同,夾硬用一個框架做晒所有嘢嘅時代已經完咗。今日你見到嘅 Cordum、Deco、Statewave、Knowhere 呢四個,背後代表四種完全唔同嘅取捨哲學。揀錯 framework 唔係 code 重寫咁簡單,而係成個系統嘅記憶模型、治理模型、安全模型要連根拔起。呢篇文用一個香港 indie hacker 嘅視角,將呢四套框架嘅核心 trade-off 拆開,再同你講記憶系統、多 Agent 治理同安全威脅要點樣一齊諗。

四個框架嘅核心取捨

Cordum 係典型嘅「語意協調型」框架,佢假設 Agent 之間用自然語言溝通就得,唔需要 rigid schema。呢個 approach 嘅好處係靈活,你可以好快將唔同嘅 LLM provider 甚至係 rule-based bot 拉埋一齊砌。但代價係 predictability 大跌——你永遠唔知一個 agent 嘅 output 會俾下一個 agent 點樣解讀,成個 pipeline 嘅行為係 probabilistic 嘅。適合 prototyping、內容生成 pipeline、或者你需要大量 heterogeneous agent 快速整合嘅場景。

Deco 行另一條路:declarative orchestration。你用 YAML 或者 JSON 定義成個 workflow,每個 step 嘅 input/output schema 係硬性規定。呢度冇 magic,冇 LLM 幫你「推斷」下一步。好處係你做到 deterministic execution,適合生產環境、金流相關、或者任何你需要 audit trail 嘅場景。壞處?改動成本高,每次加一個新 agent 你要改 schema、改 validation、改 error handling。Deco 係俾你寫 production code 嘅,唔係俾你玩嘅。

Statewave 嘅核心抽象係「state as a stream」。佢唔係 agent framework 咁簡單,而係一個 state management layer 俾 multi-agent system。每一個 agent 係一個 state transformer,system 嘅 global state 係一個 append-only log。呢個 design 嘅威力在於你做到 time travel debugging、完全 replayable execution、同埋 natural support for long-running agents。但學習曲線係四個之中最斜嘅——你要用佢嘅 DSL 寫 state transition,唔係就咁寫 prompt 就算。適合複雜決策系統、金融 trading agent、或者任何需要 strong consistency 嘅場景。

Knowhere 係最「agent-native」嘅一個:佢將知識圖譜做 first-class citizen。每個 agent 唔單止有 memory,仲有 explicit knowledge graph,agent 之間 share 一個 global KG,query 用類似 SPARQL 嘅嘢。呢個 design 嘅 insight 係:大部份 multi-agent 嘅溝通問題,本質上係 knowledge alignment 問題。如果你兩個 agent 對同一件事嘅理解唔一致,你點迫佢哋 natural language chat 都冇用。Knowhere 強在 semantic precision,弱在 onboarding 成本——你要先 define ontology,先可以開始寫 agent。

揀框架嘅第一個原則是:你嘅 bottleneck 係邊度?係 coordination unpredictability(揀 Cordum)、determinism(揀 Deco)、state consistency(揀 Statewave)、定係 knowledge alignment(揀 Knowhere)。冇一個框架係「最好」,得「最適合你當下嘅 bottleneck」。

記憶系統:被低估嘅架構決策

2026 年嘅一個殘酷現實係:大部份 agent 系統嘅失敗唔係因為 LLM 唔夠聰明,而係因為 memory 設計得差。你嘅 agent 記唔住上一輪講過乜、記唔住用戶 preference、記唔住邊個 action 已經試過失敗——咁你再聰明嘅 agent 都係徒然。

Cordum 嘅 memory 係 implicit 嘅,靠 conversation history 同埋 vector store。好處係你唔使諗太多,壞處係 context window 遲早爆,而且 retrieval 嘅 relevancy 你控制唔到。Deco 強制你 define explicit memory schema,每個 step 嘅 state 係 typed 嘅,你可以精準控制咩嘢 persist 咩嘢唔 persist。Statewave 嘅 append-only log 本身就係 memory——你唔使另外整一個 memory system,但 query historical state 要用佢嘅 DSL。Knowhere 嘅 knowledge graph 係最 structured 嘅 memory,但你要維護 ontology 嘅 evolution,agent 嘅 schema 改咗舊 data 要點 migrate 係一個大問題。

實戰建議:如果你的 agent 要做超過 5 輪對話,或者要跨 session 記住用戶嘢,唔好靠 LLM 嘅 context window。用 Deco 嘅 typed memory 或者 Statewave 嘅 state stream 做 source of truth,vector store 只做 fast retrieval cache。Reasoning 嘅結果可以擺落 KG,但你要接受 KG 嘅 maintenance cost。

另外一個好多人忽略嘅點:memory 嘅 access control。2026 年多 agent 系統行緊,Agent A 產生嘅 memory Agent B 係咪可以直接 read?你嘅記憶系統如果冇 row-level permission,好快會出現 data leak。Cordum 預設係冇嘅,Deco 你可以自己砌 middleware,Statewave 有 built-in authorization on state transitions,Knowhere 嘅 KG 可以做 subgraph-level permission。呢度冇 silver bullet,但你要 awareness。

多 Agent 治理:唔好當佢係 microservice

多 Agent 治理係 2026 年最被低估嘅問題。大部份人將 multi-agent 當做 microservice 咁 design,結果死得好慘。Microservice 嘅假設係每個 service 有 deterministic behavior,你可以用 circuit breaker、retry、timeout 嚟 handle failure。但 agent 係 non-deterministic 嘅,同一 prompt 可以出唔同 result,你可以 retry 但 retry 嘅 result 可能完全唔同。

Cordum 嘅治理模型係「相信 agent 嘅 natural language 協調能力」,你俾 agent 自己 negotiate 下一步做咩。呢個做法喺 low-stakes scenario 係 ok 嘅,但當你嘅 system 涉及到落 order、找錢、或者影響用戶數據,你唔可以 rely on agent 自己傾。Deco 嘅 declarative orchestration 本身就係 governance——你 define 咗邊個 agent 可以做咩,喺咩條件下做,error 嘅時候 fallback 去邊。Statewave 嘅 governance 係 level 上嘅:你可以定義唔同 level 嘅 state transition 需要唔同程度嘅 approval。Knowhere 嘅 governance 係 graph 上嘅:你可以 set subgraph 嘅 write permission,agent 要 query 某啲 knowledge 之前要過 authorization layer。

對於香港開發者嚟講,如果你做嘅係 consumer-facing product,用戶對 AI 做錯嘢嘅 tolerance 好低。一個 agent 俾錯 recommendation 唔單止係 UX 問題,係 trust 問題。我建議至少用 Deco 或者 Statewave 嘅 level 做 governance layer,Cordum 可以留俾 internal tooling 或者 content generation 呢啲低風險場景。Knowhere 適合 domain-specific 嘅 system,例如醫療、法律、金融,你需要 semantic precision 多過 execution speed。

仲有一個 practical 嘅 tip:用 supervisor agent pattern。唔好俾啲 worker agent 直接 access 外界 API,全部經一個 supervisor。Supervisor 負責 logging、rate limiting、output validation。呢個 pattern 唔係新嘢,但係 agent 世界入面好多人貪快 skip 咗,然後出事。

安全威脅模型:Agent 安全同傳統 Web 安全完全唔同

2026 年 agent security 已經唔係理論問題——prompt injection 喺多 agent 系統入面會變成 cross-agent injection,即係你攻陷一個 agent,佢會用自然語言傳播 payload 去第二個 agent。呢個攻擊向量喺傳統 web security 入面係冇嘅,因為傳統 system 嘅 component 之間唔會用 natural language 溝通。

Cordum 喺呢方面最脆弱——佢嘅 agent 之間嘅溝通係 unstructured natural language,你根本 detect 唔到邊句 prompt 係正常 instruction 邊句係 injection。Deco 因為 schema 係 typed,你 least 可以 validate input/output 嘅 shape,但 prompt-level 嘅 injection 仍然防唔到。Statewave 嘅 state stream 有一個好處:你可以 replay 成個 execution trace 去 forensic analysis,但 detection 仍然要你自己砌。Knowhere 嘅 KG query language 係 structured 嘅,injection 嘅 surface area 細好多,但佢嘅自然語言 interface 仍然係攻擊點。

實戰 actionable advice:

第一,所有 agent 嘅 input 同 output 都要過一個 content security filter,唔好信任何自然語言。第二,用 Deco 或者 Statewave 嘅 typed interface 減少 unstructured data 嘅流動。第三,deploy 一個 anomaly detection agent,專門監控其他 agent 嘅 behavior pattern,detect 到異常嘅 message frequency 或者 content pattern 就自動 isolate。第四,Knowhere 嘅 KG 最好做 read-only default,agent 要 write 嘅時候要經過 approval。

對於香港團隊嚟講,如果你嘅 agent system 處理任何用戶數據或者金流,2026 年你應該要做嘅最基本嘢係:每個 agent 行喺獨立嘅 container/sandbox 入面,network 層面嘅 communication 要經過一個 API gateway,而唔係直接 P2P。呢個 infrastructure overhead 唔細,但係喺而家嘅 threat landscape 入面,唔做就係不負責任。

點樣夾埋一齊用

到最後,你會發現真正嘅問題唔係「揀邊個 framework」,而係「點樣將呢啲嘢砌埋一齊」。我見到愈來愈多 production system 係 hybrid 嘅:用 Cordum 做 user-facing conversation layer,用 Deco 做 execution orchestration,用 Statewave 做 state management,用 Knowhere 做 knowledge layer。呢個 stack 聽落複雜,但每一層解決嘅問題唔同,你唔會想用一個 framework 勉強做晒所有嘢。

2026 年嘅 Agent 開發者有一個責任:唔好俾 hype 帶住走。每一個 abstraction 都係 trade-off,每一個 framework 都係一組假設。你要知道自己做緊嘅 system 嘅 bottleneck 係邊度,然後揀一個放大你優勢、減輕你痛苦嘅組合。唔好因為某 framework 最多 stars 就用佢,都唔好因為某 framework 最 minimal 就覺得係最好。

If I were starting a new agent project today in Hong Kong, I’d spend the first week just defining my memory model and governance model before writing a single line of agent code. The framework is the last decision, not the first.