@ateam-ai/sdk
v1.1.0
Published
A-Team platform runtime SDK for custom connectors and skills
Maintainers
Readme
@ateam-ai/sdk
Runtime SDK for A-Team platform. Use from inside custom connectors or skill code to access platform capabilities cleanly — no JSON-RPC boilerplate, no URL wrangling, no auth token management.
Install
npm install @ateam-ai/sdkQuick start
import { platform, context, memory, progress, log, llm } from "@ateam-ai/sdk";
// Call any platform connector
const page = await platform.callTool("browser-mcp", "web.navigate", { url: "https://example.com" });
// Per-tool-call context (the common case — actor that triggered THIS call)
async function handleToolCall(name, args) {
const actorId = context.requireActorFromArgs(args); // throws if missing
if (!context.hasRole(args, "admin")) { /* deny */ }
const clean = context.stripAdasContext(args); // args without _adas_*
}
// Process-level context (connector self-identification)
const ownTenant = context.tenant(); // "mobile-pa"
const ownActor = context.actorId(); // connector's own actor, may be null
const full = await context.get(); // full platform context (async)
// Memory shortcuts
await memory.store({ type: "preference", content: "Prefers window seats" });
const hits = await memory.recall("seats");
const profile = await memory.profile();
// Progress events (visible in UI traces)
await progress.emit("Scraping page 3", { step: 3, total: 7 });
// Structured logging
log.info("starting request", { url });
log.error("request failed", { err: err.message });
// Platform LLM (fast tier by default)
const res = await llm.call({ prompt: "Summarize: ...", max_tokens: 200 });
console.log(res.text);Environment variables (injected by platform)
Your connector process receives these automatically — don't set them yourself:
ADAS_SDK_URL— platform MCP gateway URLADAS_MCP_TOKEN— auth tokenADAS_TENANT— current tenantADAS_ACTOR_ID— current actor (may be empty for system calls)ADAS_CONNECTOR_ID— your connector's ID (used by logging)
API
platform.callTool(connector, tool, args)
Call any platform connector's tool. Tenant and actor are auto-injected.
platform.mcpCall(toolName, args, opts?)
Low-level MCP JSON-RPC call. Most users want callTool().
context.tenant() / context.actorId()
Process-level, read synchronously from env. Stable for connector lifetime. Use for self-identification (logging prefix, health probes). Usually not what a tool handler wants — use the per-call helpers below.
context.tenantFromArgs(args) / context.actorIdFromArgs(args)
Per-tool-call. Reads the actor / tenant that originated this specific
tool call from the args ConnectorManager injected (_adas_*). Use for
authorization, data scoping, per-user lookups.
context.requireActorFromArgs(args)
Throws if actor missing. Use for authz-critical tools (per-user OAuth, user-scoped DB reads).
context.roleFromArgs(args) / context.rolesFromArgs(args)
Caller's role ("owner" | "admin" | "member" | "viewer"). Sourced from
backend's authoritative req.auth — safe to gate on.
context.hasRole(args, "admin")
Hierarchical check. owner > admin > member > viewer.
context.requestIdFromArgs(args)
Request id for cross-service log correlation.
context.stripAdasContext(args)
Return args with all _adas_* keys removed. Handy before forwarding args
to other services or logging (keeps platform metadata out of your logic).
context.get()
Async — full context from platform (includes actor object, job, skill).
context.rejectSystemActor(args?)
Throws if actor is default, trigger-runner, test, etc. Defaults to
checking process-level actorId(); pass args to check the per-call actor.
memory.store(args) / memory.recall(query, opts) / memory.list(opts) / memory.profile() / memory.profileSet(field, value) / memory.update(id, patch) / memory.remove(id)
Shortcuts over memory-mcp. Actor is auto-injected.
progress.emit(message, opts?)
Emit a progress event to the current job's SSE feed.
log.info/warn/error/debug(msg, data?)
Structured stdout logging with connector prefix.
llm.call({ prompt, system?, max_tokens?, temperature?, caller? })
Call the platform's fast LLM.
License
MIT
