Skip to content

Agent API & CLI

Botmem is designed to be the memory layer for your AI agents. The botmem CLI, REST API, and MCP endpoint expose the same core memory operations for querying and managing your memory system.

How It Works

+------------------+     +------------------+
|   Human / Agent  |     |   Botmem API     |
|                  +---->+   port 12412      |
|   botmem search  |     |                  |
|   botmem ask     |     |   Semantic search|
|   botmem --toon  |     |   AI-powered Q&A |
+------------------+     +------------------+

The botmem CLI talks directly to the Botmem REST API. Use --toon or --toon-fields for compact machine-readable output in agent workflows; use --json when a script specifically needs raw JSON.

Authentication required

All API endpoints require authentication. Use botmem login to authenticate the CLI, or pass an API key with --api-key bm_sk_.... See Authentication for details.

What You Can Do

With the botmem CLI, you can:

  • Search memories — "Find emails about the Q3 budget" returns semantically ranked results with scores
  • Ask questions — "What did John say about the project deadline?" uses AI to synthesize an answer from your memories
  • Build timelines — "Show me everything related to the project launch" across email, Slack, and WhatsApp
  • Get context — Retrieve relevant context for a conversation topic
  • Look up contacts — "Who is Sarah Chen?" returns all known identifiers, metadata, and associated memories
  • Store new information — "Remember that the deadline was moved to March 15th" creates a manual memory
  • Cross-reference sources — "Did John's Slack message about the budget match what he said in the email?" leverages the factuality system

Agent REST Endpoints

MethodPathDescription
POST/api/agent/askAsk a question — AI synthesizes answer from memories
POST/api/agent/timelineBuild a timeline for a topic
POST/api/agent/contextGet relevant context for a conversation
POST/api/agent/rememberStore a new memory
GET/api/agent/entitiesList extracted entities

CLI Tools

CommandDescription
searchSemantic search across all memories with optional filters
askAsk a question (AI-powered synthesis)
timelineBuild a timeline for a topic
contextGet context for a conversation
memoriesList memories with pagination
memoryGet or delete a single memory
contactsList or search contacts
contactGet contact details or memories
statsMemory count breakdown
statusDashboard overview
entitiesList extracted entities
memory-banksManage memory banks

See the CLI Reference for complete command documentation.

MCP Server

Botmem also exposes an MCP (Model Context Protocol) endpoint at POST /mcp for compatible AI clients. The MCP endpoint uses OAuth Bearer tokens for authentication — API keys (bm_sk_*) are not supported on this endpoint.

MCP tools are generated from the same shared registry used by the CLI help:

ToolUse it for
statusDiscover memory counts, accounts, connectors, queue health, and last syncs
sourcesDiscover available source_type and connector_type filters
listBrowse latest memories sorted by eventTime or ingestTime
timelineBrowse memories inside an explicit event-time range
searchSemantic lookup with optional source, connector, contact, and date filters
askQuestion answering over retrieved memory context
get_memoryFetch one full memory record by id

For latest/current-state questions, prefer list with sort_by: "eventTime" before using semantic search. For unknown source names, call sources before guessing filters.

For most agent integrations, we recommend using the REST API with API keys instead, which supports all the same operations and is simpler to set up.

Next Steps

Your memories. Your agents. Your control.