Adam: An Embeddable Cross-Platform AI Agent Library in C

✍️ OpenClawRadar📅 Published: May 7, 2026🔗 Source
Adam: An Embeddable Cross-Platform AI Agent Library in C
Ad

Adam is an embeddable AI agent library written in C. It offers a full agent loop — tool calling, memory, sessions, voice, streaming, structured output — as a single #include. It supports cloud APIs (Anthropic, OpenAI, Google Gemini, Groq, Together, xAI) and local models via llama.cpp through the same interface. Compiles on macOS, Linux, Windows, iOS, Android, and WASM.

Quick Start

#include "adam.h"

int main(void) { adam_init(); adam_settings_t *s = adam_create_settings(); adam_settings_set_provider(s, ADAM_API_ANTHROPIC, getenv("ANTHROPIC_API_KEY"), "claude-sonnet-4-20250514"); adam_history_t *h = adam_history_create(); adam_run_result_t r = adam_run(s, h, "What is the capital of France?"); printf("%s\n", r.final_response); // "The capital of France is Paris." adam_run_result_free(&r); adam_history_destroy(h); adam_settings_destroy(s); adam_cleanup(); }

make deps     # build llama.cpp + whisper.cpp
make all      # build libadam.a
make test     # run 161 tests (ASan + UBSan)
Ad

Key Features

  • Agent loop – tool calling with automatic iteration until final response
  • Three providers – Anthropic, OpenAI, Google Gemini + any compatible API + local GGUF via llama.cpp
  • Local vision – multimodal image understanding via llama.cpp + mmproj (Gemma 3, LLaVA, etc.)
  • Image generation – native image output via Gemini image models
  • Database extensions – SQLite and PostgreSQL extensions that embed Adam as SQL functions
  • 13 built-in tools – file I/O, shell, calculator, SQL, web fetch/search, HTTP POST, memory, research, multi-agent
  • Long-term memory – hybrid BM25 + vector search via SQLite (sqlite-memory + sqlite-vector)
  • Session persistence – save/load conversations with UUIDv7 keys
  • Telegram bot – full-featured with text, voice, images, tools, and memory
  • Voice – STT (Whisper cloud/local) + TTS (cloud/system) + full audio pipeline
  • Streaming – real-time token delivery via callback
  • Structured outputadam_run_json() with validation and retry
  • Evolution loop – self-improving agent: iterate, score, refine strategy
  • Research mode – autonomous multi-iteration info gathering with report synthesis
  • Multi-agent – Agent A invokes Agent B as a tool, with independent settings/tools
  • Guardrails – pre-send and post-receive validation callbacks
  • Response cache – LRU hash table keyed on model + message history
  • History management – clone, summarize (LLM-based compression), token estimation
  • Thread pool – concurrent agent execution with job queue
  • Filesystem sandbox – tools restricted to explicitly allowed directories
  • Arena allocator – zero-leak per-iteration memory with automatic cleanup

Build Targets

make deps     # Build llama.cpp, whisper.cpp (+ mbedtls/curl on Linux)
make all      # Build libadam.a
make test     # Build & run unit tests (ASan + UBSan)
make chat     # Interactive text chat (cloud API)
make chat GGUF=models/model.gguf   # Interactive text chat (local)
make vision GGUF=models/model.gguf MMPROJ=models/mmproj.gguf  # Local vision test
make talk     # Voice agent (cloud)
make talk LOCAL=1  # Voice agent (fully local)
make memory   # Memory system tests
make clean    # Remove all build artifacts

Full API documentation is available in API.md with every function, type, and callback.

📖 Read the full source: HN AI Agents

Ad

👀 See Also

Phaselock: An AI Agent Control System Inspired by Parenting Techniques
Tools

Phaselock: An AI Agent Control System Inspired by Parenting Techniques

Phaselock is an open-source Agent Skill that implements four control mechanisms for AI agents: explicit gates before action, immediate feedback on mistakes, constrained choices, and mechanical rule enforcement. It works with Claude Code, Cursor, Windsurf, and tools supporting hooks.

OpenClawRadar
Chrome Skills: Save and Reuse AI Prompts as One-Click Tools
Tools

Chrome Skills: Save and Reuse AI Prompts as One-Click Tools

Google's Chrome Skills feature lets users save AI prompts as reusable workflows that run with a single click on any webpage. Skills can be accessed by typing forward slash (/) or clicking the plus sign (+) in Gemini in Chrome.

OpenClawRadar
MOOSE-Star: A 7B Model and 108K-Paper Dataset for Scientific Hypothesis Discovery – ICML 2026
Tools

MOOSE-Star: A 7B Model and 108K-Paper Dataset for Scientific Hypothesis Discovery – ICML 2026

MiroMind releases MOOSE-Star on Hugging Face: a 7B model (DeepSeek-R1-Distill-Qwen-7B fine-tune) for scientific hypothesis discovery, alongside the 108K-paper TOMATO-Star dataset. Benchmark shows MS-7B achieves 54.34% inspiration retrieval accuracy, beating GPT-5.4 and approaching Gemini-3 Pro.

OpenClawRadar
4-layer self-audit system for OpenClaw behavioral evolution
Tools

4-layer self-audit system for OpenClaw behavioral evolution

A developer built a 4-layer audit system where Gemini reviews Claude's blind spots weekly, catching patterns Claude missed in self-review. The system includes post-fix verification, pattern mining, external mirroring, and expectation vs reality checks.

OpenClawRadar