# Mozaik

> An open-source TypeScript runtime for self-organizing AI agents that communicate, coordinate, and act autonomously through an event-driven architecture.

Mozaik is an open-source TypeScript runtime built by JigJoy that enables AI agents to communicate, coordinate, and act autonomously without predefined workflows or fixed handoffs. Licensed under MIT, it is available on npm as `@mozaik-ai/core` and on GitHub under the `jigjoy-ai` organization. The project reached v3.13.1 as of June 2026 and is actively maintained with a development branch receiving regular pushes.

## What It Is

Mozaik is an agentic runtime — the infrastructure layer that multi-agent systems need to collaborate at runtime rather than following scripted orchestration graphs. Instead of defining handoffs in advance, agents join a shared `AgenticEnvironment`, subscribe to events they care about, and react the moment those events fire. The core abstraction is a reactive event bus: every message, tool call, reasoning step, function call output, and error is an event that gets fanned out synchronously to all joined participants without blocking producers or other listeners.

## Event-Driven Architecture

Every interaction in Mozaik is modeled as an event on a shared bus. Participants subclass `BaseParticipant` and override only the handlers they need — all others default to no-ops. The handler table covers the full lifecycle:

- `onMessage` / `onExternalModelMessage` — incoming messages from humans or other agents
- `onFunctionCall` / `onFunctionCallOutput` — tool invocation and result routing
- `onReasoning` / `onExternalReasoning` — model reasoning steps
- `onInternalEvent` / `onExternalEvent` — streaming semantic events in real time
- `onError` / `onParticipantError` — error capture and intelligent recovery without crashing the run
- `onParticipantJoined` / `onParticipantLeft` — membership lifecycle hooks

Capability functions (`runInference`, `executeFunctionCall`, `sendMessage`) are fire-and-forget — they return `void` so the environment keeps delivering events while inference and tool execution run in the background.

## Participant Model and Roles

Mozaik defines three participant roles, all built on the same `BaseParticipant` base class:

- **Human** — calls `sendMessage` to inject input into the environment
- **Agent** — calls `runInference` and `executeFunctionCall`, reacts to its own and others' outputs
- **Observer** — overrides handlers only (logging, metrics, persistence) without running inference

Selective listening is supported via a `listens` list: when populated, the environment only delivers external events whose source matches one of the listed participant types, letting a `Critic` agent react only to `Writer` outputs, for example.

## Model Provider Support

Mozaik picks a provider from the model name passed to `runInference`. Supported providers include OpenAI, Anthropic, and Google Gemini, each reading credentials from environment variables (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`). DeepSeek models run through the OpenAI-compatible chat-completions endpoint. Streaming is supported for models that declare `supportsStreaming: true`; requesting streaming for an unsupported model fails validation before the API is called.

## Update: v3.13.1

The latest release is v3.13.1, published June 9, 2026. The repository was created in June 2025 and has seen consistent activity, with the last push in July 2026. The project ships on npm under `@mozaik-ai/core` and the homepage links to a Product Hunt launch page, signaling an active go-to-market phase. The homepage also highlights **baro**, a Claude agent orchestrator built on Mozaik where ten specialized participants work fully concurrently over a single Mozaik bus — presented as a reference implementation of what the runtime enables.

## Features
- Event-driven agent communication via shared bus
- Non-blocking fire-and-forget inference and tool execution
- Reactive participant model with override-only handlers
- Parallel agent execution with shared context
- Streaming inference with real-time semantic event delivery
- Lifecycle hooks for participant join/leave events
- Selective listening via typed participant filters
- Intelligent error recovery with onError and onParticipantError
- Support for OpenAI, Anthropic, Gemini, and DeepSeek models
- Observer participants for logging, metrics, and persistence
- AgenticEnvironment as the shared coordination layer
- TypeScript-first API with full type safety

## Integrations
OpenAI, Anthropic Claude, Google Gemini, DeepSeek, npm

## Platforms
LINUX, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
v3.13.1

## Links
- Website: https://mozaik.jigjoy.ai
- Documentation: https://docs.jigjoy.ai/
- Repository: https://github.com/jigjoy-ai/mozaik
- EveryDev.ai: https://www.everydev.ai/tools/mozaik
