Get started
Build on the cloud API
A complete agent on the hosted REST API in Python and Node, with no SDK.
No SDK. Get a key at app.mentedb.com, then call the REST endpoint with any HTTP client. The response is the turn data directly as JSON.
Python (requests)
Terminal
export MENTEDB_API_KEY=mdb_your_key_here
pip install requestsPython
import os, requests
API = "https://api.mentedb.com/v1/process_turn"
HEADERS = {"Authorization": f"Bearer {os.environ['MENTEDB_API_KEY']}"}
def process_turn(user_message, assistant_response, turn_id):
resp = requests.post(API, headers=HEADERS, json={
"user_message": user_message,
"assistant_response": assistant_response,
"turn_id": turn_id,
})
resp.raise_for_status()
# the response is the turn data directly
return resp.json()
# Turn 0: tell it something.
process_turn("I switched from Postgres to SQLite for side projects", "Noted.", 0)
# Turn 1: it remembers.
result = process_turn("what database am I using for side projects?", "", 1)
for memory in result["context"]:
print(memory["content"])In a real agent, result["context"] is what you inject into your model prompt:
Python
history = [] # memories from the previous turn
for turn_id, user_message in enumerate(conversation):
prompt = build_prompt(history, user_message) # your prompt template
reply = call_your_llm(prompt) # your model
result = process_turn(user_message, reply, turn_id)
history = result["context"] # feeds the next promptNode (fetch)
Same REST endpoint, no SDK, use fetch.
Terminal
export MENTEDB_API_KEY=mdb_your_key_hereJavaScript
const API = "https://api.mentedb.com/v1/process_turn";
async function processTurn(userMessage, assistantResponse, turnId) {
const resp = await fetch(API, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MENTEDB_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ user_message: userMessage, assistant_response: assistantResponse, turn_id: turnId }),
});
if (!resp.ok) throw new Error(`mentedb ${resp.status}`);
return await resp.json();
}
// Turn 0: tell it something. Turn 1: it remembers.
await processTurn("I switched from Postgres to SQLite for side projects", "Noted.", 0);
const result = await processTurn("what database am I using for side projects?", "", 1);
for (const memory of result.context) console.log(memory.content);The agent loop is identical to Python: prepend result.context to your next prompt, generate, call processTurn, repeat.
Any language that can POST JSON works. See the REST API reference for the raw request and response shapes, including the curl form.