Examples
Integrate in two lines
Wrap your existing OpenAI or Anthropic client. Every completion call now reads and writes through Coorda — no other code changes.
Using a chat app instead of code?
If you want persistent memory in Claude Desktop or ChatGPT, see the Platforms pages. No code needed.
Pick your stack
LangChain, Vercel AI SDK, CrewAI
These frameworks run OpenAI or Anthropic under the hood. Wrap the underlying client and every call through the framework inherits Coorda memory automatically.
from openai import OpenAI
from langchain_openai import ChatOpenAI
from coorda import Coorda
coorda = Coorda(api_key="ck_live_...")
# Wrap the OpenAI client once
raw_client = coorda.wrap(OpenAI(), agent_id="langchain-agent")
# Pass it into LangChain — every LLM call in the chain now goes through Coorda
llm = ChatOpenAI(client=raw_client.chat.completions, model="gpt-4o")Native LangChain callback shipping soon
We're shipping a first-class
CoordaCallbackHandler so you can drop Coorda into callbacks=[] on any LangChain chain. Until then, wrap the inner client.Raw HTTP (any language)
No SDK required. Works in Go, Ruby, Java, Rust, or any environment that can make HTTP requests.
const COORDA_URL = "https://coorda-app.vercel.app";
const API_KEY = "ck_live_...";
async function coorda(method: string, path: string, body?: object) {
const res = await fetch(`${COORDA_URL}${path}`, {
method,
headers: {
"Content-Type": "application/json",
"X-API-Key": API_KEY,
},
...(body ? { body: JSON.stringify(body) } : {}),
});
return res.json();
}
// Before your agent processes, check for existing context
const prior = await coorda(
"GET",
"/api/context/inject?query=billing+dispute&entityId=customer_123"
);
if (prior.hasContext) {
// Inject into your agent's prompt
const prompt = `${prior.context}\n\nNow handle: ${userMessage}`;
}
// After processing, store the result
await coorda("POST", "/api/context", {
taskId: "task_001",
entityId: "customer_123",
agentId: "my-agent",
input: userMessage,
output: agentResponse,
});Multi-agent coordination
For workflows where multiple agents collaborate on the same entity: claim, process, hand off, log.
import { Coorda } from "@coorda/sdk";
const coorda = new Coorda({ apiKey: "ck_live_..." });
async function handleIncomingRequest(entityId: string, input: string) {
// 1. Claim the task (prevents other agents from working on it)
const task = await coorda.tasks.claim({
entityId,
agentId: "triage-agent",
input,
});
// 2. Check for existing context
const injection = await coorda.context.inject({ query: input, entityId });
// 3. Process with your LLM (context-enriched)
const prompt = injection.hasContext
? `${injection.context}\n\nNew request: ${input}`
: input;
const response = await myLLM(prompt);
// 4. Store the result
await coorda.context.store({
taskId: task.id,
entityId,
agentId: "triage-agent",
input,
output: response,
});
// 5. Hand off to a specialist if needed, otherwise complete
if (needsEscalation(response)) {
await coorda.tasks.handoff(task.id, {
targetAgentId: "specialist-agent",
context: `Triage result: ${response}`,
});
} else {
await coorda.tasks.complete(task.id, { output: response });
}
// 6. Log the workflow
await coorda.workflows.log({
entityId,
steps: [
{
agentId: "triage-agent",
action: "triage",
input,
output: response,
timestamp: new Date().toISOString(),
},
],
outcome: "success",
});
}