getMeridianTools() returns Anthropic-compatible tool definitions by default. Use toOpenAITools() or toGeminiTools() to convert to the format expected by OpenAI or Gemini.
Install
Quick start
OpenAI
Gemini
getMeridianTools
Tool[] array. Each CRDT ID exposes four tools:
Special characters in CRDT IDs (
:, /, -) are replaced with _ in tool names.
executeMeridianTool
content field of a tool_result block.
Dispatches to the correct HTTP endpoint based on the tool name:
read→GET /v1/namespaces/:ns/crdts/:idincrement→POST /v1/namespaces/:ns/crdts/:id/ops(GCounter or PNCounter op)set→POST /v1/namespaces/:ns/crdts/:id/ops(LwwRegister op)add→POST /v1/namespaces/:ns/crdts/:id/ops(ORSet Add op)
toOpenAITools
{ type: "function", function: { name, description, parameters } }).
toGeminiTools
{ functionDeclarations: [...] }). Returns a single GeminiTool object to pass directly in the tools array of model.generateContent().
executeOpenAITool
OpenAIToolCall structurally matches ChatCompletionMessageToolCall from the openai package — pass tool_calls[n] directly. Parses function.arguments (JSON string) internally.
executeGeminiTool
GeminiFunctionCall structurally matches FunctionCall from @google/generative-ai — pass part.functionCall directly.
MeridianAgentConfig
Persistent agent memory
Because Meridian CRDTs are durable, an agent can use them as long-term memory across runs — reading its previous state at startup and writing an updated summary before exiting.examples/ai-agents/agents/memory.ts. It uses three CRDTs (namespace: ai-agents):
CRDT IDs must use hyphens only — colons are not supported.
getMeridianTools converts special characters to _ in tool names and executeMeridianTool converts them back to - when calling the API.Multi-agent debate
Two agents can use CRDTs as a shared communication channel — each writing its argument to an LWW-Register and reading the opponent’s latest argument before composing a rebuttal. A full working example is inexamples/ai-agents/agents/debate.ts. It runs two Claude agents (FOR / AGAINST) in interleaved rounds, with each agent’s argument history accumulated in an ORSet. A React UI displays both sides live.
Live UI
The AI agents example ships a React dashboard with four tabs — Agents (multi-worker coordinator), Tool Use (single Claude agent), Memory (persistent memory across runs), and Debate (two-agent debate) — all subscribing to the same CRDTs via WebSocket and displaying live state as agents write.SSE streaming
For agents that need to react to changes without polling, use the SSE endpoint:HttpClient.syncCrdt() handles decoding automatically. Keep-alive pings are sent every 15 seconds to prevent proxy timeouts.
Token requirements
The token must haveread and write permissions for all CRDT IDs the agent will access. Issue one via the admin API: