Agentic infrastructure

Orchestrate agents typesafe

Event-driven agent orchestration. Type-safe events, channels, sinks. @m4trix/core/matrix. Build, wire, stream.

Terminalbash
$pnpm add @m4trix/core
Done in 0.4sPackages: +1
@m4trix/core/matrix// agents & networks@m4trix/stream// pipes@m4trix/react// hooks

Agent network

IngestAgent

↓ events

channel('pipeline')

↓ sink

TransformAgent

↓ SSE

HTTP stream

Write logic first. Wire it second.

Most frameworks make you draw a graph before you write a line of code. m4trix doesn't.
Agents declare what events they care about. The network figures out the rest at runtime.

The six primitives below compose into any topology — a linear chain, a fan-out, a multi-tenant swarm. You never redraw a graph when requirements change; you change which channel an agent subscribes to.

Event-Driven Agents

Write a typed async function. Tell the factory which events trigger it and which it can emit. No base class, no decorator, no node to register — just logic and a schema.

AgentFactory.run().listensTo([evt]).logic(fn).produce({})core
🔗

Agent Networks

setup() is the only wiring ceremony. Subscribe an agent to a channel, tell it where to publish. Chain, fan-out, fork — always the same two lines.

AgentNetwork.setup(({ registerAgent }) => …)core
🛡

Typed Events

The payload you emit in AgentA is the typed triggerEvent in AgentB. Effect Schema validates every handoff at runtime — a schema mismatch fails loudly, not silently in production.

AgentNetworkEvent.of('request', S.Struct({…}))typesafe
📡

SSE Streaming

Call .expose() on a network and you have a streaming HTTP endpoint. The Next.js adapter is a one-liner. Your frontend reads a Server-Sent Events stream, not a polling loop.

NextEndpoint.from(network.expose({…})).handler()stream
🔀

Channels & Sinks

Channels are named message buses. Swap an httpStream sink for Kafka without touching a single agent. The agent doesn't know — or care — where its events go.

createChannel('client').sink(sink.httpStream())infra
📦

Batteries Included

useConversation() manages SSE state in React. Pump chains transforms over streams. AiCursor renders a live typing indicator. Nothing to assemble separately.

@m4trix/core | @m4trix/stream | @m4trix/reactecosystem