ltcai 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +140 -589
  2. package/auto_setup.py +17 -17
  3. package/docs/CHANGELOG.md +99 -0
  4. package/docs/MULTI_AGENT_RUNTIME.md +23 -5
  5. package/docs/PLUGIN_SDK.md +21 -8
  6. package/docs/REALTIME_COLLABORATION.md +19 -6
  7. package/docs/V2_ARCHITECTURE.md +65 -33
  8. package/docs/WORKFLOW_DESIGNER.md +18 -8
  9. package/docs/architecture.md +127 -135
  10. package/docs/kg-schema.md +3 -3
  11. package/docs/public-deploy.md +2 -3
  12. package/knowledge_graph.py +2 -2
  13. package/latticeai/__init__.py +1 -1
  14. package/latticeai/api/agents.py +57 -1
  15. package/latticeai/api/marketplace.py +81 -0
  16. package/latticeai/api/models.py +8 -0
  17. package/latticeai/api/plugins.py +1 -1
  18. package/latticeai/api/realtime.py +1 -1
  19. package/latticeai/api/workflow_designer.py +10 -1
  20. package/latticeai/core/config.py +1 -1
  21. package/latticeai/core/graph_curator.py +2 -2
  22. package/latticeai/core/marketplace.py +178 -0
  23. package/latticeai/core/model_compat.py +7 -63
  24. package/latticeai/core/model_resolution.py +1 -1
  25. package/latticeai/core/multi_agent.py +359 -68
  26. package/latticeai/core/plugins.py +29 -13
  27. package/latticeai/core/realtime.py +1 -1
  28. package/latticeai/core/workflow_engine.py +1 -1
  29. package/latticeai/core/workspace_os.py +257 -10
  30. package/latticeai/server_app.py +17 -5
  31. package/latticeai/services/model_catalog.py +105 -153
  32. package/latticeai/services/model_recommendation.py +28 -17
  33. package/latticeai/services/model_runtime.py +2 -2
  34. package/latticeai/services/platform_runtime.py +9 -5
  35. package/llm_router.py +80 -92
  36. package/ltcai_cli.py +2 -3
  37. package/package.json +2 -2
  38. package/static/agents.html +47 -3
  39. package/static/chat.html +5 -6
  40. package/static/plugins.html +51 -0
  41. package/static/scripts/chat.js +34 -36
  42. package/static/workflows.html +22 -0
  43. package/static/workspace.html +1 -1
  44. package/telegram_bot.py +1 -1
package/auto_setup.py CHANGED
@@ -443,8 +443,6 @@ class Recommendation:
443
443
  _MODEL_CATALOG: List[Dict[str, Any]] = [
444
444
  # (min_ram_mb, min_vram_mb, model_id, quant, runtime_preference)
445
445
  # OS 오버헤드(~4-6 GB) + KV 캐시 여유를 감안한 보수적 RAM 임계값
446
- {"ram": 128 * 1024, "vram": 48 * 1024,
447
- "id": "mlx-community/gpt-oss-120b-MXFP4-Q4", "q": "mxfp4", "multimodal": False},
448
446
  {"ram": 64 * 1024, "vram": 32 * 1024,
449
447
  "id": "mlx-community/gemma-4-31b-it-4bit", "q": "4bit", "multimodal": True},
450
448
  {"ram": 64 * 1024, "vram": 32 * 1024,
@@ -452,9 +450,13 @@ _MODEL_CATALOG: List[Dict[str, Any]] = [
452
450
  {"ram": 48 * 1024, "vram": 24 * 1024,
453
451
  "id": "mlx-community/gemma-4-31b-it-4bit", "q": "4bit", "multimodal": True},
454
452
  {"ram": 32 * 1024, "vram": 16 * 1024,
455
- "id": "mlx-community/gpt-oss-20b-MXFP4-Q8", "q": "mxfp4", "multimodal": False},
453
+ "id": "mlx-community/gemma-4-26b-a4b-it-4bit", "q": "4bit", "multimodal": True},
456
454
  {"ram": 48 * 1024, "vram": 24 * 1024,
457
455
  "id": "Qwen/Qwen3-VL-30B-A3B-Instruct", "q": "q4_K_M", "multimodal": True},
456
+ {"ram": 24 * 1024, "vram": 12 * 1024,
457
+ "id": "mlx-community/Llama-4-Scout-17B-16E-Instruct-4bit", "q": "4bit", "multimodal": True},
458
+ {"ram": 16 * 1024, "vram": 8 * 1024,
459
+ "id": "mlx-community/gemma-4-12b-it-4bit", "q": "4bit", "multimodal": True},
458
460
  {"ram": 32 * 1024, "vram": 16 * 1024,
459
461
  "id": "Qwen/Qwen3-VL-8B-Instruct", "q": "q5_K_M", "multimodal": True},
460
462
  {"ram": 24 * 1024, "vram": 12 * 1024,
@@ -466,7 +468,7 @@ _MODEL_CATALOG: List[Dict[str, Any]] = [
466
468
  {"ram": 8 * 1024, "vram": 4 * 1024,
467
469
  "id": "Qwen/Qwen3-VL-4B-Instruct", "q": "q4_K_M", "multimodal": True},
468
470
  {"ram": 4 * 1024, "vram": 0,
469
- "id": "google/gemma-3-1b-it", "q": "q4_K_M", "multimodal": False},
471
+ "id": "Qwen/Qwen3-VL-4B-Instruct", "q": "q4_K_M", "multimodal": True},
470
472
  ]
471
473
 
472
474
 
@@ -477,8 +479,8 @@ def recommend(profile: SystemProfile) -> Recommendation:
477
479
  # backend / runtime
478
480
  if profile.os == "darwin" and profile.gpu.vendor == "apple":
479
481
  backend = "metal+mlx"
480
- runtime = "mlx" if _has_module("mlx") else "llama.cpp"
481
- rationale.append("Apple Silicon → Metal + MLX")
482
+ runtime = "mlx" if _has_module("mlx_vlm") else "llama.cpp"
483
+ rationale.append("Apple Silicon → Metal + MLX-VLM")
482
484
  elif profile.gpu.vendor == "nvidia" and profile.cuda_available and (profile.os == "linux" or profile.is_wsl):
483
485
  backend = "cuda"
484
486
  runtime = "vllm" if profile.gpu.vram_mb >= 12 * 1024 else "llama.cpp"
@@ -612,10 +614,10 @@ def plan(profile: SystemProfile, rec: Recommendation) -> InstallPlan:
612
614
  need("node20", "VSCode 확장 / npm CLI 부트스트랩에 필요")
613
615
 
614
616
  # 런타임별 추가
615
- if rec.runtime == "mlx" and not _has_module("mlx_lm"):
617
+ if rec.runtime == "mlx" and not _has_module("mlx_vlm"):
616
618
  steps.append(InstallStep(
617
- name="mlx-lm", why="Apple Silicon LLM 추론",
618
- command=["pip3", "install", "--upgrade", "mlx-lm"],
619
+ name="mlx-vlm", why="Apple Silicon 멀티모달 추론",
620
+ command=["pip3", "install", "--upgrade", "mlx-vlm"],
619
621
  ))
620
622
  if rec.runtime in {"llama.cpp", "ollama"} and not _which("ollama"):
621
623
  need("ollama", "llama.cpp 가중치를 가장 쉽게 받는 경로")
@@ -638,18 +640,16 @@ def plan(profile: SystemProfile, rec: Recommendation) -> InstallPlan:
638
640
  model_command = ["huggingface-cli", "download", rec.model_id, "--quiet"]
639
641
  if rec.runtime == "ollama":
640
642
  lower = rec.model_id.lower()
641
- if "gpt-oss-120b" in lower:
642
- model_command = ["ollama", "pull", "gpt-oss:120b"]
643
- elif "gpt-oss-20b" in lower:
644
- model_command = ["ollama", "pull", "gpt-oss:20b"]
645
- elif "gemma-4-31b" in lower:
643
+ if "gemma-4-31b" in lower:
646
644
  model_command = ["ollama", "pull", "hf.co/ggml-org/gemma-4-31B-it-GGUF:Q4_K_M"]
645
+ elif "gemma-4-12b" in lower:
646
+ model_command = ["ollama", "pull", "hf.co/ggml-org/gemma-4-12B-it-GGUF:Q4_K_M"]
647
+ elif "llama-4-scout" in lower:
648
+ model_command = ["ollama", "pull", "hf.co/ggml-org/Llama-4-Scout-17B-16E-Instruct-GGUF:Q4_K_M"]
647
649
  elif "qwen3-vl-8b" in lower:
648
650
  model_command = ["ollama", "pull", "qwen3-vl:8b"]
649
651
  elif "qwen3-vl-4b" in lower:
650
652
  model_command = ["ollama", "pull", "qwen3-vl:4b"]
651
- elif "gemma-3-1b" in lower:
652
- model_command = ["ollama", "pull", "gemma3:1b"]
653
653
  elif rec.runtime == "lmstudio":
654
654
  model_command = ["lms", "get", rec.model_id]
655
655
  steps.append(InstallStep(
@@ -696,7 +696,7 @@ def verify(profile: SystemProfile, rec: Recommendation) -> Dict[str, Any]:
696
696
  f"{profile.disk_free_mb} MB free")
697
697
 
698
698
  if rec.runtime == "mlx":
699
- add("mlx_lm import", _has_module("mlx_lm"), "Apple Silicon 런타임")
699
+ add("mlx_vlm import", _has_module("mlx_vlm"), "Apple Silicon 멀티모달 런타임")
700
700
  if rec.runtime in {"llama.cpp", "ollama"}:
701
701
  add("ollama binary", _which("ollama") is not None,
702
702
  _which("ollama") or "not found")
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,104 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.0] - 2026-06-04
4
+
5
+ > Multimodal-First Knowledge OS Release — Lattice AI is aligned around the
6
+ > Knowledge Graph, multimodal inputs, source disclosure, and Gemma-4-first model
7
+ > recommendations.
8
+
9
+ ### Added
10
+
11
+ - **Source disclosure metadata** — recommended model catalog entries now include
12
+ maker country, maker company, execution method, internet requirement, and
13
+ model name.
14
+ - **Principle documents** — added root-level `PROJECT_PRINCIPLES.md`,
15
+ `AI_PHILOSOPHY.md`, `MODEL_POLICY.md`, `KNOWLEDGE_GRAPH.md`,
16
+ `RELEASE_NOTES.md`, `ARCHITECTURE.md`, and `CHANGELOG.md`.
17
+ - **Gemma-4 default path** — default local model configuration and recommendation
18
+ aliases now center on Gemma 4 12B/31B multimodal models.
19
+
20
+ ### Changed
21
+
22
+ - **README / architecture rewrite** — current docs now describe Lattice AI as an
23
+ AI Knowledge OS rather than a chat app or model launcher.
24
+ - **Multimodal recommendation logic** — local recommendation catalogs and setup
25
+ flows use current multimodal model families only: Gemma 4, Qwen3-VL, and
26
+ Llama 4.
27
+ - **Mode language** — basic and advanced modes are feature-equivalent and differ
28
+ by explanation level; admin mode remains the authority boundary.
29
+ - **Runtime policy** — Apple Silicon local execution now checks MLX-VLM instead
30
+ of MLX-LM.
31
+ - **Version sync** — Python package, npm package, VS Code extension, Workspace
32
+ OS, runtime constants, FastAPI app, and `/health` metadata aligned at `2.2.0`.
33
+
34
+ ### Removed
35
+
36
+ - MLX-LM as a current local text-only recommendation/install path.
37
+ - Text-only low-spec fallback recommendations.
38
+ - Current recommendation entries for Gemma 2, Gemma 3, Qwen2.5-VL, SmolLM,
39
+ Phi, Mistral, DeepSeek, GPT-OSS, and Llama 3.x.
40
+
41
+ ### Validation
42
+
43
+ - Unit tests added/updated for multimodal catalog policy, source metadata,
44
+ Gemma-4 aliases, and version metadata.
45
+ - Package-store publishing remains manual; release artifacts are version-scoped
46
+ and must use exact filenames.
47
+
48
+ ## [2.1.0] - 2026-06-01
49
+
50
+ > Agent Platform Maturity Release — v2.1 operationalizes the v2.0 platform
51
+ > without redesigning it. Agent handoff, context packets, review/retry loops,
52
+ > timeline replay, memory snapshots, planning records, marketplace templates,
53
+ > and realtime execution observability are now first-class and additive.
54
+
55
+ ### Added
56
+
57
+ - **Explicit agent handoff** — handoff records now include `handoff_id`,
58
+ source/target agent ids, reason, task summary, context packet, status, and
59
+ timestamps. Handoffs are workspace-scoped, persisted, inspectable, and replayable.
60
+ - **Agent context packets** — structured transfer packets include objective,
61
+ task summary, workspace/graph/memory/workflow context, plugin outputs,
62
+ constraints, reviewer notes, and retry metadata with obvious secret fields
63
+ redacted before persistence.
64
+ - **Review / retry loops** — Planner -> Executor -> Reviewer records plan review,
65
+ reviewer outcomes (`approve`, `reject`, `retry`), retry history, retry limits,
66
+ reviewer notes, and failure propagation.
67
+ - **Timeline / replay** — agent and workflow runs expose replay support through
68
+ persisted frames that show actor, time, reason, input, output, and decision.
69
+ UI pages add replay viewers for agent and workflow runs.
70
+ - **Agent memory and planning** — `short_term`, `workspace`, and `long_term`
71
+ memory scopes are supported, memory snapshots are workspace-scoped and
72
+ replayable, and agent plans persist with plan-review metadata.
73
+ - **Workflow / agent / plugin hardening** — plugin output enters agent context,
74
+ agent output enters workflow output, retry paths are bounded, and failures
75
+ propagate into run status and realtime events.
76
+ - **Marketplace foundation** — local Plugin, Workflow, and Agent templates with
77
+ metadata, export/import, install hooks, and a template registry. No cloud
78
+ marketplace service is introduced.
79
+ - **Realtime execution observability** — existing SSE feed emits
80
+ `agent_started`, `handoff_created`, `handoff_accepted`, `handoff_completed`,
81
+ `review_requested`, `review_approved`, `retry_requested`,
82
+ `workflow_started`, `plugin_started`, `plugin_completed`, `execution_failed`,
83
+ and related workspace-scoped events.
84
+
85
+ ### Changed
86
+
87
+ - Python package, npm package, VS Code extension, Workspace OS, FastAPI app, and
88
+ `/health` version metadata aligned at `2.1.0`.
89
+ - Multi-Agent Runtime, Plugin SDK, Workflow Engine, and Realtime surface
90
+ versions now report `2.1.0`.
91
+ - Platform UI pages for agents, workflows, plugins, and activity now expose
92
+ handoff chains, review panels, retry history, replay, templates, and plugin
93
+ execution visibility.
94
+
95
+ ### Validation
96
+
97
+ - Unit coverage added for handoff/context persistence, review/retry history,
98
+ memory snapshots, replay, workflow-agent-plugin output propagation,
99
+ marketplace template install, and realtime execution events.
100
+ - Package-store publishing remains manual; release artifacts are version-scoped.
101
+
3
102
  ## [2.0.0] - 2026-06-01
4
103
 
5
104
  > Agentic Workspace Platform — Lattice AI becomes a local-first **Agentic
@@ -1,19 +1,37 @@
1
- # Lattice AI Multi-Agent Runtime 2.0
1
+ # Lattice AI Multi-Agent Runtime 2.1
2
2
 
3
- The Multi-Agent Runtime is the **orchestration layer** introduced in v2.0.0. It sits
3
+ The Multi-Agent Runtime is the **orchestration layer** introduced in v2.0.0 and
4
+ operationalized in v2.2.0. It sits
4
5
  *above* the v1.x single-agent state machine ([`AgentRuntime`](../latticeai/core/agent.py))
5
6
  and coordinates a pipeline of named **roles** that hand off work to one another,
6
- retry on a failing review, and emit a fully observable timeline.
7
+ retry on a failing review, and emit a fully observable, replayable timeline.
7
8
 
8
9
  - **Source of truth:** `latticeai/core/multi_agent.py`
9
10
  - **HTTP surface:** `latticeai/api/agents.py`
10
11
  - **Persistence / Knowledge Graph integration:** `latticeai/core/workspace_os.py`
11
- (`WorkspaceOSStore.record_agent_run`)
12
+ (`WorkspaceOSStore.record_agent_run`, `replay_agent_run`, `list_handoffs`)
12
13
 
13
14
  ```python
14
- MULTI_AGENT_VERSION = "2.0.0"
15
+ MULTI_AGENT_VERSION = "2.2.0"
15
16
  ```
16
17
 
18
+ ## What v2.2 adds
19
+
20
+ v2.2 does not replace the v2.0 runtime; it makes the runtime's operational
21
+ objects durable and inspectable:
22
+
23
+ - **Explicit handoff records**: `handoff_id`, source/target agent ids, reason,
24
+ task summary, context packet, status, and timestamps.
25
+ - **Agent context packets**: objective, task summary, workspace/graph/memory/
26
+ workflow context, plugin outputs, constraints, reviewer notes, and retry
27
+ metadata with obvious secret keys redacted.
28
+ - **Review / retry history**: reviewer outcomes normalize to `approve`,
29
+ `reject`, or `retry`; retry reasons, notes, counts, and limits are persisted.
30
+ - **Planning records**: plans include a `plan_id`, ordered executable steps, and
31
+ plan-review metadata.
32
+ - **Replay**: persisted runs can be replayed as frames showing actor, time,
33
+ reason, input, output, and decision via `/agents/api/runs/{run_id}/replay`.
34
+
17
35
  ## How it relates to the v1 single-agent runtime
18
36
 
19
37
  v1.x shipped a single-agent state machine — `AgentRuntime` driving
@@ -1,9 +1,11 @@
1
1
  # Lattice AI Plugin SDK
2
2
 
3
- The Plugin SDK is the v2.0.0 extension layer for the Lattice AI Agentic Workspace
4
- Platform. It lets you package skills, tools, workflow templates, and actions into
5
- one versioned, permissioned unit a *plugin*. A plugin is a directory under the
6
- configured `plugins` root that ships a `plugin.json` manifest.
3
+ The Plugin SDK is the extension layer for the Lattice AI Agentic Workspace
4
+ Platform. v2.2.0 keeps the v2.0 plugin model and adds execution observability plus
5
+ local marketplace-template foundations. It lets you package skills, tools,
6
+ workflow templates, and actions into one versioned, permissioned unit — a
7
+ *plugin*. A plugin is a directory under the configured `plugins` root that ships
8
+ a `plugin.json` manifest.
7
9
 
8
10
  The SDK is intentionally **additive**. Plugins *extend* the existing Skill, Tool,
9
11
  and Workflow surfaces; they never replace them. Standalone skills that are already
@@ -20,9 +22,19 @@ through the existing skill registry rather than owning a parallel one.
20
22
  The host SDK version is exposed as:
21
23
 
22
24
  ```python
23
- PLUGIN_SDK_VERSION = "2.0.0"
25
+ PLUGIN_SDK_VERSION = "2.2.0"
24
26
  ```
25
27
 
28
+ ## v2.2 additions
29
+
30
+ - `execute_action(...)` emits `plugin_started`, `plugin_completed`, and
31
+ `execution_failed` through the existing Workspace OS timeline/realtime feed.
32
+ - Plugin outputs can be carried inside agent context packets and replayed from
33
+ agent/workflow run history.
34
+ - The local template catalog (`latticeai.core.marketplace`) adds Plugin,
35
+ Workflow, and Agent template metadata, export/import, install hooks, and a
36
+ template registry without introducing a cloud marketplace service.
37
+
26
38
  ---
27
39
 
28
40
  ## The `plugin.json` manifest
@@ -39,7 +51,7 @@ parsed and validated into an immutable `PluginManifest`.
39
51
  | `version` | string | yes | Semantic version (`^\d+\.\d+\.\d+([.-][0-9A-Za-z.]+)?$`). |
40
52
  | `description` | string | no | Short summary. |
41
53
  | `author` | string | no | Author or organization. |
42
- | `lattice_version` | string | no | Minimum host version this plugin requires. May be bare (`"2.0.0"`) or prefixed (`">=2.0.0"`). Empty means "any host". |
54
+ | `lattice_version` | string | no | Minimum host version this plugin requires. May be bare (`"2.2.0"`) or prefixed (`">=2.2.0"`). Empty means "any host". |
43
55
  | `permissions` | string[] | no | Must be a subset of the [permission allow-list](#permissions). Unknown values are rejected. |
44
56
  | `provides` | object | no | What the plugin contributes. Keys must be in `("skills", "tools", "workflows", "actions")`; each value is a list of names. |
45
57
  | `entrypoint` | string | no | Reserved for an optional code entrypoint. |
@@ -193,13 +205,14 @@ identically:
193
205
  { "lattice_version": ">=2.0.0" }
194
206
  ```
195
207
 
196
- Examples against a host of `2.0.0`:
208
+ Examples against a host of `2.2.0`:
197
209
 
198
210
  | Required | Compatible | Why |
199
211
  | --- | --- | --- |
200
212
  | `""` (missing) | yes | Any host. |
201
213
  | `2.0.0` / `>=2.0.0` | yes | Same major, host `>=` required. |
202
- | `2.1.0` | no | Host is lower than the required minimum. |
214
+ | `2.2.0` / `>=2.2.0` | yes | Same major, exact current host. |
215
+ | `2.3.0` | no | Host is lower than the required minimum. |
203
216
  | `1.0.0` | no | Major mismatch. |
204
217
  | `3.0.0` | no | Major mismatch. |
205
218
 
@@ -1,8 +1,10 @@
1
1
  # Lattice AI Realtime Collaboration
2
2
 
3
- Realtime Collaboration is the v2.0.0 subsystem that gives a Lattice AI workspace
4
- a live **presence** registry and an **activity feed**. It is delivered over
5
- Server-Sent Events (SSE) by an in-process pub/sub bus, the
3
+ Realtime Collaboration is the subsystem that gives a Lattice AI workspace a live
4
+ **presence** registry and an **activity feed**. In v2.2.0 it also carries
5
+ workspace-scoped execution observability for agents, handoffs, reviews,
6
+ workflows, plugins, retries, and failures. It is delivered over Server-Sent
7
+ Events (SSE) by an in-process pub/sub bus, the
6
8
  [`RealtimeBus`](../latticeai/core/realtime.py).
7
9
 
8
10
  The design goal is to surface "what is happening in the workspace right now"
@@ -10,6 +12,17 @@ The design goal is to surface "what is happening in the workspace right now"
10
12
  who is online) without adding a new transport, a new dependency, or a second
11
13
  event system.
12
14
 
15
+ The bus version is:
16
+
17
+ ```python
18
+ REALTIME_VERSION = "2.2.0"
19
+ ```
20
+
21
+ v2.2 execution event types include `agent_started`, `handoff_created`,
22
+ `handoff_accepted`, `handoff_completed`, `review_requested`, `review_approved`,
23
+ `retry_requested`, `workflow_started`, `workflow_completed`, `plugin_started`,
24
+ `plugin_completed`, `execution_failed`, and `execution_cancelled`.
25
+
13
26
  ---
14
27
 
15
28
  ## Why SSE
@@ -288,7 +301,7 @@ defaults to `50` and is clamped to the `200`-entry buffer. Returns newest-first:
288
301
  {
289
302
  "events": [ /* enriched events, newest first */ ],
290
303
  "stats": {
291
- "version": "2.0.0",
304
+ "version": "2.2.0",
292
305
  "subscribers": 1,
293
306
  "presence": 2,
294
307
  "feed_size": 17,
@@ -312,7 +325,7 @@ Returns the scope-filtered presence registry plus the same `stats` block:
312
325
  "last_seen": "2026-06-01T10:15:30"
313
326
  }
314
327
  ],
315
- "stats": { "version": "2.0.0", "subscribers": 1, "presence": 1, "feed_size": 17, "transport": "sse" }
328
+ "stats": { "version": "2.2.0", "subscribers": 1, "presence": 1, "feed_size": 17, "transport": "sse" }
316
329
  }
317
330
  ```
318
331
 
@@ -406,5 +419,5 @@ no client-side filtering is needed.
406
419
  on top of it, not a replacement.
407
420
  - **Single process.** The bus is in-process by design for the local-first
408
421
  deployment; it does not coordinate across multiple server processes.
409
- - **`stats()`** reports `version` (`2.0.0`), live `subscribers`, `presence`
422
+ - **`stats()`** reports `version` (`2.2.0`), live `subscribers`, `presence`
410
423
  count, `feed_size`, and the `transport` (`"sse"`) for health/observability.
@@ -1,11 +1,13 @@
1
- # Lattice AI v2.0 Architecture — Agentic Workspace Platform
1
+ # Lattice AI v2 Architecture — Agentic Workspace Platform
2
2
 
3
- Lattice AI v2.0.0 turns the local-first Workspace OS into a full **Agentic
4
- Workspace Platform**: a single FastAPI application in which plugins, designed
5
- workflows, multi-agent runs, and a realtime collaboration feed all compose over
6
- the same local-first JSON store and Knowledge Graph.
3
+ Lattice AI v2.0.0 turned the local-first Workspace OS into a full **Agentic
4
+ Workspace Platform**. v2.2.0 keeps that architecture and matures the operational
5
+ layer: explicit handoffs, context packets, review/retry loops, memory snapshots,
6
+ planning records, replay, marketplace templates, and realtime execution
7
+ observability all compose over the same local-first JSON store and Knowledge
8
+ Graph.
7
9
 
8
- This document describes how the four v2.0 pillars fit together, the small set of
10
+ This document describes how the v2 platform pillars fit together, the small set of
9
11
  **additive integration seams** that wire them, the cross-integration matrix that
10
12
  results, and the compatibility surfaces that v1.x callers and data keep relying
11
13
  on. Every claim below is grounded in the shipping source:
@@ -17,21 +19,23 @@ on. Every claim below is grounded in the shipping source:
17
19
  - Workflow engine: `latticeai/core/workflow_engine.py`, `latticeai/api/workflow_designer.py`
18
20
  - Multi-Agent runtime: `latticeai/core/multi_agent.py`, `latticeai/api/agents.py`
19
21
  - Realtime bus: `latticeai/core/realtime.py`, `latticeai/api/realtime.py`
22
+ - Marketplace foundation: `latticeai/core/marketplace.py`, `latticeai/api/marketplace.py`
20
23
  - Project conventions: `AGENTS.md`
21
24
 
22
- All four subsystems share the same design rules from `AGENTS.md`: dependency
25
+ All v2 subsystems share the same design rules from `AGENTS.md`: dependency
23
26
  injection, explicit interfaces, small focused modules, registry-based dispatch,
24
27
  and composition over global state. None of them import the FastAPI app; each is
25
28
  constructed by `server_app.py` and exposed through a router factory.
26
29
 
27
30
  ---
28
31
 
29
- ## 1. The Four v2.0 Pillars
32
+ ## 1. The v2 Platform Pillars
30
33
 
31
34
  The platform version is the single source of truth `WORKSPACE_OS_VERSION =
32
- "2.0.0"` (`latticeai/core/workspace_os.py`). Each pillar module re-declares the
35
+ "2.2.0"` (`latticeai/core/workspace_os.py`). Each pillar module re-declares the
33
36
  same version for its own surface (`PLUGIN_SDK_VERSION`, `WORKFLOW_ENGINE_VERSION`,
34
- `MULTI_AGENT_VERSION`, `REALTIME_VERSION`).
37
+ `MULTI_AGENT_VERSION`, `REALTIME_VERSION`) and the marketplace foundation exposes
38
+ `MARKETPLACE_VERSION`.
35
39
 
36
40
  ### 1.1 Plugin SDK (`latticeai.core.plugins`)
37
41
 
@@ -172,6 +176,13 @@ drive an injected `workflow_runner` / `plugin_runner`), and the `reviewer`
172
176
  returns `pass` / `retry`. The reviewer can rewind the pipeline to the executor up
173
177
  to `max_retries` times; the final `status` is `ok`, `retried_ok`, or `failed`.
174
178
 
179
+ v2.2.0 matures that orchestration with first-class `AgentHandoff` and
180
+ `AgentContextPacket` records, structured plan review, retry history, memory
181
+ snapshots, and replay frames. Handoffs are workspace-scoped and persisted with
182
+ source/target agents, task summary, reason, status, timestamps, and redacted
183
+ context so a run can be inspected after the fact instead of inferred from a flat
184
+ log.
185
+
175
186
  ### 1.4 Realtime Collaboration (`latticeai.core.realtime`)
176
187
 
177
188
  An in-process pub/sub bus, presence registry, and activity feed delivered over
@@ -197,21 +208,34 @@ class RealtimeBus:
197
208
  return self.publish(event)
198
209
  ```
199
210
 
211
+ ### 1.5 Marketplace Foundation (`latticeai.core.marketplace`)
212
+
213
+ v2.2.0 adds a local marketplace foundation rather than a cloud marketplace
214
+ service. `TemplateCatalog` manages Plugin, Workflow, and Agent templates with
215
+ metadata, export/import, install hooks, and a template registry stored through
216
+ Workspace OS. Marketplace templates are local extension points for the existing
217
+ Plugin SDK, Workflow Engine, and Multi-Agent Runtime; they do not bypass plugin
218
+ permissions, workflow execution guards, or workspace scoping.
219
+
200
220
  ---
201
221
 
202
222
  ## 2. How the Pillars Compose Into One Platform
203
223
 
204
- The four pillars are not parallel silos. They are stitched into one platform by
224
+ The v2 platform pillars are not parallel silos. They are stitched into one platform by
205
225
  exactly **three additive seams**, all introduced without changing any existing
206
226
  behavior.
207
227
 
208
- ### Seam 1 — Two new state keys with deep-merge backfill
228
+ ### Seam 1 — Additive state keys with deep-merge backfill
209
229
 
210
- `WorkspaceOSStore._default_state()` adds two new top-level keys to the local-first
211
- JSON state: **`plugin_registry`** (an object, mirroring `skill_registry`) and
212
- **`workflow_runs`** (a list, alongside the existing `workflows`). The default
213
- state also adds v2.0 feature flags (`plugin_sdk`, `workflow_designer`,
214
- `multi_agent_runtime`, `realtime_collaboration`) and a `plugins` navigation area.
230
+ `WorkspaceOSStore._default_state()` adds new top-level keys to the local-first
231
+ JSON state, including **`plugin_registry`** (an object, mirroring
232
+ `skill_registry`), **`workflow_runs`** (a list, alongside the existing
233
+ `workflows`), **`handoffs`**, **`memory_snapshots`**, and
234
+ **`template_registry`**. The default state also adds v2 feature flags
235
+ (`plugin_sdk`, `workflow_designer`, `multi_agent_runtime`,
236
+ `realtime_collaboration`, `agent_handoff`, `agent_context_packets`,
237
+ `review_retry_loop`, `timeline_replay`, `marketplace_foundation`, and related
238
+ agent memory/planning flags) plus platform navigation areas.
215
239
 
216
240
  These are safe for existing data because `load_state()` runs `_deep_merge(default,
217
241
  loaded)` on every load. `_deep_merge` walks the default tree and fills in any key
@@ -230,14 +254,14 @@ def _deep_merge(default: Any, loaded: Any) -> Any:
230
254
  return loaded
231
255
  ```
232
256
 
233
- A v1.x `workspace_os.json` that has no `plugin_registry` / `workflow_runs` is
234
- therefore upgraded *in memory* on first load — the new keys are backfilled with
235
- their defaults, every pre-existing snapshot, trace, memory, agent run, workflow,
236
- and skill entry is preserved, and the file is only rewritten on the next normal
237
- `save_state`. The Plugin SDK lifecycle helpers (`list_plugin_registry`,
238
- `set_plugin_enabled`, `mark_plugin_installed`, `mark_plugin_uninstalled`) and
239
- workflow-run helpers (`record_workflow_run`, `list_workflow_runs`) operate on
240
- these keys, deliberately mirroring the existing skill-registry contract.
257
+ A v1.x `workspace_os.json` that has none of these newer keys is therefore
258
+ upgraded *in memory* on first load — the new keys are backfilled with their
259
+ defaults, every pre-existing snapshot, trace, memory, agent run, workflow, and
260
+ skill entry is preserved, and the file is only rewritten on the next normal
261
+ `save_state`. Plugin lifecycle helpers, workflow-run helpers, handoff helpers,
262
+ memory snapshot helpers, and marketplace template helpers operate on these keys,
263
+ deliberately mirroring the existing skill-registry and workflow-history
264
+ contracts.
241
265
 
242
266
  ### Seam 2 — A single `event_sink` on `record_timeline_event`
243
267
 
@@ -277,7 +301,7 @@ behavior change.
277
301
 
278
302
  ### Seam 3 — `PlatformRuntime` as the one cross-wiring point
279
303
 
280
- `latticeai/services/platform_runtime.py` is the single place the four subsystems
304
+ `latticeai/services/platform_runtime.py` is the single place the v2 subsystems
281
305
  cross-wire to one another and to the workspace. Keeping it out of `server_app`
282
306
  honours the `AGENTS.md` preference for small, composable, independently testable
283
307
  modules; `server_app` only constructs it and mounts routers.
@@ -311,7 +335,7 @@ PLATFORM = PlatformRuntime(
311
335
  factories `build_workflow_runners`, `build_orchestrator`, and
312
336
  `plugin_capability_runners` that are handed to the routers.
313
337
 
314
- The four routers are wired entirely through `PLATFORM`:
338
+ The v2 routers are wired entirely through `PLATFORM`:
315
339
 
316
340
  ```python
317
341
  app.include_router(create_plugins_router(
@@ -418,9 +442,9 @@ guarantee every cross-system run terminates.
418
442
 
419
443
  ---
420
444
 
421
- ## 5. HTTP Surface (v2.0 additions)
445
+ ## 5. HTTP Surface (v2 additions)
422
446
 
423
- All v2.0 routes are namespaced so they never collide with existing paths
447
+ All v2 routes are namespaced so they never collide with existing paths
424
448
  (`/plugins/registry` vs. the marketplace `/plugins/directory`; `/workflows` vs.
425
449
  `/workspace/workflows`; `/agents` plural vs. the single-agent `/agent`).
426
450
 
@@ -435,10 +459,18 @@ All v2.0 routes are namespaced so they never collide with existing paths
435
459
  /workflows/api/definitions/{id}`, `POST /workflows/api/validate`,
436
460
  `POST /workflows/api/definitions/{id}/run`,
437
461
  `GET /workflows/api/definitions/{id}/runs`, `GET /workflows/api/runs`,
462
+ `GET /workflows/api/runs/{run_id}/replay`,
438
463
  `GET /workflows/api/export/{id}`, `POST /workflows/api/import`.
439
464
 
440
465
  **Multi-Agent Runtime** (`latticeai/api/agents.py`): `GET /agents`,
441
- `GET /agents/api/roles`, `GET /agents/api/runs`, `POST /agents/api/run`.
466
+ `GET /agents/api/roles`, `GET /agents/api/runs`,
467
+ `GET /agents/api/runs/{run_id}/replay`, `GET /agents/api/handoffs`,
468
+ `GET|POST /agents/api/memory/snapshots`, `POST /agents/api/run`.
469
+
470
+ **Marketplace foundation** (`latticeai/api/marketplace.py`):
471
+ `GET /marketplace/templates`, `GET /marketplace/templates/{kind}/{id}/export`,
472
+ `POST /marketplace/templates/import`, `POST /marketplace/templates/install`,
473
+ `GET /marketplace/templates/registry`.
442
474
 
443
475
  **Realtime Collaboration** (`latticeai/api/realtime.py`): `GET /activity`,
444
476
  `GET /realtime/stream` (SSE), `GET /realtime/feed`, `GET /realtime/presence`,
@@ -460,7 +492,7 @@ Representative run request/response (Workflow Designer):
460
492
 
461
493
  ```json
462
494
  // POST /agents/api/run
463
- { "goal": "Draft v2.0 release notes", "roles": ["planner", "executor", "reviewer"], "max_retries": 2 }
495
+ { "goal": "Draft v2.2 release notes", "roles": ["planner", "executor", "reviewer"], "max_retries": 2 }
464
496
  ```
465
497
 
466
498
  ```json
@@ -474,7 +506,7 @@ Representative run request/response (Workflow Designer):
474
506
 
475
507
  ## 6. Compatibility
476
508
 
477
- > **Compatibility note.** v2.0.0 is **additive**. All v1.x data and APIs are
509
+ > **Compatibility note.** v2.2.0 is **additive**. All v1.x and v2.0 data and APIs are
478
510
  > preserved; the platform layers new capabilities on top of unchanged surfaces.
479
511
 
480
512
  Preserved surfaces, verified against source:
@@ -482,7 +514,7 @@ Preserved surfaces, verified against source:
482
514
  - **ASGI entrypoints.** `server:app` and `latticeai.server_app.app` remain the
483
515
  application objects. `server_app.py` still exposes the module-level `app =
484
516
  FastAPI(...)` plus the `main()` / `uvicorn.run(app, ...)` entry point.
485
- - **Version wiring.** `WORKSPACE_OS_VERSION = "2.0.0"` drives both
517
+ - **Version wiring.** `WORKSPACE_OS_VERSION = "2.2.0"` drives both
486
518
  `APP_VERSION` (and thus the FastAPI `app.version`) and the `/health`
487
519
  response — the health router is constructed with `app_version=APP_VERSION`.
488
520
  - **Existing routes.** Every v1.x router (`auth`, `admin`, `security_dashboard`,
@@ -1,11 +1,11 @@
1
1
  # Lattice AI Workflow Designer
2
2
 
3
- The Workflow Designer (introduced in **v2.0.0**) lets you build, validate, run,
4
- inspect, export, and import automations as a small **directed graph of typed
5
- nodes**. A workflow starts from a single `trigger` node and walks node-to-node
6
- to an `output`, dispatching each executable node to an injected *runner* that
7
- calls the real tool registry, skill registry, plugin registry, or multi-agent
8
- orchestrator.
3
+ The Workflow Designer (introduced in **v2.0.0** and hardened in **v2.2.0**) lets
4
+ you build, validate, run, inspect, replay, export, and import automations as a
5
+ small **directed graph of typed nodes**. A workflow starts from a single
6
+ `trigger` node and walks node-to-node to an `output`, dispatching each executable
7
+ node to an injected *runner* that calls the real tool registry, skill registry,
8
+ plugin registry, or multi-agent orchestrator.
9
9
 
10
10
  The execution model lives in
11
11
  [`latticeai/core/workflow_engine.py`](../latticeai/core/workflow_engine.py)
@@ -17,9 +17,19 @@ is preserved.
17
17
  The engine version is exported as:
18
18
 
19
19
  ```python
20
- WORKFLOW_ENGINE_VERSION = "2.0.0"
20
+ WORKFLOW_ENGINE_VERSION = "2.2.0"
21
21
  ```
22
22
 
23
+ ## v2.2 hardening
24
+
25
+ - Agent node output is captured in workflow context and can flow into a later
26
+ plugin or output node through `last_output`.
27
+ - Plugin node failures mark the run failed and emit realtime execution events.
28
+ - Workflow runs are replayable via `/workflows/api/runs/{run_id}/replay`, with
29
+ frames for actor, time, reason, input, output, and decision.
30
+ - `record_workflow_run` emits `workflow_started`, `workflow_completed`, and
31
+ `execution_failed` events over the existing SSE activity feed.
32
+
23
33
  ---
24
34
 
25
35
  ## Node types
@@ -439,7 +449,7 @@ or scope), stamped with the engine version and stripped of the internal
439
449
 
440
450
  ```json
441
451
  {
442
- "lattice_workflow_export": "2.0.0",
452
+ "lattice_workflow_export": "2.2.0",
443
453
  "name": "Daily digest",
444
454
  "nodes": [ /* ... */ ],
445
455
  "metadata": {}