antpath 0.1.0 → 0.2.0

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.
Files changed (49) hide show
  1. package/README.md +102 -67
  2. package/dist/client.js +4 -1
  3. package/dist/client.js.map +1 -1
  4. package/dist/credentials.js +34 -5
  5. package/dist/credentials.js.map +1 -1
  6. package/dist/files/downloader.js +8 -0
  7. package/dist/files/downloader.js.map +1 -1
  8. package/dist/index.d.ts +7 -2
  9. package/dist/index.js +3 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/platform/client.d.ts +204 -0
  12. package/dist/platform/client.js +203 -0
  13. package/dist/platform/client.js.map +1 -0
  14. package/dist/platform/index.d.ts +1 -0
  15. package/dist/platform/index.js +2 -0
  16. package/dist/platform/index.js.map +1 -0
  17. package/dist/providers/anthropic/provider.d.ts +6 -0
  18. package/dist/providers/anthropic/provider.js +90 -12
  19. package/dist/providers/anthropic/provider.js.map +1 -1
  20. package/dist/providers/known-events.d.ts +60 -0
  21. package/dist/providers/known-events.js +64 -0
  22. package/dist/providers/known-events.js.map +1 -0
  23. package/dist/run/controller.d.ts +4 -1
  24. package/dist/run/controller.js +103 -13
  25. package/dist/run/controller.js.map +1 -1
  26. package/dist/template/index.d.ts +1 -1
  27. package/dist/types.d.ts +20 -0
  28. package/dist/utils/events.d.ts +21 -0
  29. package/dist/utils/events.js +97 -18
  30. package/dist/utils/events.js.map +1 -1
  31. package/dist/utils/paths.js +9 -3
  32. package/dist/utils/paths.js.map +1 -1
  33. package/docs/cleanup.md +15 -15
  34. package/docs/credentials.md +105 -23
  35. package/docs/events.md +129 -0
  36. package/docs/mcp.md +18 -18
  37. package/docs/outputs.md +16 -16
  38. package/docs/quickstart.md +13 -13
  39. package/docs/release.md +22 -22
  40. package/docs/skills.md +18 -16
  41. package/docs/templates.md +24 -24
  42. package/docs/testing.md +26 -27
  43. package/examples/mcp-static-bearer.ts +30 -30
  44. package/examples/quickstart.ts +23 -23
  45. package/package.json +46 -51
  46. package/references/architecture-decisions.md +473 -203
  47. package/references/implementation-plan.md +452 -527
  48. package/references/research-sources.md +41 -30
  49. package/references/testing-strategy.md +29 -108
@@ -1,23 +1,105 @@
1
- ---
2
- title: Credentials
3
- ---
4
-
5
- # Credentials
6
-
7
- antpath does not store provider keys or MCP credential values.
8
-
9
- The caller creates `AntpathClient` with a provider key. MCP credentials are passed at run time and validated against Template requirements.
10
-
11
- MVP credential types:
12
-
13
- - `static_bearer`;
14
- - `oauth_access_token`.
15
-
16
- Unsupported in MVP:
17
-
18
- - arbitrary headers;
19
- - OAuth refresh;
20
- - persisted antpath vault;
21
- - antpath MCP proxy.
22
-
23
- For Claude Managed Agents, the SDK creates per-run provider vault credentials and tracks provider IDs for cleanup.
1
+ ---
2
+ title: Credentials
3
+ ---
4
+
5
+ # Credentials
6
+
7
+ antpath does not store provider keys or MCP credential values.
8
+
9
+ The caller creates `AntpathClient` with a provider key. MCP credentials are passed at run time and validated against Template requirements.
10
+
11
+ MVP credential types:
12
+
13
+ - `static_bearer`;
14
+ - `oauth_access_token`.
15
+
16
+ Unsupported in MVP:
17
+
18
+ - arbitrary headers;
19
+ - OAuth refresh;
20
+ - persisted antpath vault.
21
+
22
+ For Claude Managed Agents, the SDK creates per-run provider vault credentials and tracks provider IDs for cleanup.
23
+
24
+ ## Proxy endpoints (per-run custom HTTP credentials)
25
+
26
+ Some skills need to call non-MCP HTTP services (e.g. Stripe, internal APIs). Embedding the credential in the skill content puts the raw secret on disk in the agent container and in the model's context — both prompt-injection-readable.
27
+
28
+ The platform's managed HTTP proxy is the agent-first alternative. The caller declares **policy** at the top level of the submission (hashed for idempotency) and supplies the matching **auth value** inside `secrets` (not hashed, so key rotation does not collapse onto a stale run). The raw credential value never enters the container.
29
+
30
+ ```ts
31
+ import {
32
+ AntpathPlatformClient,
33
+ validateProxyAuth,
34
+ buildPlatformAllowedHosts
35
+ } from "antpath";
36
+
37
+ const client = new AntpathPlatformClient({
38
+ baseUrl: "https://dashboard.antpath.dev",
39
+ apiToken: "ant_..."
40
+ });
41
+
42
+ const proxyEndpoints = [
43
+ {
44
+ name: "stripe",
45
+ baseUrl: "https://api.stripe.com",
46
+ authShape: { type: "bearer" },
47
+ allowMethods: ["GET", "POST"],
48
+ allowPathPrefixes: ["/v1/charges", "/v1/refunds"],
49
+ maxRequestBytes: 65_536,
50
+ maxResponseBytes: 65_536,
51
+ timeoutMs: 10_000,
52
+ responseMode: "headers_only",
53
+ perCallBudget: 60,
54
+ responseByteBudget: 1_048_576
55
+ }
56
+ ] as const;
57
+
58
+ const proxyEndpointAuth = [
59
+ {
60
+ name: "stripe",
61
+ value: { type: "bearer", token: process.env.STRIPE_API_KEY! }
62
+ }
63
+ ] as const;
64
+
65
+ // Fail fast at submission time when policy and auth disagree.
66
+ validateProxyAuth(proxyEndpoints, proxyEndpointAuth);
67
+
68
+ const run = await client.submitRun({
69
+ templateId: "tmpl_xxx",
70
+ proxyEndpoints,
71
+ secrets: {
72
+ anthropic: { apiKey: process.env.ANTHROPIC_API_KEY! },
73
+ proxyEndpointAuth
74
+ }
75
+ });
76
+ ```
77
+
78
+ Inside the run container, every session has the platform CLI mounted at `/antpath/antpath` (a Node ESM bundle) and a manifest at `/antpath/index.json` describing the declared endpoints. The skill calls the proxy via the CLI:
79
+
80
+ ```bash
81
+ node /antpath/antpath proxy stripe \
82
+ --method GET \
83
+ --path /v1/charges/ch_123 \
84
+ --response-mode headers_only
85
+ ```
86
+
87
+ The CLI reads the per-run bearer from `/antpath/run-token`, attaches the `X-Antpath-Proxy-Protocol` header, and the BFF injects the bearer/header/query/basic credential before dispatching the outbound call. Only the response (subject to `responseMode` and `maxResponseBytes`) reaches the container. `--response-mode` can only narrow below the policy ceiling.
88
+
89
+ `node /antpath/antpath --help` reads endpoint details from `/antpath/index.json`. Runs that do not declare any `proxyEndpoints` still have the CLI and an empty manifest mounted, so agents never need to introspect whether the surface exists.
90
+
91
+ ### Networking
92
+
93
+ When a Template uses `limited` networking, the platform host must appear in `allowed_hosts`. The worker injects it automatically; for advance validation in user-built Templates use:
94
+
95
+ ```ts
96
+ const allowedHosts = buildPlatformAllowedHosts({
97
+ dashboardBaseUrl: "https://dashboard.antpath.dev",
98
+ extraHosts: ["api.stripe.com"]
99
+ });
100
+ ```
101
+
102
+ ### Deprecation: `defaultSecrets`
103
+
104
+ `AntpathPlatformClientOptions.defaultSecrets` is deprecated. Pass `secrets` explicitly on every `submitRun` call so the active credentials are visible at the call site (agent-first design). The client emits a one-time deprecation warning when constructed with `defaultSecrets`.
105
+
package/docs/events.md ADDED
@@ -0,0 +1,129 @@
1
+ ---
2
+ title: Events
3
+ ---
4
+
5
+ # Events
6
+
7
+ Claude Managed Agents sessions run autonomously on Anthropic's infrastructure.
8
+ They are **non-blocking**: the SDK opens a long-lived SSE stream while the
9
+ agent thinks, calls tools, and emits messages on its own schedule. The SDK
10
+ cannot intercept a tool call to return a value — `permission_policy` is
11
+ `always_allow`. This guide covers the observe-only event surface.
12
+
13
+ ## Two ways to consume events
14
+
15
+ ```ts
16
+ // Push: register a callback in RunOptions.
17
+ const handle = await client.run(template, {
18
+ onEvent: async (event) => {
19
+ if (event.type === "provider.event") {
20
+ // event.event is a ProviderEvent (typed via a type guard below).
21
+ }
22
+ }
23
+ });
24
+ await handle.wait();
25
+ ```
26
+
27
+ ```ts
28
+ // Pull: iterate the stream concurrently with handle.wait().
29
+ const handle = await client.run(template);
30
+ const collect = (async () => {
31
+ for await (const event of handle.streamEvents()) {
32
+ // ...
33
+ }
34
+ })();
35
+ const result = await handle.wait();
36
+ await collect;
37
+ ```
38
+
39
+ Both surfaces observe the same events. They can be used together; every
40
+ subscriber sees every event. A subscriber attached after `client.run()`
41
+ returns replays the events it missed (including the initial
42
+ `sdk.status` emitted while provider resources were being created), then
43
+ continues live.
44
+
45
+ ## Event shape
46
+
47
+ ```ts
48
+ type RunEvent =
49
+ | { type: "sdk.status"; status: RunStatus; at: string }
50
+ | { type: "sdk.message_sent"; index: number; at: string }
51
+ | { type: "sdk.cleanup"; ... } // see "Cleanup events" below
52
+ | { type: "provider.event"; event: ProviderEvent; at: string };
53
+
54
+ interface ProviderEvent {
55
+ type: string; // documented Claude event type, e.g. "agent.tool_use"
56
+ payload: unknown; // raw provider payload, redacted
57
+ receivedAt: string;
58
+ }
59
+ ```
60
+
61
+ All events pass through the SDK's secret redaction before reaching any
62
+ subscriber, so payloads do not contain the Anthropic key or MCP credentials
63
+ that were supplied to `client.run()`.
64
+
65
+ ## Drain-before-`wait()` guarantee
66
+
67
+ By the time `await handle.wait()` resolves, every `onEvent` invocation
68
+ triggered by events emitted before the terminal `sdk.status` has itself
69
+ resolved or rejected. Async handlers are invoked serially in event order on
70
+ a single per-listener promise chain, so callers can persist events in order
71
+ without their own queue.
72
+
73
+ The same drain applies to handlers that throw — both modes (warn-only and
74
+ abort-on-error, see below) wait for the offending invocation to settle
75
+ before resolving.
76
+
77
+ ## Error semantics
78
+
79
+ Default: a handler that throws (or returns a rejecting promise) is logged
80
+ via the SDK's configured `logger` at `warn`. The run continues, and the
81
+ final result is unaffected.
82
+
83
+ Opt-in: `onEventAbortOnError: true` upgrades the **first** pre-terminal
84
+ handler error into a `RunStateError` that fails the run. Once terminal
85
+ status has been reached, listener errors are always logged only — they
86
+ never mutate the result, and they cannot trigger recursion when the
87
+ terminal `sdk.status: failed` event itself causes another error.
88
+
89
+ `RunStateError.message` and its `cause` field pass through the same
90
+ redaction layer used for events.
91
+
92
+ ## Cleanup events
93
+
94
+ `sdk.cleanup` events are part of the `RunEvent` union, but they are
95
+ emitted by `handle.cleanup()` after `handle.wait()` has already resolved.
96
+ By that time the event bus has been closed; subscribers attached during
97
+ the run do **not** see them. Inspect cleanup outcomes via the
98
+ `CleanupResult.operations` array returned by `cleanup()` instead.
99
+
100
+ ## Typed helpers
101
+
102
+ `packages/sdk/src/providers/known-events.ts` exports conservative type
103
+ guards that narrow `ProviderEvent.type` to documented Claude event strings.
104
+ They do **not** assert payload field shapes — the raw provider payload
105
+ stays `unknown` until callers parse it themselves.
106
+
107
+ ```ts
108
+ import {
109
+ isAgentMessage,
110
+ isAgentToolUse,
111
+ isAgentToolResult,
112
+ isAgentMcpToolUse,
113
+ isAgentMcpToolResult,
114
+ isAgentCustomToolUse,
115
+ isAgentThinking,
116
+ isUserMessage,
117
+ isSessionStatusRunning,
118
+ isSessionStatusIdle,
119
+ isSessionStatusTerminated,
120
+ isSessionError,
121
+ isAgentEvent,
122
+ isUserEvent,
123
+ isSessionEvent,
124
+ isSpanEvent
125
+ } from "antpath";
126
+ ```
127
+
128
+ The official list of event types is maintained at
129
+ [`platform.claude.com/docs/en/managed-agents/events-and-streaming`](https://platform.claude.com/docs/en/managed-agents/events-and-streaming).
package/docs/mcp.md CHANGED
@@ -1,18 +1,18 @@
1
- ---
2
- title: MCP
3
- ---
4
-
5
- # MCP
6
-
7
- MVP MCP support is provider-native remote HTTPS MCP only.
8
-
9
- Rules:
10
-
11
- - MCP servers are declared in Templates.
12
- - Runtime HITL is disabled.
13
- - Tool policy must be configured before session start.
14
- - Enabled MCP tools use `always_allow` provider permissions.
15
- - `always_ask` is not used by antpath MVP.
16
- - Only provider-native bearer/OAuth auth is supported.
17
-
18
- Use allowlists for sensitive servers whenever possible.
1
+ ---
2
+ title: MCP
3
+ ---
4
+
5
+ # MCP
6
+
7
+ MVP MCP support is provider-native remote HTTPS MCP only.
8
+
9
+ Rules:
10
+
11
+ - MCP servers are declared in Templates.
12
+ - Runtime HITL is disabled.
13
+ - Tool policy must be configured before session start.
14
+ - Enabled MCP tools use `always_allow` provider permissions.
15
+ - `always_ask` is not used by antpath MVP.
16
+ - Only provider-native bearer/OAuth auth is supported.
17
+
18
+ Use allowlists for sensitive servers whenever possible.
package/docs/outputs.md CHANGED
@@ -1,16 +1,16 @@
1
- ---
2
- title: Outputs
3
- ---
4
-
5
- # Outputs
6
-
7
- `downloadOutputs()` downloads all session-scoped provider files by default.
8
-
9
- `/antpath/outputs` is a recommended convention, not a provider default. Templates may instruct agents to write important artifacts there, but MVP output download still uses session-scoped files.
10
-
11
- Safety rules:
12
-
13
- - filenames are sanitized;
14
- - downloads stay within the requested local directory;
15
- - max file count and max total bytes are enforced;
16
- - manifests contain provider file IDs, local paths, names, and sizes only.
1
+ ---
2
+ title: Outputs
3
+ ---
4
+
5
+ # Outputs
6
+
7
+ `downloadOutputs()` downloads all session-scoped provider files by default.
8
+
9
+ `/antpath/outputs` is a recommended convention, not a provider default. Templates may instruct agents to write important artifacts there, but MVP output download still uses session-scoped files.
10
+
11
+ Safety rules:
12
+
13
+ - filenames are sanitized;
14
+ - downloads stay within the requested local directory;
15
+ - max file count and max total bytes are enforced;
16
+ - manifests contain provider file IDs, local paths, names, and sizes only.
@@ -1,13 +1,13 @@
1
- ---
2
- title: antpath quickstart
3
- ---
4
-
5
- # Quickstart
6
-
7
- 1. Put `ANTHROPIC_API_KEY` in `.env.local`.
8
- 2. Define a secret-free Template in TypeScript.
9
- 3. Create `AntpathClient`.
10
- 4. Run the Template.
11
- 5. Wait, download files, then call `cleanup()`.
12
-
13
- See `README.md` for a minimal example.
1
+ ---
2
+ title: antpath quickstart
3
+ ---
4
+
5
+ # Quickstart
6
+
7
+ 1. Put `ANTHROPIC_API_KEY` in `.env.local`.
8
+ 2. Define a secret-free Template in TypeScript.
9
+ 3. Create `AntpathClient`.
10
+ 4. Run the Template.
11
+ 5. Wait, download files, then call `cleanup()`.
12
+
13
+ See `README.md` for a minimal example.
package/docs/release.md CHANGED
@@ -1,22 +1,22 @@
1
- ---
2
- title: Release
3
- ---
4
-
5
- # Release
6
-
7
- CI runs on pull requests and pushes to `main`.
8
-
9
- Publishing runs when a GitHub release is published, or when the publish workflow is manually dispatched.
10
-
11
- Repository setup required:
12
-
13
- 1. Create or reserve the `antpath` package on npm.
14
- 2. Add a Trusted Publisher for this GitHub repository.
15
- 3. Set **Organization or user** to `weilueluo`.
16
- 4. Set **Repository** to `antpath`.
17
- 5. Set **Workflow filename** to `publish.yml`.
18
- 6. Leave **Environment name** empty unless the workflow uses a matching GitHub Actions environment.
19
- 7. Update `package.json` version before publishing a release.
20
- 8. Publish a GitHub release for that version.
21
-
22
- The publish workflow uses GitHub OIDC through `id-token: write`; it does not require an npm token secret. It runs type-checks, tests, build, then `npm publish --provenance`.
1
+ ---
2
+ title: Release
3
+ ---
4
+
5
+ # Release
6
+
7
+ CI runs on pull requests and pushes to `main`.
8
+
9
+ Publishing runs when a GitHub release is published, or when the publish workflow is manually dispatched.
10
+
11
+ Repository setup required:
12
+
13
+ 1. Create or reserve the `antpath` package on npm.
14
+ 2. Add a Trusted Publisher for this GitHub repository.
15
+ 3. Set **Organization or user** to `weilueluo`.
16
+ 4. Set **Repository** to `antpath`.
17
+ 5. Set **Workflow filename** to `publish.yml`.
18
+ 6. Leave **Environment name** empty unless the workflow uses a matching GitHub Actions environment.
19
+ 7. Update `packages/sdk/package.json` version before publishing a release.
20
+ 8. Publish a GitHub release for that version.
21
+
22
+ The publish workflow uses GitHub OIDC through `id-token: write`; it does not require an npm token secret. It runs type-checks, tests, build, then publishes the `antpath` SDK workspace with provenance.
package/docs/skills.md CHANGED
@@ -1,16 +1,18 @@
1
- ---
2
- title: Skills
3
- ---
4
-
5
- # Skills
6
-
7
- MVP skill inputs:
8
-
9
- - provider-managed Anthropic skills;
10
- - existing custom provider skill IDs;
11
- - local files/directories uploaded as session resources;
12
- - inline skill content uploaded as session resources.
13
-
14
- Local directories are packaged as zip files and mounted under `/antpath/skills/` unless overridden.
15
-
16
- Inline skills are uploaded as markdown files and mounted under `/antpath/skills/` unless overridden.
1
+ ---
2
+ title: Skills
3
+ ---
4
+
5
+ # Skills
6
+
7
+ MVP skill inputs:
8
+
9
+ - provider-managed Anthropic skills;
10
+ - existing custom provider skill IDs;
11
+ - local files/directories uploaded as session resources;
12
+ - inline skill content uploaded as session resources.
13
+
14
+ Local directories are packaged as zip files and mounted under `/antpath/skills/` unless overridden.
15
+
16
+ Inline skills are uploaded as markdown files and mounted under `/antpath/skills/` unless overridden.
17
+
18
+ The platform also mounts the `antpath` CLI at `/antpath/antpath` and a per-run manifest at `/antpath/index.json` on **every** run. Skills can invoke the managed HTTP proxy via `node /antpath/antpath proxy …` — see `credentials.md` for the policy/auth model.
package/docs/templates.md CHANGED
@@ -1,24 +1,24 @@
1
- ---
2
- title: Templates
3
- ---
4
-
5
- # Templates
6
-
7
- Templates are code-defined, immutable, secret-free run configurations.
8
-
9
- Allowed Template content:
10
-
11
- - model;
12
- - system prompt;
13
- - queued user messages;
14
- - typed variables;
15
- - MCP server declarations;
16
- - MCP tool allow/deny policy;
17
- - environment package and network configuration;
18
- - inline/local/provider skills;
19
- - output conventions;
20
- - non-secret metadata.
21
-
22
- Variables use `{{name}}` and are resolved before provider calls. Use `\{{name}}` for a literal placeholder.
23
-
24
- Secrets must not appear in Templates. Pass credentials through `run({ credentials })`.
1
+ ---
2
+ title: Templates
3
+ ---
4
+
5
+ # Templates
6
+
7
+ Templates are code-defined, immutable, secret-free run configurations.
8
+
9
+ Allowed Template content:
10
+
11
+ - model;
12
+ - system prompt;
13
+ - queued user messages;
14
+ - typed variables;
15
+ - MCP server declarations;
16
+ - MCP tool allow/deny policy;
17
+ - environment package and network configuration;
18
+ - inline/local/provider skills;
19
+ - output conventions;
20
+ - non-secret metadata.
21
+
22
+ Variables use `{{name}}` and are resolved before provider calls. Use `\{{name}}` for a literal placeholder.
23
+
24
+ Secrets must not appear in Templates. Pass credentials through `run({ credentials })`.
package/docs/testing.md CHANGED
@@ -1,27 +1,26 @@
1
- ---
2
- title: Testing
3
- ---
4
-
5
- # Testing
6
-
7
- antpath uses test-first development.
8
-
9
- Commands:
10
-
11
- ```text
12
- npm run test:unit
13
- npm run test:integration:components
14
- npm run test:integration:api
15
- npm run test:e2e:live
16
- ```
17
-
18
- Live tests require `.env.local` and `RUN_LIVE_ANTPATH_TESTS=1`.
19
-
20
- Recorded API fixtures are created with:
21
-
22
- ```text
23
- npm run fixtures:record:anthropic
24
- npm run fixtures:sanitize
25
- ```
26
-
27
- Raw fixtures and secret-shaped fixture files are ignored.
1
+ ---
2
+ title: Testing
3
+ ---
4
+
5
+ # Testing
6
+
7
+ antpath uses test-first development.
8
+
9
+ Commands:
10
+
11
+ ```text
12
+ npm run test:unit
13
+ npm run test:unit:recorded
14
+ npm run test:e2e:live
15
+ ```
16
+
17
+ Unit tests are deterministic and may use fakes or sanitized recorded snapshots. Live tests run when `npm run test:e2e:live` is invoked with `.env.local` containing `ANTHROPIC_API_KEY`.
18
+
19
+ Recorded API fixtures are created with:
20
+
21
+ ```text
22
+ npm run fixtures:record:anthropic
23
+ npm run fixtures:sanitize
24
+ ```
25
+
26
+ Raw fixtures and secret-shaped fixture files are ignored.
@@ -1,30 +1,30 @@
1
- import { AntpathClient, defineTemplate, requiredStaticBearer } from "antpath";
2
-
3
- const client = new AntpathClient({
4
- anthropicApiKey: process.env.ANTHROPIC_API_KEY
5
- });
6
-
7
- const template = defineTemplate({
8
- name: "mcp-static-bearer",
9
- model: "claude-haiku-4-5",
10
- messages: ["List the relevant records and summarize them."],
11
- mcpServers: {
12
- example: {
13
- url: "https://mcp.example.com/mcp",
14
- auth: requiredStaticBearer(),
15
- tools: { allow: ["search", "fetch"] }
16
- }
17
- }
18
- });
19
-
20
- const handle = await client.run(template, {
21
- credentials: {
22
- example: {
23
- type: "static_bearer",
24
- token: process.env.EXAMPLE_MCP_TOKEN ?? ""
25
- }
26
- }
27
- });
28
-
29
- await handle.wait();
30
- await handle.cleanup();
1
+ import { AntpathClient, defineTemplate, requiredStaticBearer } from "antpath";
2
+
3
+ const client = new AntpathClient({
4
+ anthropicApiKey: process.env.ANTHROPIC_API_KEY
5
+ });
6
+
7
+ const template = defineTemplate({
8
+ name: "mcp-static-bearer",
9
+ model: "claude-haiku-4-5",
10
+ messages: ["List the relevant records and summarize them."],
11
+ mcpServers: {
12
+ example: {
13
+ url: "https://mcp.example.com/mcp",
14
+ auth: requiredStaticBearer(),
15
+ tools: { allow: ["search", "fetch"] }
16
+ }
17
+ }
18
+ });
19
+
20
+ const handle = await client.run(template, {
21
+ credentials: {
22
+ example: {
23
+ type: "static_bearer",
24
+ token: process.env.EXAMPLE_MCP_TOKEN ?? ""
25
+ }
26
+ }
27
+ });
28
+
29
+ await handle.wait();
30
+ await handle.cleanup();
@@ -1,23 +1,23 @@
1
- import { AntpathClient, defineTemplate, string } from "antpath";
2
-
3
- const client = new AntpathClient({
4
- anthropicApiKey: process.env.ANTHROPIC_API_KEY
5
- });
6
-
7
- const template = defineTemplate({
8
- name: "quickstart",
9
- model: "claude-haiku-4-5",
10
- system: "You are a concise automation agent.",
11
- messages: ["Write a short answer about {{topic}}."],
12
- variables: {
13
- topic: string()
14
- }
15
- });
16
-
17
- const handle = await client.run(template, {
18
- variables: { topic: "test-first SDK design" }
19
- });
20
-
21
- const result = await handle.wait();
22
- console.log(result.status);
23
- await handle.cleanup();
1
+ import { AntpathClient, defineTemplate, string } from "antpath";
2
+
3
+ const client = new AntpathClient({
4
+ anthropicApiKey: process.env.ANTHROPIC_API_KEY
5
+ });
6
+
7
+ const template = defineTemplate({
8
+ name: "quickstart",
9
+ model: "claude-haiku-4-5",
10
+ system: "You are a concise automation agent.",
11
+ messages: ["Write a short answer about {{topic}}."],
12
+ variables: {
13
+ topic: string()
14
+ }
15
+ });
16
+
17
+ const handle = await client.run(template, {
18
+ variables: { topic: "test-first SDK design" }
19
+ });
20
+
21
+ const result = await handle.wait();
22
+ console.log(result.status);
23
+ await handle.cleanup();