Complete agent loop
Run iterative tool calling until the agent reaches a final response, with guardrails before and after model calls.
Agent runtime
Adam is a portable C agent runtime with tool calling, memory, sessions, voice, structured output, research mode, and local or cloud LLMs behind one interface.
Adam Agent
Embeddable agent library
Best for
Embeddable and database agents
Repository
GitHubProject
Adam gives applications a complete agent loop in an embeddable C library: configure a provider, keep conversation history, call tools, stream output, save sessions, and attach long-term memory.
It works with cloud APIs and local GGUF models through the same interface, and it can be embedded directly into SQLite or PostgreSQL as SQL functions that query the same database.
Why it matters
Capabilities
Run iterative tool calling until the agent reaches a final response, with guardrails before and after model calls.
Use Anthropic, OpenAI, Google Gemini, compatible APIs, or local GGUF models via llama.cpp behind one interface.
Ship file I/O, shell, calculator, SQL, web fetch/search, HTTP POST, memory, research, and multi-agent tools.
Use hybrid BM25 and vector search through SQLite-Memory and SQLite-Vector for persistent agent context.
Embed Adam inside SQLite or PostgreSQL so agents can inspect schema, generate SQL, and query local data.
Persist conversations, stream tokens, build voice agents, run concurrent jobs, and target native or browser runtimes.
Sample code
Initialize Adam, configure a provider, keep history, run the agent, and clean up the runtime.
#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 changed in the project memory this week?"
);
printf("%s\n", r.final_response);
adam_run_result_free(&r);
adam_history_destroy(h);
adam_settings_destroy(s);
adam_cleanup();
} Sample code
Embed Adam directly in SQLite or PostgreSQL. The agent automatically reads schemas and relevant data to answer as accurately as possible, and can also generate SQL from a plain-language description before you execute it.
-- SQLite
.load adam
SELECT adam_config('provider', 'anthropic');
SELECT adam_config('api_key', 'sk-ant-...');
SELECT adam_config('model', 'claude-sonnet-4-20250514');
-- Ask about your live database.
-- Adam reads the schema, queries data, and returns an answer.
SELECT adam_ask('How many users signed up last month?');
-- Generate SQL from natural language without executing it.
SELECT adam_sql('top 5 products by revenue');
-- PostgreSQL
CREATE EXTENSION adam;
SELECT adam_config('provider', 'anthropic');
SELECT adam_config('api_key', 'sk-ant-...');
SELECT adam_config('model', 'claude-sonnet-4-20250514');
SELECT adam_ask('How many users signed up last month?');
SELECT adam_sql('top 5 products by revenue');