🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@useatlas/sdk

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@useatlas/sdk

TypeScript SDK for the Atlas text-to-SQL agent API

Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

@useatlas/sdk

TypeScript SDK for the Atlas text-to-SQL agent API.

Install

bun add @useatlas/sdk

Quick Start

import { createAtlasClient } from "@useatlas/sdk";

const atlas = createAtlasClient({
  baseUrl: "https://api.example.com",
  apiKey: "my-key",
});

const result = await atlas.query("How many users signed up last week?");
console.log(result.answer);
console.log(result.sql);    // SQL queries the agent executed
console.log(result.data);   // Raw query results ({ columns, rows }[])

Authentication

Pass either apiKey (simple key auth) or bearerToken (BYOT / managed auth):

// Simple API key
const atlas = createAtlasClient({ baseUrl: "...", apiKey: "my-key" });

// Bearer token (JWT from your auth provider)
const atlas = createAtlasClient({ baseUrl: "...", bearerToken: "eyJ..." });

API Reference

Query

MethodDescription
atlas.query(question, opts?)Run a synchronous query. Returns { answer, sql, data, steps, usage }
atlas.chat(messages, opts?)Start a streaming chat session. Returns a raw Response with SSE body (AI SDK Data Stream Protocol)

Conversations

MethodDescription
atlas.conversations.list(opts?)List conversations (paginated)
atlas.conversations.get(id)Get a conversation with messages
atlas.conversations.delete(id)Delete a conversation
atlas.conversations.star(id)Star a conversation
atlas.conversations.unstar(id)Unstar a conversation

Scheduled Tasks

MethodDescription
atlas.scheduledTasks.list(opts?)List scheduled tasks (paginated)
atlas.scheduledTasks.get(id)Get a task with recent runs
atlas.scheduledTasks.create(input)Create a scheduled task
atlas.scheduledTasks.update(id, input)Update a scheduled task
atlas.scheduledTasks.delete(id)Delete a scheduled task
atlas.scheduledTasks.trigger(id)Trigger immediate execution
atlas.scheduledTasks.listRuns(id, opts?)List past runs

Admin (requires admin role)

MethodDescription
atlas.admin.overview()Dashboard overview data
atlas.admin.semantic.entities()List semantic layer entities
atlas.admin.semantic.entity(name)Get entity detail
atlas.admin.semantic.metrics()List metrics
atlas.admin.semantic.glossary()Get glossary
atlas.admin.semantic.catalog()Get catalog
atlas.admin.semantic.stats()Aggregate semantic stats
atlas.admin.connections()List datasource connections
atlas.admin.testConnection(id)Test connection health
atlas.admin.audit(opts?)Query audit log
atlas.admin.auditStats()Aggregate audit stats
atlas.admin.plugins()List installed plugins
atlas.admin.pluginHealth(id)Check plugin health

Error Handling

All methods throw AtlasError on failure:

import { AtlasError } from "@useatlas/sdk";

try {
  await atlas.query("...");
} catch (err) {
  if (err instanceof AtlasError) {
    console.error(err.code);    // e.g. "rate_limited", "auth_error"
    console.error(err.status);  // HTTP status code
    console.error(err.message); // Human-readable message

    if (err.code === "rate_limited") {
      // Retry after the suggested delay
      await sleep(err.retryAfterSeconds! * 1000);
    }
  }
}

License

MIT

Keywords

atlas

FAQs

Package last updated on 10 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts