Docs
Quickstart: Claude Agent SDK
You need: Node.js 20 or later, @anthropic-ai/claude-agent-sdk (pin the version you install), an Anthropic API key in ANTHROPIC_API_KEY, and a Restolayer key in LG_API_KEY.
Get a key. Sign up at https://app.restolayer.com/sign-up. An owner creates a key in Settings → API keys and picks its scopes:
gateway:readto read keys, credits and usage, plusgateway:writeto change them. Keep it in an environment variable, never in a file you commit:export LG_API_KEY=lg_live_…Install (pinned):
npm install --save-exact @anthropic-ai/claude-agent-sdkGive the agent the server:
import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Which organization am I in, and which workspaces does it have?", options: { mcpServers: { restolayer: { type: "http", url: "https://manage.restolayer.com/mcp", headers: { Authorization: `Bearer ${process.env.LG_API_KEY}` } }, }, allowedTools: ["mcp__restolayer__lg_whoami", "mcp__restolayer__lg_workspaces_list"], }, })) { if (message.type === "result") console.log(message.result); }- Check it. The answer names the organization and its workspaces, read with your key's scopes.
Next: task recipes, the MCP tools, and what an agent can do alone.