Antfly is a search-and-inference database written in Zig with zero dependencies. One engine carries full-text (BM25), dense, sparse, and late-interaction vector indexes plus graph traversal over the same table, and the models that chunk, embed, rerank, transcribe, OCR, and extract run inside the process. Embeddings, chunks, entities, and graph edges are generated automatically as you write data, and built-in RAG agents tie it together. The same engine runs as a single .aflite file, a single node with a hot standby, a multi-Raft cluster, or serverless over object storage.
# Install the CLI (macOS and Linux), then start a single node with built-in ML inference
curl -fsSL https://releases.antfly.io/antfly/latest/install.sh | sh
antfly standalone
# Or with Homebrew
brew install antflydb/taps/antfly
# Or build from source
make build && ./antfly standalone
# Or run with Docker
docker run -p 8080:8080 ghcr.io/antflydb/antfly:latestThat gives you the Antfarm dashboard at http://localhost:8080 — playgrounds for search, RAG, knowledge graphs, embeddings, reranking, and more.
See the quickstart guide for a full walkthrough.
- Hybrid search — full-text (BM25), dense vectors (RaBitQ-compressed with SPFresh-style updates), sparse vectors (SPLADE), and late interaction (ColQwen2), fused with reciprocal rank or relative score fusion in one query
- Full-text search — Lucene-style segments with highlighting, geo, regex, wildcard, and fuzzy queries, plus English and ten Snowball stemmer languages
- RAG agents — built-in retrieval-augmented generation with streaming, multi-turn chat, tool calling (graph traversal, plus web search through an Exa connection), confidence scoring, and TOON document rendering to cut prompt tokens
- Query-builder agent — turns a natural-language question into a structured Antfly query, with evaluation metrics to measure retrieval quality
- Graph indexes — automatic relationship extraction and graph traversal over your data
- Multimodal — index and search images, audio, and video with CLIP, CLAP, and vision-language models
- Reranking — cross-encoder reranking with score-based pruning to cut the noise
- Aggregations — stats, terms facets, histogram, date histogram, range, and geo-distance aggregations for analytics
- Transactions — ACID transactions at the shard level with distributed coordination
- Document TTL — automatic document expiration so you don't have to clean up yourself
- PostgreSQL CDC — mirror a Postgres table into Antfly over logical replication, every insert, update, and delete included
- CLI — one
antflybinary for the server, tables, queries, backups, auth, and the model registry (antfly inference pull owner/model) - Secrets — reference credentials as
${secret:...}keystore entries or env vars instead of putting them in config - S3 storage — store data in S3/MinIO/R2 for big cost savings and way faster shard splits
- CPU, Metal, and CUDA — native kernels for inference and vector search: SIMD on x86 and ARM, Metal on Apple silicon, and CUDA with a kernel JIT
- Distributed — multi-Raft consensus, automatic sharding and replication, online shard splits, cross-shard transactions, horizontal scaling
- Runs anywhere — Antfly Lite as a single
.aflitefile, a single node with a hot standby, a Raft cluster, or serverless over object storage - Embeddable — a C API (
libantfly), a Go binding, and an in-browser WASM build so the engine runs in-process, in unit tests, or on the edge - Extensions — run your own code inside the engine with the Wasmtime extension runtime
- Enrichment pipelines — configurable pipelines per index for embeddings, summaries, graph edges, and custom computed fields
- Bring your own models — Ollama, OpenAI, Bedrock, Google, or run models locally with Antfly inference (GGUF, safetensors, and ONNX)
- Fine-tuning — LoRA, QLoRA, SFT, DPO, GRPO and more with recipes for Gemma 4, GLiNER2, ColQwen2, LayoutLMv3, rerankers, and chunkers
- Auth — built-in user management with API keys, basic auth, and bearer tokens
- Backup & restore — to local disk or S3
- Kubernetes operator — deploy and manage clusters with the operator (docs)
- MCP and A2A protocols — protocol adapters let agents and LLMs use Antfly directly, and an n8n guide wires it into workflows
- Antfarm — web dashboard with playgrounds for search, RAG, chat, knowledge graphs, embeddings, reranking, chunking, extraction, OCR, transcription, and evals
- Relational tables, SQL, and the Postgres wire protocol — closed schemas with typed packed rows, SQL lowered to native typed plans, a
psql-compatible server, and lake tables over Iceberg and Parquet. Tracked in #502 (relational storage), #691 (system catalog and tablespaces), and #145 (SQL, pgwire, and lake query mode)
antfly.io/docs, or the source under docs/. Good starting points:
- Quickstart, Document Engine, and Hybrid Search
- Multimodal, Artifact Indexes, and Inference with the supported models
- Antfly Lite, Architecture, and Object storage
- End-to-end guides: support answer agent, site search and answers, ticket routing, coding copilot retrieval
- Runnable examples: Lite in Go, image search, memoryaf, Pinecone migration, Postgres sync
Prefer not to run it yourself? Antfly Cloud is the hosted option.
| Language | Package | Source |
|---|---|---|
| Go | github.com/antflydb/antfly/go/pkg/sdk |
go/pkg/sdk |
| TypeScript | @antfly/sdk |
ts/packages/sdk |
| Python | antfly-sdk (import antfly) |
py/packages/sdk |
| Rust | antfly-sdk |
rs/crates/sdk |
| React | @antfly/components |
ts/packages/components |
| PostgreSQL | pgaf extension |
rs/crates/pgaf |
pgaf brings Antfly search into Postgres. Create an index, use the @@@ operator, and you're done:
CREATE INDEX idx_content ON docs USING antfly (content)
WITH (url = 'http://localhost:8080/api/v1/', collection = 'my_docs');
SELECT * FROM docs WHERE content @@@ 'fix my computer';@antfly/components gives you drop-in React components for search UIs — QueryBox, Autosuggest, Facet, ActiveFilters, Results, Pagination, AnswerResults, AnswerFeedback, ChatBar, and ChatMessages, plus streaming hooks like useAnswerStream, useChatStream, useCitations, and useSearchHistory.
Antfly inference handles the ML side: embeddings, chunking, reranking, classification, NER, OCR, transcription, generation, and more. It runs under the antfly inference CLI and starts automatically in standalone mode, so you don't need to set it up separately.
| Package | What it does | Source |
|---|---|---|
| docsaf | Ingest content from the filesystem, web crawls and sitemaps, git repos, S3, and Google Drive | go/pkg/docsaf |
| evalaf | LLM/RAG/agent evaluation ("promptfoo for Go") | go/pkg/evalaf |
| Genkit plugin | Firebase Genkit integration for retrieval and docstore | go/pkg/genkit/antfly |
| memoryaf | Shared long-term memory for AI agents over MCP and HTTP | go/pkg/memoryaf |
| antflylite | Go binding for embedded .aflite databases over the C ABI |
go/pkg/antflylite |
Antfly uses a multi-Raft design with separate consensus groups:
- Metadata raft — table schemas, shard assignments, cluster topology
- Storage rafts — one per shard, handling data, indexes, and queries
Every dependency is our own: Raft, the LSM, an LMDB-compatible B+tree, the WAL, full-text search, HTTP/2 and HTTP/3, and the inference runtime. The one vendored input is our Snowball fork, used to generate the stemmer tables that are checked in. Because the engine owns the whole process, each of these runs under a deterministic VOPR simulation harness that injects storage, network, concurrency, and clock faults, in the style of TigerBeetle.
End-to-end chaos tests — inspired by Jepsen — cover node crashes, leader failures, shard splits under load, and cluster scaling. These tests run real multi-node clusters and inject faults to verify that Raft consensus, transactions, and replication behave correctly under failure.
Critical distributed protocols are formally specified, model-checked, and trace-validated with TLA+ under zig/specs/tla:
- AntflyTransaction — distributed transaction protocol
- occ-2pc — optimistic concurrency control with two-phase commit
- AntflySnapshotTransfer — Raft snapshot transfer
- AntflyShardSplit — shard split coordination
- AntflyLsmLifecycle — LSM ownership handoff under allocation failure
- etcdraft — Raft, trace-validated against the Zig implementation
Join the Discord for support, discussion, and updates.
Interested in contributing? See CONTRIBUTING.md.
The core server is Elastic License 2.0 (ELv2). That means you can use it, modify it, self-host it, and build products on top of it — you just can't offer Antfly itself as a managed service. The in-process bindings that link the core — antfly-embedded and the Go Lite binding — are ELv2 as well. Everything else — the SDKs for Go, TypeScript, Python, and Rust, React components, the inference runtime, pgaf, docsaf, evalaf — is Apache 2.0. We tried to keep as much as possible under a permissive license.
