Building AI Agents with ZeroLock

This guide teaches you how to build AI agents that work together without conflicts. Whether you're new to AI agents or just new to ZeroLock, start here.

What are AI Agents?

AI agents are autonomous programs that use large language models (LLMs) to make decisions and take actions. Think of them as smart workers that can:

  • Research topics and summarize findings
  • Review code and suggest improvements
  • Process data and generate reports
  • Execute multi-step workflows

The challenge? When multiple agents work on the same task or shared data, they step on each other's toes.

The Problem ZeroLock Solves

Imagine two AI agents both trying to update the same document:

plaintext
Agent A reads document → "Hello"
Agent B reads document → "Hello"
Agent A writes → "Hello World"
Agent B writes → "Hello Everyone"   ← Agent A's change is LOST!

This is called a race condition. Without coordination, agents:

  • Lose updates: One agent's work gets overwritten
  • Duplicate work: Multiple agents process the same task
  • Create conflicts: Agents make contradictory decisions
  • Read stale data: Agents act on outdated information

ZeroLock prevents all of these problems.


Learning Path

Follow this path from your first agent to production-ready systems:

Step 1: Core Concepts (Start Here)

Learn the three fundamental patterns every ZeroLock agent uses:

ExampleWhat You'll LearnTime
Hello ZeroLockPrevent lost updates with version checking5 min
Task QueueEnsure each task is processed exactly once10 min
Shared NotepadAppend data without conflicts5 min

Start with Quickstart Examples →

Step 2: Add Your AI Framework

Integrate ZeroLock with your preferred AI framework:

FrameworkWhat You'll Build
LangGraphResearch team with coordinated findings
CrewAICrew with ZeroLock-powered tools
AutoGenGroup chat with turn coordination
LlamaIndexDistributed RAG with parallel indexing

Explore Framework Examples →

Step 3: Real-World Applications

Build production-style multi-agent systems:

ApplicationAgents Working Together
PR Review Platform3 reviewers analyzing code in parallel
Codebase MigratorAgents updating files concurrently
Deep Research DeskResearchers gathering and synthesizing data
Support Desk (Gemini)Three LLM agents claim tickets, share a refund budget and need approval to reply (full walkthrough)

See Use Case Examples →

Step 4: Advanced Patterns

Master sophisticated coordination techniques:

PatternWhen You Need It
Task ClaimingProcessing queues with many workers
File LockingExclusive access to resources
Approval GatesHuman-in-the-loop for critical actions

Learn Advanced Patterns →


Before You Start

Prerequisites

  1. Python 3.11+ installed
  2. ZeroLock gateway running:
bash
# Clone the repository
git clone https://github.com/shalwin04/zlock.git
cd zlock
 
# Install dependencies
pnpm install
 
# Start the gateway
cd packages/gateway && pnpm dev

You should see:

plaintext
ZeroLock Gateway running at http://localhost:8080

Running Any Example

Every example follows the same pattern:

bash
# 1. Make sure gateway is running (see above)
 
# 2. Navigate to the example
cd examples/quickstart/01-hello-zerolock
 
# 3. Run it
python main.py

How Examples Are Structured

Each example shows:

  1. The Problem: What goes wrong WITHOUT coordination
  2. The Solution: How ZeroLock fixes it
  3. The Code: Working implementation you can copy
  4. The Output: What you should see when it runs

This side-by-side comparison helps you understand exactly what ZeroLock is doing and why.


Key Concepts Reference

TermSimple Explanation
AgentA program that uses an LLM to make decisions
ShardA piece of shared data (like a variable all agents can access)
VersionA number that increments each time data changes
OCC"Try to save, retry if someone else saved first"
CRDT"Add data without conflicts"
Task Claiming"Only one agent can own this task"

Next Step

Ready to build your first coordinated agent?

Start with Hello ZeroLock →