@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 +62 -26
- package/dist/tracing/version.d.ts +1 -1
- package/dist/tracing/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,45 +1,81 @@
|
|
|
1
1
|
# @atlanai/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript
|
|
4
|
-
|
|
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
|
-
|
|
8
|
-
package. It will not be generated from the management OpenAPI contract.
|
|
6
|
+
## Install
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
```bash
|
|
9
|
+
npm install @atlanai/sdk
|
|
10
|
+
```
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Quickstart
|
|
13
13
|
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
42
|
+
## Tracing
|
|
26
43
|
|
|
27
44
|
```typescript
|
|
28
|
-
import
|
|
45
|
+
import * as atlan from "@atlanai/sdk/tracing";
|
|
29
46
|
|
|
30
|
-
|
|
47
|
+
const tracer = atlan.init({ apiKey: "<your-tracing-key>", workspaceId: "workspace_01example" });
|
|
31
48
|
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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.
|
package/dist/tracing/version.js
CHANGED
|
@@ -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.
|
|
7
|
+
exports.SDK_VERSION = "0.1.1";
|