Skip to content

Docs

Quickstart: Claude Agent SDK

Markdown version

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.

  1. 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:read to read keys, credits and usage, plus gateway:write to change them. Keep it in an environment variable, never in a file you commit:

    export LG_API_KEY=lg_live_…
  2. Install (pinned):

    npm install --save-exact @anthropic-ai/claude-agent-sdk
  3. Give 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);
    }
  4. 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.

Send feedback

Tell us what's broken, confusing or missing on this page, or an idea. It goes to the team that builds the product.
Please don't include passwords or card numbers.
Only to reply about this. Never added to any mailing list.