@atlanai/sdk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,45 +1,81 @@
1
1
  # @atlanai/sdk
2
2
 
3
- TypeScript management client for the public Atlan Agent Gateway API. Use
4
- `AtlanClient` for stable service namespaces. Generated clients are available
5
- below `client.raw` and package subpaths under `@atlanai/sdk/raw/*`.
3
+ TypeScript/JavaScript SDK for the Atlan Agent Gateway: manage agents, skills,
4
+ sessions, and workspaces, and optionally trace what your agents do.
6
5
 
7
- Tracing is an authored follow-on and is not included in the current TypeScript
8
- package. It will not be generated from the management OpenAPI contract.
6
+ ## Install
9
7
 
10
- ## Local install
8
+ ```bash
9
+ npm install @atlanai/sdk
10
+ ```
11
11
 
12
- Build the package from the repository root:
12
+ ## Quickstart
13
13
 
14
- ```bash
15
- npm --prefix typescript ci --ignore-scripts
16
- npm --prefix typescript run build
14
+ ```typescript
15
+ import { AtlanClient } from "@atlanai/sdk";
16
+
17
+ const client = new AtlanClient({
18
+ gatewayOrigin: "https://<your-gateway-host>",
19
+ bearerToken: "<your-api-token>",
20
+ });
21
+
22
+ const agent = await client.agents.create({
23
+ name: "support-triage",
24
+ workspaceId: "workspace_01example",
25
+ });
26
+
27
+ const page = await client.agents.list({ limit: 10 });
28
+ console.log(`${page.items.length} agents`);
17
29
  ```
18
30
 
19
- Install the built checkout into a local project:
31
+ Methods read as `client.<resource>.<action>` `client.agents.get(agentId)`,
32
+ `client.sessions.messages.create(sessionId, {...})`, and so on. Every public
33
+ Agent Gateway operation is reachable this way; nothing requires reaching into
34
+ a generated client directly.
20
35
 
21
- ```bash
22
- npm install /absolute/path/to/sdk/typescript --ignore-scripts
36
+ Pass a default workspace once instead of repeating it on every call:
37
+
38
+ ```typescript
39
+ const client = new AtlanClient({ gatewayOrigin, bearerToken, workspace: "workspace_01example" });
23
40
  ```
24
41
 
25
- Pass the Gateway origin and bearer explicitly:
42
+ ## Tracing
26
43
 
27
44
  ```typescript
28
- import { AtlanClient, rawAgent } from "@atlanai/sdk";
45
+ import * as atlan from "@atlanai/sdk/tracing";
29
46
 
30
- declare const process: { env: Record<string, string | undefined> };
47
+ const tracer = atlan.init({ apiKey: "<your-tracing-key>", workspaceId: "workspace_01example" });
31
48
 
32
- const client = new AtlanClient({
33
- gatewayOrigin: process.env.ATLANAI_GATEWAY_URL!,
34
- bearerToken: process.env.ATLANAI_TOKEN!,
49
+ await tracer.startAsCurrentSpan("handle-request", { asType: "task" }, async (span) => {
50
+ span.update({ model: "claude-sonnet-5", usage: { inputTokens: 120, outputTokens: 40 } });
35
51
  });
52
+ ```
53
+
54
+ Tracing has its own API key and lifecycle — it does not reuse the management
55
+ client's bearer token or transport. It ships as a separate subpath
56
+ (`@atlanai/sdk/tracing`) so importing it doesn't pull OpenTelemetry into a
57
+ management-only bundle.
36
58
 
37
- const agentsApi = client.agents.apis.agents as rawAgent.AgentsApi;
38
- const page = await agentsApi.agentListAgents({ limit: 10 });
39
- console.log(page.items.length);
59
+ ## Errors
60
+
61
+ Every non-2xx response rejects with `AtlanAPIError`, with `.status`, `.code`,
62
+ and (where the gateway includes one) `.traceId`:
63
+
64
+ ```typescript
65
+ import { AtlanAPIError } from "@atlanai/sdk";
66
+
67
+ try {
68
+ await client.agents.get("agent_does_not_exist");
69
+ } catch (error) {
70
+ if (error instanceof AtlanAPIError) {
71
+ console.log(error.status, error.code);
72
+ }
73
+ }
40
74
  ```
41
75
 
42
- See [the complete local setup guide](../docs/getting-started.md) for direct
43
- Registry configuration and the current typed-namespace follow-up. The
44
- [generated TypeScript reference](../docs/reference/README.md) covers every raw
45
- operation and model.
76
+ ## Runtimes
77
+
78
+ Node ≥20. The tracing subpath is written to also run in non-Node runtimes
79
+ like Cloudflare Workers — pass configuration to `init()` explicitly there
80
+ rather than relying on environment variables, since Workers has no ambient
81
+ environment.
@@ -1,4 +1,4 @@
1
1
  /** SDK identity (SPEC §2.2, §5.1). Kept in sync with package.json — the
2
2
  * version test fails the build on drift. */
3
3
  export declare const SDK_LANGUAGE = "typescript";
4
- export declare const SDK_VERSION = "0.1.0";
4
+ export declare const SDK_VERSION = "0.1.1";
@@ -4,4 +4,4 @@ exports.SDK_VERSION = exports.SDK_LANGUAGE = void 0;
4
4
  /** SDK identity (SPEC §2.2, §5.1). Kept in sync with package.json — the
5
5
  * version test fails the build on drift. */
6
6
  exports.SDK_LANGUAGE = "typescript";
7
- exports.SDK_VERSION = "0.1.0";
7
+ exports.SDK_VERSION = "0.1.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlanai/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Atlan Agent Gateway management SDK",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",