explaingit

guozijn/agentd

21RustAudience · developerComplexity · 4/5Setup · moderate

TLDR

A background Rust daemon that gives AI agents a shared coordination layer, persisting task state in SQLite as a directed graph, issuing leases with heartbeat timeouts, and managing exclusive file locks so multiple agents from any language or provider never stomp on each other.

Mindmap

mindmap
  root((agentd))
    What it does
      Task state persistence
      Multi-agent coordination
    Task graph
      DAG structure
      Pending running done failed
      Lease and heartbeat
    Resource locking
      Exclusive file locks
      Lock expiry on stall
      Multi-provider safe
    Communication
      Unix socket
      Line-by-line JSON
    Storage
      SQLite database
      Append-only event journal
    Setup
      Cargo build or prebuilt binary
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run multiple AI agents from different providers in parallel on the same codebase without them overwriting each other's file edits.

USE CASE 2

Store multi-step AI task progress in SQLite so an agent resumes exactly where it stopped after a crash or restart.

USE CASE 3

Use heartbeat-based lease expiry to automatically reassign a stuck task node to another agent without manual intervention.

USE CASE 4

Build a custom AI agent in any language that coordinates with agentd via Unix socket JSON without needing a special SDK.

Tech stack

RustSQLite

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Rust and Cargo to build from source, or download a prebuilt binary, agents communicate via a Unix domain socket.

No license information is mentioned in this repository.

In plain English

agentd is a background daemon written in Rust that acts as a coordination layer for AI agents running on your local machine. The core problem it solves is that AI agents, especially ones handling long-running tasks with many steps, need somewhere outside themselves to store what they have done and what still needs to happen. If the agent crashes or is restarted, that state would otherwise be lost. agentd handles this by running as a separate process and storing all task state in a SQLite database on disk. The daemon organizes work as a directed acyclic graph (DAG), which is a way of describing a set of tasks where some must finish before others can start. Each node in that graph goes through strict states: pending, running, completed, or failed. When an agent wants to work on the next available step, it asks the daemon for a lease. The agent must send periodic heartbeats to keep that lease active. If the agent goes silent for too long (the default is 300 seconds), the daemon marks the node as failed and returns it to pending so another agent can try it. A second major feature is resource locking. When multiple AI agents from different providers or tools might try to edit the same file at the same time, agentd gives each agent a way to claim an exclusive lock on that file before touching it. If another agent already holds the lock, the newcomer gets a null response and knows not to proceed. The README includes detailed examples showing two agents from different providers competing to edit the same file and how the coordination works. Locks also expire, so a stalled agent cannot block others forever. Communication with the daemon happens through a Unix socket using a simple line-by-line JSON format, meaning any language or tool that can write to a socket can use it without a special library. The daemon also keeps an append-only event journal, which gives a historical record of what happened during a task. The project is built with Rust and can be compiled from source using Cargo or downloaded as a prebuilt binary.

Copy-paste prompts

Prompt 1
I want to run two AI agents concurrently on my codebase using agentd. Show me the Unix socket JSON messages to register a DAG, acquire a lease, and send heartbeats.
Prompt 2
Walk me through setting up agentd so that if one AI agent crashes mid-task, another agent automatically picks up the failed node after the lease timeout expires.
Prompt 3
How do I use agentd's file-locking feature to prevent two agents from editing the same file at the same time? Give me a step-by-step example with two competing agents.
Prompt 4
Set up agentd as a system service that persists task state between reboots and keeps an append-only event journal I can query to debug failed runs.
Open on GitHub → Explain another repo

← guozijn on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.