Go to file
rabbitblood 3dd8df585e feat(hermes): Phase 2a — native Anthropic Messages API dispatch path
Completes the Hermes adapter's native-SDK plan for the provider that gains
the most from leaving OpenAI-compat: Anthropic. OpenAI-compat works fine for
plain text turns on every provider (Phase 1 covered that with one code path
for all 15 providers), but Anthropic's Messages API has first-class tool use,
vision content blocks, and extended thinking that the OpenAI-compat shim
strips or mis-translates.

Rather than ship all native SDK paths in one PR (Anthropic + Gemini + future),
this lands Anthropic only (Phase 2a). Gemini is Phase 2b, shipping after a
production measurement window on Phase 2a.

## Design

Providers now dispatch by `auth_scheme` field. Phase 1 added the field but
every provider used `"openai"`. Phase 2 flips `anthropic` to `"anthropic"`
and wires a second inference path keyed on that:

- `HermesA2AExecutor._do_openai_compat(task_text)` — existing path, handles
  14 of 15 providers (Nous Portal, OpenRouter, OpenAI, xAI, Gemini, Qwen,
  GLM, Kimi, MiniMax, DeepSeek, Groq, Together, Fireworks, Mistral)
- `HermesA2AExecutor._do_anthropic_native(task_text)` — NEW, uses the
  official `anthropic` Python SDK's `AsyncAnthropic().messages.create(...)`
- `HermesA2AExecutor._do_inference(task_text)` — dispatches by
  `self.provider_cfg.auth_scheme`

Unknown schemes fall back to OpenAI-compat with a logged warning, so future
provider additions don't crash if a native SDK path ships late.

## Fail-loud on missing SDK

`_do_anthropic_native` raises a clear `RuntimeError` with install
instructions if the `anthropic` package is missing at runtime:

    Hermes anthropic native path requires the `anthropic` package. Install
    in the workspace image with `pip install anthropic>=0.39.0` or set
    HERMES provider=openrouter to route Claude models through OpenRouter's
    OpenAI-compat shim instead.

This is intentional: silent fallback would mask fidelity loss (tool_use
blocks become plain text, vision gets stripped). Loud failure is better.

`requirements.txt` adds `anthropic>=0.39.0` so the package is baked into
the workspace-template image build path. Operators building custom workspace
images without anthropic installed get the loud error.

## Back-compat

- `create_executor(hermes_api_key="x")` → still routes to Nous Portal
  (`auth_scheme="openai"`), unchanged
- `HERMES_API_KEY` env var → still first in RESOLUTION_ORDER
- `OPENROUTER_API_KEY` env var → still second
- All 14 OpenAI-compat providers unchanged — they take the same code path
  as before
- ONLY `anthropic` provider changes behavior: it now uses the native
  Messages API instead of the `/v1/chat/completions` compat shim

## Constructor signature change

`HermesA2AExecutor.__init__` now takes `provider_cfg: ProviderConfig`
instead of separate `api_key + base_url + model`. The three fields are
derived from `provider_cfg` + an optional model override. This is a
breaking change for any external caller building an executor directly,
but the only documented public entry point is `create_executor()`, which
is updated in the same commit to pass the cfg through.

## Test coverage

`workspace-template/tests/test_hermes_phase2_dispatch.py` — 7 new tests:

1. `test_anthropic_entry_has_anthropic_scheme` — registry flip
2. `test_all_other_providers_still_openai_scheme` — regression guard
3. `test_dispatch_openai_scheme_calls_openai_compat` — happy path
4. `test_dispatch_anthropic_scheme_calls_anthropic_native` — happy path
5. `test_dispatch_unknown_scheme_falls_back_to_openai_compat` — forward compat
6. `test_anthropic_native_raises_clear_error_when_sdk_missing` — fail-loud
7. `test_create_executor_passes_provider_cfg` — constructor wiring

All pass locally (pytest tests/test_hermes_phase2_dispatch.py -v, 0.04s).
Phase 1 tests unchanged: `test_hermes_providers.py` 26/26 pass, no
regressions.

## What's NOT in this PR (Phase 2b)

- Gemini native `generateContent` path (`auth_scheme="gemini"`)
- Streaming support across both native paths (`astream_messages`, `streamGenerateContent`)
- Tool calling on the anthropic native path (the `tools` + `tool_use` blocks)
- Vision content blocks (image_url → anthropic image blocks)
- Extended thinking parameter passthrough

All scoped in `project_hermes_multi_provider.md`. Phase 2a is the minimum
viable native Anthropic dispatch — single-turn text in, text out, no tools.

## Related

- Phase 1 baseline (already in main): #208 — provider registry + OpenAI-compat path
- Queued memory: `project_hermes_multi_provider.md` — full phased plan
- Triggering directive: CEO 2026-04-15 — "once current works are cleared,
  focus on supporting hermes agent"
2026-04-15 12:23:56 -07:00
.claude Merge pull request #61 from Molecule-AI/feat/claude-hooks-upgrade 2026-04-14 12:25:54 -07:00
.githooks chore: replace brand icon and add HANDOFF.md 2026-04-13 13:03:40 -07:00
.github/workflows fix(ci): apply user's bypass-setup-python to main (missed in #186 squash-merge) 2026-04-15 10:58:22 -07:00
canvas fix(canvas): WCAG critical — ARIA live toasts, dialog focus trap, keyboard nav 2026-04-15 08:31:06 +00:00
docs fix(code-review): idle loop hardening + idle_prompt docs + admin-auth runbook 2026-04-15 11:52:01 -07:00
infra fix(gate-4): create molecule-monorepo-net idempotently in setup.sh 2026-04-13 21:37:03 -07:00
mcp-server refactor(mcp-server): DRY envelopes, typed apiCall, explicit re-exports 2026-04-13 14:26:17 -07:00
org-templates Merge pull request #216 from Molecule-AI/feat/tr-idle-prompt 2026-04-15 11:58:50 -07:00
platform fix(security): #234 — sanitize source_id spoof log line via %q 2026-04-15 12:04:26 -07:00
plugins feat(plugins): split guardrails into 12 modular plugins 2026-04-14 12:20:04 -07:00
scripts fix(provisioner): stop rogue config-missing restart loop (#17) 2026-04-14 07:32:58 -07:00
sdk/python fix(gate-4): add missing import json in sdk/python/molecule_plugin/builtins.py 2026-04-14 12:29:32 -07:00
tests fix(tests): add auth headers to e2e GET /events + /bundles/export (post #167) 2026-04-15 10:33:38 -07:00
workspace-configs-templates fix(hermes): align config.yaml required_env with executor (HERMES_API_KEY) 2026-04-14 10:19:55 -07:00
workspace-template feat(hermes): Phase 2a — native Anthropic Messages API dispatch path 2026-04-15 12:23:56 -07:00
.env.example feat(provisioner): configurable per-tier memory/CPU limits (#14) 2026-04-14 10:49:37 -07:00
.gitattributes initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
.gitignore feat(.claude): ambient hooks + sequential-thinking MCP + /triage command 2026-04-14 12:00:35 -07:00
.mcp.json initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
AGENTS.md initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
CLAUDE.md review: split push steps, runbook for secret rotation, username clarity 2026-04-14 17:09:11 -07:00
docker-compose.infra.yml docs(gate-4): note Temporal dev-only no-auth posture 2026-04-13 21:38:38 -07:00
docker-compose.yml initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
HANDOFF.md chore: replace brand icon and add HANDOFF.md 2026-04-13 13:03:40 -07:00
LICENSE fix: replace residual "Agent Molecule" with "Molecule AI" in LICENSE 2026-04-13 13:06:21 -07:00
PLAN.md Merge pull request #81 from Molecule-AI/docs/sync-2026-04-15-tick-9 2026-04-14 20:30:18 -07:00
railway.toml initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
README.md docs(gate-5): document Temporal dependency in CLAUDE.md/PLAN.md 2026-04-13 21:38:25 -07:00
README.zh-CN.md docs(gate-5): document Temporal dependency in CLAUDE.md/PLAN.md 2026-04-13 21:38:25 -07:00
render.yaml initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00

Molecule AI Icon Logo

Molecule AI Text Logo

English | 中文

The Org-Native Control Plane For Heterogeneous AI Agent Teams

The world's most powerful governance platform for AI agent teams.

License: BSL 1.1

Go Version Python Version Next.js

Visual Canvas • Runtime Compatibility • Hierarchical Memory • Skill Evolution • Operational Guardrails

Docs HomeQuick StartArchitecturePlatform APIWorkspace Runtime

Deploy on Railway Deploy to Render


The Pitch

Molecule AI is the most powerful way to govern an AI agent organization in production.

It combines the parts that are usually scattered across demos, internal glue code, and framework-specific tooling into one product:

  • one org-native control plane for teams, roles, hierarchy, and lifecycle
  • one runtime layer that lets LangGraph, DeepAgents, Claude Code, CrewAI, AutoGen, and OpenClaw run side by side
  • one memory model that keeps recall, sharing, and skill evolution aligned with organizational boundaries
  • one operational surface for observing, pausing, restarting, inspecting, and improving live workspaces

Most teams can build a workflow, a strong single agent, a coding agent, or a custom multi-agent graph.

Very few teams can run all of that as a governed organization with clear structure, durable memory boundaries, and production operations.

That is the gap Molecule AI closes.

Why Molecule AI Feels Different

1. The node is a role, not a task

In Molecule AI, a workspace is an organizational role. That role can begin as one agent, later expand into a sub-team, and still keep the same external identity, hierarchy position, memory boundary, and A2A interface.

2. The org chart is the topology

You do not wire collaboration paths by hand. Hierarchy defines the default communication surface. The structure is not decorative UI. It is part of the operating model.

3. Runtime choice stops being a dead-end decision

LangGraph, DeepAgents, Claude Code, CrewAI, AutoGen, and OpenClaw can all plug into the same workspace abstraction. Teams can standardize governance without forcing every group onto one runtime.

4. Memory is treated like infrastructure

Molecule AI's HMA approach is designed around organizational boundaries, not just “store more context somewhere.” Durable recall, scoped sharing, awareness namespaces, and skill promotion are all part of one coherent system.

5. It comes with a real control plane

Registry, heartbeats, restart, pause/resume, activity logs, approvals, terminal access, files, traces, bundles, templates, and WebSocket fanout are not afterthoughts. They are first-class parts of the platform.

The Category Gap Molecule AI Fills

Category What it does well Where it breaks What Molecule AI adds
Workflow builders Visual task automation Nodes are tasks, not durable organizational roles Role-native workspaces, hierarchy, long-lived teams
Agent frameworks Strong runtime semantics Weak control plane and weak org-level operations Unified lifecycle, canvas, registry, policies, observability
Coding agents Excellent local execution Usually not designed as team infrastructure Workspace abstraction, A2A collaboration, platform ops
Custom multi-agent graphs Full flexibility Brittle topology and governance sprawl Standardized operating model without losing runtime freedom

What Makes Molecule AI Defensible

Advantage Why it matters in practice
Role-native workspace abstraction Your org structure survives model swaps, framework changes, and team expansion
Fractal team expansion A single specialist can become a managed department without breaking upstream integrations
Heterogeneous runtime compatibility Different teams can keep their preferred agent architecture while sharing one control plane
HMA + awareness namespaces Memory sharing follows hierarchy instead of leaking across the whole system
Skill evolution loop Durable successful workflows can graduate from memory into reusable, hot-reloadable skills
WebSocket-first operational UX The canvas reflects task state, structure changes, and A2A responses in near real time
Global secrets with local override Centralize provider access, then override only where a workspace needs specialized credentials

Runtime Compatibility, Compared

Molecule AI is not trying to replace the frameworks below. It is the system that makes them easier to run together.

Runtime / architecture Status in current repo Native strength What Molecule AI adds
LangGraph Shipping on main Graph control, tool use, Python extensibility Canvas orchestration, hierarchy routing, A2A, memory scopes, operational lifecycle
DeepAgents Shipping on main Deeper planning and decomposition Same workspace contract, team topology, activity stream, restart behavior
Claude Code Shipping on main Real coding workflows, CLI-native continuity Secure workspace abstraction, A2A delegation, org boundaries, shared control plane
CrewAI Shipping on main Role-based crews Persistent workspace identity, policy consistency, shared canvas and registry
AutoGen Shipping on main Assistant/tool orchestration Standardized deployment, hierarchy-aware collaboration, shared ops plane
OpenClaw Shipping on main CLI-native runtime with its own session model Workspace lifecycle, templates, activity logs, topology-aware collaboration
NemoClaw WIP on feat/nemoclaw-t4-docker NVIDIA-oriented runtime path Planned to join the same abstraction once merged; not yet part of main

This is the key idea: many agent runtimes, one organizational operating system.

Why The Memory Architecture Compounds

Most projects stop at “we added memory.” Molecule AI pushes further:

Conventional memory setup Molecule AI
Flat store or weak namespaces Hierarchy-aligned LOCAL, TEAM, GLOBAL scopes
Sharing is easy to overexpose Sharing is explicit and structure-aware
Memory and procedure get mixed together Memory stores durable facts; skills store repeatable procedure
Every agent can become over-privileged Workspace awareness namespaces reduce blast radius
UI memory and runtime memory blur together Separate surfaces for scoped agent memory, key/value workspace memory, and recall

The flywheel

Task execution
   -> durable insight captured in memory
   -> repeated success becomes a signal
   -> workflow promoted into a reusable skill
   -> skill hot-reloads into the runtime
   -> future work gets faster and more reliable

This is one of Molecule AI's strongest long-term advantages: the system can get more operationally capable without turning into one giant hidden prompt.

Self-Improving Agent Teams, Built Into Molecule AI

Most agent systems stop at "a smart runtime." Molecule AI pushes further: it gives teams a way to capture what worked, promote repeatable procedure into skills, reload those improvements into live workspaces, and keep the whole loop visible at the platform level.

Positioning lens Conventional self-improving agent pattern Molecule AI
Unit of improvement A single agent session or runtime A workspace, a team, and eventually the whole org graph
Operational surface Mostly hidden inside the agent loop Visible in the platform, Canvas, activity stream, memory surfaces, and runtime controls
Strategic outcome A smarter agent A compounding organization with durable knowledge and governed reusable skills

Where that shows up in Molecule AI

Core mechanism Molecule AI module(s) Why it matters
Durable memory that survives sessions workspace-template/builtin_tools/memory.py, workspace-template/builtin_tools/awareness_client.py, platform/internal/handlers/memories.go Memory is not just durable, it is workspace-scoped and can route into awareness namespaces tied to the org structure
Cross-session recall platform/internal/handlers/activity.go (/workspaces/:id/session-search) Recall spans both activity history and memory rows, so the system can search what happened and what was learned without inventing a separate hidden store
Skills built from experience workspace-template/builtin_tools/memory.py (_maybe_log_skill_promotion) Promotion from memory into a skill candidate is surfaced as an explicit platform activity, not a silent internal side effect
Skill improvement during use workspace-template/skill_loader/watcher.py, workspace-template/skill_loader/loader.py, workspace-template/main.py Skills hot-reload into the live runtime, so improvements become available on the next A2A task without restarting the workspace
Persistent skill lifecycle platform/cmd/cli/cmd_agent_skill.go, workspace-template/plugins.py Skills are not just generated once; they can be audited, installed, published, shared, mounted by plugins, and governed as reusable operational assets

Why this matters in Molecule AI

  1. The learning loop is org-aware, not just session-aware. Memory can live at LOCAL, TEAM, or GLOBAL scope, and awareness namespaces give each workspace a durable identity boundary.

  2. The learning loop is visible to operators. Promotion events, activity logs, current-task updates, traces, and WebSocket fanout mean self-improvement is part of the control plane, not a hidden black box.

  3. The learning loop compounds across teams, not just one agent. A workflow learned by one workspace can become a governed skill, reload into the runtime, appear in the Agent Card, and become usable inside a larger organizational hierarchy.

The result is not just “an agent that learns.” It is an organization that gets more capable as its workspaces accumulate durable memory and reusable procedure.

What Ships In main

Canvas

  • Next.js 15 + React Flow + Zustand
  • drag-to-nest team building
  • empty-state deployment + onboarding wizard
  • template palette
  • bundle import/export
  • 10-tab side panel for chat, activity, details, skills, terminal, config, files, memory, traces, and events

Platform

  • Go/Gin control plane
  • workspace CRUD and provisioning
  • registry and heartbeats
  • browser-safe A2A proxy
  • team expansion/collapse
  • activity logs and approvals
  • secrets and global secrets
  • files API, terminal, bundles, templates, viewport persistence

Runtime

  • unified workspace-template/ image
  • adapter-driven execution
  • Agent Card registration
  • awareness-backed memory integration
  • plugin-mounted shared rules/skills
  • hot-reloadable local skills
  • coordinator-only delegation path

Ops

  • Langfuse traces
  • current-task reporting
  • pause/resume/restart flows
  • activity streaming
  • runtime tiers
  • direct workspace inspection through terminal and files

Built For Teams That Need More Than A Demo

Molecule AI is especially strong when you need to run:

  • AI engineering teams with PM / Dev Lead / QA / Research / Ops roles
  • mixed runtime organizations where one team prefers LangGraph and another prefers Claude Code
  • long-lived agent organizations that need memory boundaries and reusable procedures
  • internal platforms that want to expose agent teams as structured infrastructure, not ad hoc scripts

Architecture

Canvas (Next.js :3000)  <--HTTP / WS-->  Platform (Go :8080)  <---> Postgres + Redis
         |                                          |
         |                                          +--> Docker provisioner / bundles / templates / secrets
         |
         +-------------------- shows --------------------> workspaces, teams, tasks, traces, events

Workspace Runtime (Python image with adapters)
  - LangGraph / DeepAgents / Claude Code / CrewAI / AutoGen / OpenClaw
  - Agent Card + A2A server
  - heartbeat + activity + awareness-backed memory
  - skills + plugins + hot reload

Quick Start

git clone https://github.com/Molecule-AI/molecule-monorepo.git
cd molecule-monorepo

./infra/scripts/setup.sh
# Boots Postgres (:5432), Redis (:6379), Langfuse (:3001),
# and Temporal (:7233 gRPC, :8233 UI) on the shared
# `molecule-monorepo-net` Docker network. Temporal runs with
# no auth on localhost — dev-only; production must gate it.

cd platform
go run ./cmd/server

cd ../canvas
npm install
npm run dev

Then open http://localhost:3000:

  1. Deploy a template or create a blank workspace from the empty state.
  2. Follow the onboarding guide into Config.
  3. Add a provider key in Secrets & API Keys.
  4. Open Chat and send the first task.

Documentation Map

Current Scope

The current main branch already includes the core platform, canvas, memory model, six production adapters, skill lifecycle, and operational surfaces. Adjacent runtime work such as NemoClaw remains branch-level until merged, and this README keeps that distinction explicit on purpose.

License

Business Source License 1.1 — copyright © 2025 Molecule AI.

Personal, internal, and non-commercial use is permitted without restriction. You may not use the Licensed Work to offer a competing product or service. On January 1, 2029, the license converts to Apache 2.0.