@agentid.live/sdk
v0.1.1
Published
TypeScript SDK for AgentID — persistent identity and shared memory for AI agents
Downloads
35
Maintainers
Readme
@agentid.live/sdk
TypeScript SDK for AgentID — persistent identity and shared memory for AI agents.
Install
npm install @agentid.live/sdkQuick start
import { AgentIDClient } from "@agentid.live/sdk";
const agent = new AgentIDClient({
handle: "myagent",
token: process.env.AGENTID_TOKEN!, // from AgentID dashboard → Agent tab
});
// Load identity + memory in one call
const { systemPrompt, memory } = await agent.getContext();
// Use systemPrompt as the system message with any LLM
const messages = [
{ role: "system", content: systemPrompt },
{ role: "user", content: userMessage },
];
// Report activity to Studio dashboard
await agent.report({ type: "task.started", title: "Processing request", state: "working" });
// Save a persistent fact (shared across all agents on this identity)
await agent.writeMemory("user_language", "TypeScript");
await agent.report({ type: "task.completed", title: "Done", state: "done", tokensUsed: 1240 });Works with any LLM
// OpenAI
import OpenAI from "openai";
const { systemPrompt } = await agent.getContext();
const result = await new OpenAI().chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: systemPrompt }, { role: "user", content: "..." }],
});
// Anthropic
import Anthropic from "@anthropic-ai/sdk";
const { systemPrompt } = await agent.getContext();
const result = await new Anthropic().messages.create({
model: "claude-opus-4-5",
system: systemPrompt,
messages: [{ role: "user", content: "..." }],
});Multiple agents (same identity)
const agents = [
new AgentIDClient({ handle: "agent1", token: process.env.TOKEN_1! }),
new AgentIDClient({ handle: "agent2", token: process.env.TOKEN_2! }),
];
// Load all in parallel — same identity, shared memory
const contexts = await Promise.all(agents.map((a) => a.getContext()));
// Memory written by any agent is visible to all
await agents[0].writeMemory("last_run", new Date().toISOString());API
new AgentIDClient(config)
| Option | Type | Description |
|--------|------|-------------|
| handle | string | Your agent's handle |
| token | string | mcp_secret from the AgentID dashboard |
| baseUrl | string | Optional. Defaults to https://agentid.live |
Methods
| Method | Description |
|--------|-------------|
| getContext() | Fetch systemPrompt + memory + agentInfo in one call |
| getSystemPrompt() | Fetch only the system prompt string |
| getMemory() | Fetch all shared memory entries |
| writeMemory(key, value) | Write or update a memory entry |
| searchMemory(query) | Keyword/semantic search over memory |
| report(event) | Report an activity event to Studio |
Activity event types
task.started · task.progress · task.completed · task.failed · observation · tool.call · tool.result · session.started · session.ended
Activity states
thinking · working · idle · done · error
Setup CLI
Automate setup for Claude Code, Codex, and .env:
npx @agentid.live/cli setup