Skip to content

feat: agent-mesh v-next pt.2 — in-process transport + Postgres/Redis adapters#39

Merged
reaatech merged 3 commits into
mainfrom
feat/inprocess-transport-and-adapters
Jul 2, 2026
Merged

feat: agent-mesh v-next pt.2 — in-process transport + Postgres/Redis adapters#39
reaatech merged 3 commits into
mainfrom
feat/inprocess-transport-and-adapters

Conversation

@reaatech

@reaatech reaatech commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Completes the agent-mesh v-next set (part 2). All additive and backward-compatible.

Changes

  • feat(router,core): in-process transport + consolidate AgentConfig. Agents can be dispatched in-process (type: 'inprocess', no HTTP hop) via registerInProcessAgent, alongside the MCP transport; dispatchToAgent routes by agent.type and threads an optional metadata passthrough (e.g. a tenant orgId) into the ContextPacket. Redundancy fix: AgentConfig was defined twice (core + registry) — it now lives once in core (with the SSRF-safe endpoint check) and the registry re-exports it; type is enum(['mcp','inprocess']), endpoint optional (required for mcp via refine).
  • feat(postgres,redis): new store adapter packages. @reaatech/agent-mesh-postgres and @reaatech/agent-mesh-redis implement SessionStore + BreakerStore (leader election via a SELECT … FOR UPDATE lease / SET NX PX lease respectively), injected with setSessionStore / setBreakerStore.
  • docs: README (features + packages), ARCHITECTURE (pluggable providers), the orchestrator example (extending: inject classifier/store, register in-process agent), and package READMEs.

Backward compatibility

Existing type: 'mcp' agents (with endpoint) validate and dispatch exactly as before; Firestore/Gemini defaults unchanged. Semver: core/router minor, new adapters initial release.

Verification (full monorepo, reproducing CI)

  • pnpm typecheck ✅ · pnpm lint ✅ · biome format ✅ · pnpm build
  • pnpm test (turbo, all packages) ✅ — incl. in-process dispatch test, and the adapters unit-tested against in-memory/mock clients (session lifecycle, breaker persist/load, leader election, SQL issuance + row mapping)
  • pnpm audit --audit-level high

⚠️ Note for the maintainer

The two new packages (-postgres, -redis) are unit-tested against fakes only — please run a live-DB smoke test (jsonb / FOR UPDATE / timestamptz / multi-instance leader election) before relying on them in production. Each README says so. First npm publish of a new scoped package may need a manual npm publish --access public if the automated changesets publish 404s.

🤖 Generated with Claude Code

reaatech and others added 3 commits July 2, 2026 16:36
…tConfig

Add an in-process dispatch path so an embedding host can run agents as local
handlers (no HTTP hop), and resolve the AgentConfig drift.

- core: `AgentConfigSchema.type` is now `enum(['mcp','inprocess']).default('mcp')`
  and `endpoint` is optional, required (via refine) only for mcp agents.
- **Redundancy fix:** AgentConfig was defined twice (core + registry). It now lives
  once in core (with the SSRF-safe endpoint check, moved from registry); the registry
  package re-exports it and keeps only the AgentRegistry array schema + invariants.
- router: new `InProcessTransport` (registerInProcessAgent / dispatchInProcess).
  `dispatchToAgent` routes by `agent.type` — in-process handler vs pooled MCP client —
  and threads optional `metadata` (e.g. tenant `orgId`) into the ContextPacket so the
  handler can resolve per-call deps. mcp.client guards the now-optional endpoint.

Backward compatible: existing `type: 'mcp'` agents (with endpoint) validate and
dispatch exactly as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ges)

Two backend adapters implementing the pluggable persistence interfaces, so
agent-mesh runs on Postgres/Redis instead of Firestore.

- @reaatech/agent-mesh-postgres — PostgresSessionStore + PostgresBreakerStore
  (+ ensureSchema / SCHEMA_SQL). Leader election via a single-row lease table
  with SELECT … FOR UPDATE. `pg` is a peer dependency.
- @reaatech/agent-mesh-redis — RedisSessionStore + RedisBreakerStore. Leader
  election via a SET NX PX lease. `ioredis` is a peer dependency.

Injected via `setSessionStore` / `setBreakerStore`. Unit-tested against
in-memory/mock clients (SQL issuance + row mapping + session lifecycle + leader
election); a live-DB smoke test is noted in each README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… + adapters

Update README (features + packages), ARCHITECTURE (pluggable providers), the
orchestrator example (extending: inject classifier/store, register in-process
agent), and package READMEs. Add a changeset for the v-next part-2 changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@reaatech
reaatech merged commit 420c0f8 into main Jul 2, 2026
12 checks passed
@reaatech
reaatech deleted the feat/inprocess-transport-and-adapters branch July 2, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant