@coalex-ai/sdk 2.2.0 → 2.2.1-beta.670

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 (2) hide show
  1. package/README.md +31 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -28,7 +28,7 @@ await autoInstrumentAsync();
28
28
 
29
29
  // 3. Wrap agent invocations for tracing
30
30
  // `version` is the build this agent is running. It is optional today and omitting it logs a
31
- // warning (COA-2636): a trace with no version cannot be attributed to a build, and the
31
+ // warning once per agent: a trace with no version cannot be attributed to a build, and the
32
32
  // dashboard records it as `unknown`. It will become required in a future major release.
33
33
  const result = await coalexContext({ agentId: "support-agent", version: "1.4.0" }, async () => {
34
34
  // Your AI agent logic here
@@ -52,6 +52,28 @@ register({
52
52
  });
53
53
  ```
54
54
 
55
+ To have the agent appear in the Console without anyone registering it by hand, pass `declare`. The
56
+ declaration is best-effort: a failure is logged and the agent still starts and traces. Without
57
+ `declare`, `register()` makes no network call.
58
+
59
+ ```typescript
60
+ register({
61
+ apiKey: "your-api-key",
62
+ serviceName: "my-agent",
63
+ declare: {
64
+ endpoint: "https://my-agent.example.com/turn", // where the Console POSTs a turn
65
+ tools: ["wire_funds"], // tool names only
66
+ resumeUrl: "https://my-agent.example.com/resume", // if the agent supports being paused
67
+ displayName: "Payments agent", // title of a new chat in the Console
68
+ description: "Ask me about wire transfers.", // shown as the agent's first message
69
+ suggestedPrompts: ["Show pending wires"], // shown as buttons that send that text
70
+ },
71
+ });
72
+ ```
73
+
74
+ An agent that declares no `displayName`, `description` or `suggestedPrompts` is shown by its name
75
+ alone. Whether a tool is governed and who may approve it are set in the dashboard, not here.
76
+
55
77
  ### `autoInstrumentAsync(options?)`
56
78
 
57
79
  Instrument AI libraries using dynamic `import()`. Use this in ESM projects.
@@ -131,14 +153,20 @@ Submit an AI output for evaluation. Returns the governance decision.
131
153
 
132
154
  ```typescript
133
155
  const decision = await evaluate({
134
- traceId: "abc-123",
156
+ requestId: "abc-123",
135
157
  input: { question: "What is the policy?" },
136
158
  output: { answer: "The policy states..." },
137
159
  metrics: { answer: ["f1", "rouge_l"] },
160
+ toolName: "wire_funds", // optional: the tool this call is about
138
161
  });
139
- // { status: "auto_approved" | "escalated" | "rejected", riskScore: 0.12, escalationId?: "..." }
162
+ // { status: "auto_approved" | "escalated", riskScore: 0.12, escalationId?: "..." }
140
163
  ```
141
164
 
165
+ `toolName` is stored on the escalation and in the decision's audit-chain entry, so an auditor reads
166
+ which action a person approved, declined or let expire. Only the name is sent there; the tool's
167
+ arguments stay in `input` and `output`. Omitted, the platform reads a `tool` key from `output`,
168
+ `input` or `metadata`. `traceId` is a deprecated alias of `requestId`.
169
+
142
170
  Available metrics: `f1`, `word_overlap`, `bleu`, `rouge_l`, `exact_match`, `levenshtein`, `contains`.
143
171
 
144
172
  ### `resolve(options)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coalex-ai/sdk",
3
- "version": "2.2.0",
3
+ "version": "2.2.1-beta.670",
4
4
  "description": "Coalex TypeScript SDK for AI governance observability",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -46,7 +46,7 @@
46
46
  "vitest": "^5.0.2",
47
47
  "eslint": "^10.0.0",
48
48
  "@eslint/js": "^10.0.0",
49
- "typescript-eslint": "^8.70.1"
49
+ "typescript-eslint": "^8.71.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@opentelemetry/instrumentation": ">=0.200.0"