CoooderSan/weaver
À propos
Agent control plane: immutable agent versions, deployments, runs and audit, executing through a pinned Pi Runtime. Apache-2.0.
IA et apprentissage automatiqueProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalWeaver Platform
English | 简体中文
A self-hosted agent control plane on the lightweight Pi runtime — attach your own runtimes and make existing business systems agent-callable, on your own servers.

Weaver owns agent metadata, immutable agent versions, deployments, runs, audit, and the external invocation API, and delegates model execution to a runtime behind a narrow adapter port — today a pinned Pi Runtime. Weaver itself does not implement a second agent/continuation protocol.
It is built for four jobs:
- Private deployment — one Java control plane, PostgreSQL, and a Node Pi runtime host. No cloud
account, no Kubernetes, no CRDs required (
scripts/local-dev.mjsruns the whole stack locally). - Calling an agent like an API — a deployment gets a readable invocation key, and any service
runs the agent with one
POST /api/v1/deployments/by-key/{key}/runs: idempotent retries, an optional short synchronous wait for the result, SSE events, and multi-turn conversations. The caller never handles versions, runtimes, models, or credentials. - Attaching runtimes — a runtime plugs in by implementing the adapter port; the control plane, its contracts, and the external API stay unchanged.
- Retrofitting existing business systems — agents reach business services through MCP, so existing REST endpoints become tools instead of being rewritten as agent code.
Status: experimental preview. Treat this as a preview, not a production go-decision. The control plane, execution surface, and governance capabilities below are in place; production hardening is still on the roadmap.
Quick start: Hello World
scripts/local-dev.mjs starts PostgreSQL (Docker), the Java control plane, and the Pi Runtime.
It publishes an immutable Hello World agent, waits for deployment admission, and invokes it by the
hello-world key. The script repeats the request with the same idempotency key and checks that both
calls return the same Run. It prints the Run ID, Deployment Revision, recorded event types, and
Hello, world!.
# No model credentials needed. Run once and stop the demo stack.
node scripts/local-dev.mjs --model faux --once
# Optional: use DeepSeek if DEEPSEEK_API_KEY is already set in your environment.
node scripts/local-dev.mjs --model real --once
The faux model runs on loopback. The first run may download build dependencies and the PostgreSQL
image. To keep the demo stack running, omit --once and stop it with Ctrl+C. The API and Runtime
listen on loopback ports 18080 and 8092 by default. If either is busy, choose free ports with
WEAVER_API_PORT and WEAVER_HOST_PORT.
Requirements
- Node.js
^22.19.0 || >=24.0.0 - pnpm
9.15.4 - Java 21 and the Maven wrapper
- Docker + PostgreSQL 16 for the shared native end-to-end tests
Build and verify
corepack enable
corepack prepare [email protected] --activate
pnpm install --frozen-lockfile
pnpm verify # lint + typecheck + tests + Pi admission packet check
./mvnw -f apps/platform-api/pom.xml verify # Java control plane (Testcontainers, Flyway migrations)
The automated suite is green (pnpm verify, ./mvnw -f apps/platform-api/pom.xml verify, and the
credential-free runtime-host smoke suite; a real-model multi-turn smoke joins when credentials are
set). The runtime host is an admission candidate; its supply-chain review is not yet signed off
(docs/pi-durable-admission-checklist.md).
Why Weaver
Weaver and the pinned Pi Runtime already provide the agent foundation: the control plane (identity, immutable versions, deployments, runs, conversations), the execution surface (the Pi model session — tool loop, continuation, code mode), and the governance layer (admission, policy, audit, recovery). You can build business agents on top of that — domain-specific tools, prompts, and schemas — without rebuilding those layers. This is still an experimental preview; production hardening remains on the roadmap.
What the foundation provides today:
- Immutable delivery — agent versions are digest-addressed and immutable; a change is a new version, never an edit of a live artifact.
- Trusted admission — a deployment binds an exact version to a compatible runtime under a bounded policy and only runs after an admission receipt.
- Durable audit and recovery — every run is a cursor-ordered record of events, evidence, and artifacts; a crash mid-run resumes and delivers the result instead of losing it, and multi-turn conversations persist across runs and replicas.
- External invocation — a stable
/api/v1API so any service can run an agent without coupling to how it was authored or which model executes it. - Attachable runtimes — the model and runtime sit behind a provider-neutral adapter port. Pi is the only runtime shipped today; another one is attached by writing an adapter, not by changing the platform.
- MCP integration — a deployment declares MCP servers (URL + tool allowlist); the runtime bridges
them as tools, so an agent reaches existing business systems without modifying Weaver. Any MCP
server works today; for Spring services a thin in-process bridge (
mcp-controller-starter) is on the roadmap. Credentials stay host-bound, never in the agent document or run input.
What's in the box
Publish and version
- Declarative agent documents (prompt, tools, input/output schemas) pinned to a runtime release digest.
- Digest-addressed versions; a database trigger rejects any update or delete.
- A template library (draft → version → publish) and idempotent publication.
Deploy and admit
- A deployment binds a version to a runtime under a bounded policy (timeout, token ceilings).
- Admission jobs (
pending/ready/unknown/rejected) with receipts, fencing leases, and retry; runtime hosts carry their own admission receipts and lineage.
Invoke
- Invocation keys, idempotent run creation, an optional synchronous wait, SSE event streams, cancellation, and run lineage.
- Multi-turn conversations: the revision is frozen at creation, turns are idempotent, and each conversation has its own event stream.
Execute and recover
- A provider-neutral adapter port; the shipped base is the pi-durable runtime host.
- Outbox-based dispatch, recovery candidates with generation fencing, and idempotent runtime callbacks with conflict auditing.
- Turn leases stop one conversation from running two turns at once; conversation state lives in shared PostgreSQL, so runtime replicas are interchangeable and fail over.
Scale and operate (optional, Kubernetes)
- A per-runtime pool, off by default: warm replicas, HPA, idle scale-to-zero and wake-up, sticky
conversations, and PDB handling. Manifests are in
deploy/pi-durable-host. - Many agents in one runtime: each agent contributes its pnpm lockfile, Weaver merges them (versions
coexist, conflicting peer graphs are rejected), and
runtime-operatorbuilds and rolls a new runtime image with BuildKit. Each runtime exposes its agent catalog.
Tools and business systems
- Remote MCP mounts: a version declares MCP slots and a deployment fills them with servers; credentials are resolved by the host and server URLs are validated.
- Pi code mode runs model-written scripts in a VM; credentials never enter the model context.
Supply chain
- The Pi packages are pinned, with provenance, attestation, SBOM, reproducible-build, and
admission-checklist evidence (
docs/pi-durable-*). @ecochain/weaver-agent-releaseprovides manifests, snapshots, trusted catalogs, and bootstrap environment checks.
Console
- A React web console in English and Chinese for templates, agents, deployments, runtimes, runs, and conversations.
The name
Weaver weaves agents together with what they need: many agents into one runtime, agents into existing business systems through MCP, agents into callers through invocation keys, and conversations across runtime replicas. The logo is two A's braided through each other. Agents calling other agents through the control plane are not supported yet.
How Weaver compares
Weaver is a control plane, not an authoring framework: LangGraph, AgentScope, and the agent SDKs are where agent logic is written, and are potential runtimes behind Weaver's adapter port rather than alternatives to it.
The products with the same positioning — a control plane that hosts agents from more than one runtime and connects them to existing APIs — fall into two groups: managed cloud services and Kubernetes-native platforms. Weaver targets the gap between them: self-hosted, without Kubernetes.
| Cloud agent platforms (AWS Bedrock AgentCore, Microsoft Foundry Agent Service, Alibaba Cloud AgentRun, Volcengine AgentKit) | kagent (CNCF Sandbox) | AgentScope Service (preview) | Weaver | |
|---|---|---|---|---|
| Deployment | vendor cloud | Kubernetes (CRDs) | self-hosted | self-hosted; Java + PostgreSQL + Node, no Kubernetes required |
| Runtimes / frameworks | many, with first-party adapters | ADK, Codex, Claude Code; other frameworks as a BYO image over A2A | AgentScope harness, external apps, hosted Codex / Claude Code | Pi today; others via the adapter port |
| Immutable versions | yes (varies by vendor) | digest-addressed revisions, sessions pinned | versioned definitions, sessions pinned | digest-addressed, immutability enforced in the database |
| Admission before running | platform-managed | readiness / compatibility conditions | binding / environment checks | admission receipt + fencing lease on the exact bundle |
| Durable run record and recovery | yes | sessions and events in PostgreSQL; suspend / resume | session snapshots and event log | cursor-ordered events, evidence, artifacts; crash recovery |
| Invocation for business callers | per-agent endpoint (vendor SDK / API) | A2A gateway, addressed by agent name | Session / Turn API with scoped keys | plain REST by invocation key; idempotent, optional sync wait, SSE |
| Existing REST APIs as tools | gateway converts OpenAPI to MCP | via MCP servers / gateway | MCP | any MCP server; Spring in-process bridge on the roadmap |
Why Pi
Pi is a small set of pinned npm packages (pi-durable, pi-ai, chord, pi-codemode) that already
provide durable conversations, the tool loop, continuation, and a sandboxed code mode; the Weaver
runtime host adds the MCP bridge, PostgreSQL storage, and turn leases. That keeps the execution side to
one Node process with a small, auditable dependency surface — no framework service, scheduler, or
cluster to operate alongside the control plane.
Where Weaver is behind
Only one runtime adapter is shipped; there is no container-level sandbox (only Pi's code-mode VM); the optional Kubernetes pool scales one runtime but does not route across runtimes; callers get SSE but no webhooks; and production identity and tenancy are not done yet (see the roadmap). If you already run Kubernetes and want several frameworks today, kagent is the more mature choice; if you are on a single cloud, that cloud's agent platform is.
Execution model
Pi Runtime is the execution surface shipped today. A Run is dispatched through the runtime adapter
into the pinned pi-durable host (Harness.open): the host owns the tool loop, continuation, code
mode, and the final structured result. Weaver receives that result and records durable
RunEvent / Evidence / Artifact, then runs the terminal callback.
flowchart TD
caller["External caller / Web console"] -->|"REST /api/v1"| api["Weaver Java API"]
api -->|"dispatch"| adapter["Provider-neutral adapter"]
adapter -->|"launch · cancel · recover"| base["Execution base"]
base -->|"pi-durable Harness"| model["Model"]
api -->|"RunEvent · Evidence · Artifact"| record[("Durable record")]
subgraph fixed["Weaver (fixed contract)"]
api
adapter
end
subgraph swap["Swappable"]
base
model
end
The control plane is provider-neutral, with two swappable seams:
- Execution base — a runtime attaches through base-swappable ports (
RuntimeExecutionPort,RuntimeAuthorityProvider,AgentHostGatewayProvider,RuntimeAdmissionRouter). Pi Runtime is the base shipped today; another can be attached without changing the platform. - Model — the model is host-owned, injected by the runtime host rather than by Weaver. The shipped host drives DeepSeek; any OpenAI-compatible provider can be bound the same way.
An interactive version of this flow is at docs/weaver-architecture.html
(standalone zoomable page; source spec at docs/weaver-architecture.json).
Object model
Six layers, bound in order:
Agent (identity: name + owner + description, implementation-agnostic)
└─ Version (immutable, digest-addressed deliverable: manifest + schemas + digest + artifactUri)
└─ Deployment (a Version bound to a compatible Runtime + controlled configuration)
└─ Run (one execution; grouped into multi-turn Conversations)
Runtime (execution capacity: an adapter endpoint + declared capabilities + health)
Policy (execution strategy: timeout / token ceilings)
Publishing an agent so it can run means creating Runtime → Agent → Version → Deployment, then submitting a Run against the Deployment. A Conversation chains multiple Runs so a later turn recalls the earlier turns' context.
Repository layout
| Path | Purpose |
|---|---|
apps/platform-api |
Java 21 / Spring Boot / MyBatis-Plus control plane and external API |
apps/platform-web |
React control plane (English and Chinese) |
packages/agent-release |
Canonical agent document, schema, and validation SDK |
packages/runtime-adapter-contracts |
Versioned wire contracts between the control plane and runtime adapters |
tools/pi-durable-host-admission |
pi-durable runtime host (admission candidate) used by the smoke suite and scripts/local-dev.mjs |
contracts/platform |
JSON schemas (OpenAPI and the platform/runtime-adapter schemas) |
runtime-operator/ |
Go lockfile operator + BuildKit builder job (out of the pnpm workspace) |
tests/fixtures/pi-durable-runtime |
Test fixture for the Pi durable runtime |
examples/echo-agent |
A minimal provider-neutral demo agent |
docs/pi-durable-* |
Supply-chain and admission evidence for the pinned Pi packages |
A minimal demo agent
The repository ships a provider-neutral echo agent at examples/echo-agent.
It demonstrates the immutable, digest-addressed agent document and round-trips it through the
@ecochain/weaver-agent-release SDK:
node examples/echo-agent/validate.mjs
The script canonicalizes the document, computes its digest, and verifies the canonical document
against an operator approval. It prints the artifact URI (weaver-agent-data:sha256:…) that the
platform would use to address the immutable version.
External API flow
The operator publishes an agent once:
POST /api/v1/runtimes register execution capacity
POST /api/v1/agents register agent identity
POST /api/v1/agents/{agentId}/publications publish an immutable version (declarative)
POST /api/v1/deployments bind a version to a compatible runtime
PUT /api/v1/deployments/{id}/invocation-key give the deployment a readable key (bind once)
A business service then calls it by key, like any other HTTP API:
curl -X POST "http://localhost:18080/api/v1/deployments/by-key/order-summary/runs?waitSeconds=30" \
-H "Authorization: Bearer $WEAVER_TOKEN" \
-H "Idempotency-Key: order-42-summary" \
-H "Content-Type: application/json" \
-d '{"input": {"orderId": "42"}}'
- Retrying with the same
Idempotency-Keyand input returns the original run instead of starting a second one. waitSeconds(1–30) returns the finished run in the same response; on timeout the response is202with therunIdto keep polling. Omit it to return immediately.- An invocation key is bound once and never repointed. It is an address, not a credential: callers still authenticate, and their tokens are never forwarded to the agent's tools.
Other caller-side endpoints:
POST /api/v1/runs submit a run by deployment id
GET /api/v1/runs/{runId} poll until a terminal status
GET /api/v1/runs/{runId}/events stream run events (SSE)
POST /api/v1/runs/{runId}/cancel cancel a run
POST /api/v1/conversations start a multi-turn conversation
POST /api/v1/conversations/{id}/turns add a turn
GET /api/v1/conversations/{id}/events stream conversation events (SSE)
Security and lifecycle boundaries
- Runtime endpoints and credential references come only from operator-trusted configuration, never from the browser, an agent document, or run input.
- Provider origin/credentials are injected by the deployment's host-owned binding; models and event text cannot select or rewrite endpoints or credentials.
- Cancellation targets the Pi session/request precisely and does not tear down a shared host serving other runs.
onlinereflects the most recent health heartbeat and does not guarantee a specific run succeeds.- Secrets are never committed to Git,
VITE_*, agent documents, run JSON, screenshots, or logs.
Roadmap
Roughly in priority order.
Production hardening — the path from "experimental preview" to production:
- production identity and tenancy (the
localprofile is the only auth today; a non-localprofile denies all requests); - webhooks for callers (SSE and cursor polling already ship);
- secret management and real provider / tenant isolation;
- registry publication of agent artifacts plus TTL / TOCTOU hardening;
- upgrading the Pi runtime from the pinned
pi-durable1.3.0 to 1.7.x, which adds native approval gates (a tool call can wait for a person or a webhook), per-conversation turn limits, and group commit. This needs a native PostgreSQL storage adapter (the current one translates SQLite SQL and does not cover the newer storage core), a one-way data migration, and fresh admission evidence.
- production identity and tenancy (the
Scaling and operations:
- routing across runtimes (a per-runtime Kubernetes pool with warm replicas, idle scale-to-zero, and sticky conversations already ships, off by default);
- rolling deployment revisions and upgrades;
- capability composition and template editing.
Open source:
- publish the REST→MCP bridge (
mcp-controller-starter) as a companion so a business service becomes agent-callable without writing tool code; - more business-agent examples.
- publish the REST→MCP bridge (
License
Apache-2.0 — see LICENSE. Copyright and third-party notices are in NOTICE.
Explorer des projets similaires
Chargement…