@kindgi/sdk 0.1.4-rc.4 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kindgi/sdk",
3
- "version": "0.1.4-rc.4",
3
+ "version": "0.1.4",
4
4
  "description": "@kindgi/sdk — the authoring SDK for Kindgi™. Facade over the individual @kindgi/* packages + @kindgi/client. Unifies pack authoring (defineTool / defineCheck / defineAgent / defineFlow) and client callsites (createClient) behind three sub-paths: /define, /client, /types. Re-export facade; zero behavior.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -55,15 +55,15 @@
55
55
  "README.md"
56
56
  ],
57
57
  "dependencies": {
58
- "@kindgi/agents": "0.1.4-rc.4",
59
- "@kindgi/client": "0.1.4-rc.4",
60
- "@kindgi/crypto": "0.1.4-rc.4",
61
- "@kindgi/flow": "0.1.4-rc.4",
62
- "@kindgi/guardrails": "0.1.4-rc.4",
63
- "@kindgi/handler-runtime": "0.1.4-rc.4",
64
- "@kindgi/schema": "0.1.4-rc.4",
65
- "@kindgi/tools": "0.1.4-rc.4",
66
- "@kindgi/types": "0.1.4-rc.4"
58
+ "@kindgi/agents": "0.1.4",
59
+ "@kindgi/client": "0.1.4",
60
+ "@kindgi/crypto": "0.1.4",
61
+ "@kindgi/flow": "0.1.4",
62
+ "@kindgi/guardrails": "0.1.4",
63
+ "@kindgi/handler-runtime": "0.1.4",
64
+ "@kindgi/schema": "0.1.4",
65
+ "@kindgi/tools": "0.1.4",
66
+ "@kindgi/types": "0.1.4"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "zod": "^4.0.0"
@@ -12,7 +12,7 @@ description: >
12
12
  kindgi-authoring-guardrails.
13
13
  type: core
14
14
  library: "@kindgi/sdk"
15
- version: "0.4.2"
15
+ version: "0.4.4"
16
16
  sdk_version: "0.0.0"
17
17
  pack_languages: [node]
18
18
  sources:
@@ -63,7 +63,7 @@ const defined = defineAgent({
63
63
  description:
64
64
  'Drafts appellate briefs from a case file. Cites precedents; escalates novel legal questions.',
65
65
  instructions:
66
- 'You are drafting a brief in {{ jurisdiction }}. The user provides the case facts; you produce a Section IV argument citing at least two precedents. Use `acme.verify-citation` on every cite before including it. Refuse to fabricate citations — always call the tool.',
66
+ 'You are drafting a brief in {{ jurisdiction }}. The user provides the case facts; you produce a Section IV argument citing at least two precedents. Check every cite with the verify-citation tool before including it. Refuse to fabricate citations — always call the tool.',
67
67
  capabilities: [{ needs: [{ feature: 'tool-use' as const }] }],
68
68
  tools: [
69
69
  { id: 'acme.verify-citation', version: '^0.1.0' },
@@ -96,7 +96,11 @@ export default defined.value;
96
96
  `conversation.*`). Rendered with `strictVariables: true` — unresolved
97
97
  references fail loudly at invoke time. Frame instructions like a
98
98
  competent employee brief: what the agent does, what tools to prefer,
99
- what to refuse, what quality bar to hit.
99
+ what to refuse, what quality bar to hit. Name a tool by what it does
100
+ ("the verify-citation tool"), never by its dotted id: the model sees
101
+ ids in its provider's form (`acme__verify-citation` for Anthropic and
102
+ OpenAI-compatible models), and `acme.verify-citation` in the
103
+ instructions can make it call a name it wasn't given.
100
104
  - **`capabilities`** — declares the resource kinds the agent needs at
101
105
  runtime. `{feature: 'tool-use'}` is standard for tool-calling
102
106
  agents. The router picks the concrete LLM provider at turn time.
@@ -121,10 +125,10 @@ export default defined.value;
121
125
  capability-based selection when the preferred provider is
122
126
  unregistered or filtered out.
123
127
  - **`preferredModel`** — optional soft hint at the model level: set to
124
- a `ModelInfo.name` (e.g. `'gemini-2.5-pro'`), the router prefers
128
+ a `ModelInfo.name` (e.g. `'gemini-3.8-flash'`), the router prefers
125
129
  `(provider, model)` tuples whose model matches. To require a model
126
130
  rather than prefer it, add a hard requirement to the capability:
127
- `capabilities: [{ needs: [{ feature: 'tool-use' }, { models: { allow: ['gemini-2.5-pro'] } }] }]`.
131
+ `capabilities: [{ needs: [{ feature: 'tool-use' }, { models: { allow: ['gemini-3.8-flash'] } }] }]`.
128
132
  - **`conversationPolicy`** — optional. Absent = each turn loads the
129
133
  conversation's full history and no HITL gates apply. `historyLimit`
130
134
  caps how many prior messages are loaded; `hitl` configures approval
@@ -5,8 +5,9 @@ description: >
5
5
  can actually call a real model. Covers four paths — hosted via
6
6
  Anthropic native adapter, Gemini on Vertex AI (Google Application
7
7
  Default Credentials, no API key), hosted via the OpenAI-compat adapter
8
- (works with OpenAI + Groq + Together + Fireworks + OpenRouter +
9
- Ollama + vLLM + any other OpenAI-compatible endpoint), and local
8
+ (works with OpenAI, Groq, self-hosted vLLM and Ollama, and any other
9
+ OpenAI-compatible endpoint, a hosted gateway such as OpenRouter
10
+ included), and local
10
11
  via the in-process ONNX adapter — plus the credential flow (in
11
12
  `kindgi dev` the key lives in the project's env files — `.env`, then
12
13
  `.env.local` — added by hand or with `kindgi secrets set`'s no-echo
@@ -22,7 +23,7 @@ description: >
22
23
  kindgi-getting-started.
23
24
  type: core
24
25
  library: "@kindgi/sdk"
25
- version: "0.9.4"
26
+ version: "0.9.8"
26
27
  sdk_version: "0.0.0"
27
28
  pack_languages: [node, python]
28
29
  sources:
@@ -106,7 +107,11 @@ yours.
106
107
  ## Path A — Hosted, native Anthropic
107
108
 
108
109
  Best fidelity to Anthropic's API (prompt caching, latest models, tool
109
- use, structured output). Requires an `ANTHROPIC_API_KEY`.
110
+ use). Requires an `ANTHROPIC_API_KEY`.
111
+
112
+ A model's `structured-output` feature is a routing label: the model can
113
+ follow a JSON schema natively, but Kindgi's typed outputs use instructions,
114
+ then parse, check against the schema and repair, on every provider.
110
115
 
111
116
  **Step 1 — set the key:**
112
117
  ```sh
@@ -123,9 +128,18 @@ credential on argv.
123
128
 
124
129
  **Step 2 — register it, from the preset:**
125
130
  ```sh
126
- kindgi providers register --preset=anthropic # Opus 5.5, Sonnet 5.5, Haiku 4.5
127
- kindgi providers register --preset=anthropic --models=claude-haiku-4-5 # just one
131
+ kindgi providers register --preset=anthropic # Opus 5.5, Sonnet 5.5 (default), Haiku 5.5, Haiku 4.5
132
+ kindgi providers register --preset=anthropic --models=claude-sonnet-5-5 # just one
128
133
  ```
134
+ Don't pin `claude-haiku-4-5`: Anthropic retires it on or after 2026-10-15,
135
+ and a turn routed to it then fails; `claude-haiku-5-5` replaces it. Each
136
+ preset names a default model (`metadata.defaultModel`, marked `(default)`
137
+ when it registers), which an agent with no preference gets. A preset
138
+ registered before 0.1.4 has none: unregister it and register it again.
139
+ The Claude 5.5 and GPT-6 models take no `temperature` (`"sampling": false`:
140
+ the call goes without it, with a `sampling-unsupported` warning), and a
141
+ model's `thinking` says how it thinks; thinking counts against
142
+ `maxOutputTokens` and bills as output.
129
143
  The preset carries the models, context windows, output limits and current
130
144
  prices (`kindgi providers presets` lists the presets and when their prices
131
145
  were checked); `--max-output-tokens=<n>` sets another output limit. In a pack it refuses until the key is in the pack's env files —
@@ -139,8 +153,8 @@ needs under `kindgi dev`:
139
153
  ```ts
140
154
  // in kindgi.config.ts
141
155
  providers: [
142
- { preset: 'anthropic', models: ['claude-haiku-4-5'] }, // key ANTHROPIC_API_KEY, from the env files
143
- { preset: 'gemini', project: 'acme-gcp', models: ['gemini-2.5-flash'] },
156
+ { preset: 'anthropic', models: ['claude-sonnet-5-5'] }, // key ANTHROPIC_API_KEY, from the env files
157
+ { preset: 'gemini', project: 'acme-gcp', models: ['gemini-3.8-flash'] },
144
158
  { spec: { /* the provider.json body below */ } },
145
159
  ],
146
160
  ```
@@ -148,7 +162,7 @@ providers: [
148
162
  # in pyproject.toml: one table per provider, same keys
149
163
  [[tool.kindgi.providers]]
150
164
  preset = "anthropic"
151
- models = ["claude-haiku-4-5"]
165
+ models = ["claude-sonnet-5-5"]
152
166
  ```
153
167
  - A preset entry takes `models`, `project`, `secret` (the key's name, in place
154
168
  of the preset's) and `maxOutputTokens`, spelled the same in `pyproject.toml`;
@@ -167,7 +181,7 @@ models = ["claude-haiku-4-5"]
167
181
  providers with `kindgi providers register`.
168
182
 
169
183
  **Step 2 (by hand) — write `provider.json`** at the pack root. One connection,
170
- three models — matches how the Anthropic SDK actually works (the API
184
+ two models — matches how the Anthropic SDK actually works (the API
171
185
  key is per-vendor; the model is per-call):
172
186
  ```json
173
187
  {
@@ -194,16 +208,6 @@ key is per-vendor; the model is per-call):
194
208
  "completionUsdPer1kTokens": 0.01
195
209
  },
196
210
  "description": "Balanced performance/cost."
197
- },
198
- {
199
- "name": "claude-haiku-4-5",
200
- "contextWindow": 200000,
201
- "features": ["tool-use"],
202
- "cost": {
203
- "promptUsdPer1kTokens": 0.001,
204
- "completionUsdPer1kTokens": 0.005
205
- },
206
- "description": "Fastest and cheapest — routing, classification, simple calls."
207
211
  }
208
212
  ],
209
213
  "description": "Anthropic Claude via native adapter."
@@ -241,7 +245,14 @@ capability requirement (see "How the router picks…" below).
241
245
 
242
246
  Nothing to switch off: `dev-echo` is a fallback, so the new provider
243
247
  answers every agent it satisfies. A turn that still lands on dev-echo
244
- carries a `fallback-provider` warning — see mistake 9.
248
+ carries the `fallback-provider` and `dev-echo-not-a-model` warnings — see
249
+ mistake 9.
250
+
251
+ **The other one-key presets** work the same way, with their own key:
252
+ `--preset=openai` (`OPENAI_API_KEY`), `--preset=gemini-api` (`GEMINI_API_KEY`,
253
+ a Google AI Studio key; `gemini` is Vertex AI), `--preset=groq`
254
+ (`GROQ_API_KEY`) and `--preset=openrouter` (`OPENROUTER_API_KEY`).
255
+ `kindgi providers presets` lists them with their models.
245
256
 
246
257
  ## Path B — Hosted via OpenAI-compat
247
258
 
@@ -254,9 +265,9 @@ Works with **any** OpenAI-compatible endpoint. Same adapter, different
254
265
  | Groq | `https://api.groq.com/openai/v1` |
255
266
  | Together | `https://api.together.xyz/v1` |
256
267
  | Fireworks | `https://api.fireworks.ai/inference/v1` |
257
- | OpenRouter | `https://openrouter.ai/api/v1` |
258
268
  | DeepSeek | `https://api.deepseek.com/v1` |
259
269
  | LiteLLM proxy | `http://localhost:4000/v1` |
270
+ | OpenRouter (a hosted gateway) | `https://openrouter.ai/api/v1` |
260
271
 
261
272
  The connection carries the `baseURL` (in `adapter_config`);
262
273
  each endpoint is a separate provider row because each has its own API
@@ -478,24 +489,16 @@ outside Google Cloud: put a service-account key (its JSON) in a secret
478
489
  "region": "global",
479
490
  "models": [
480
491
  {
481
- "name": "gemini-2.5-pro",
492
+ "name": "gemini-3.8-flash",
482
493
  "contextWindow": 1048576,
483
- "features": ["tool-use"],
494
+ "features": ["tool-use", "structured-output", "long-context"],
484
495
  "maxOutputTokens": 65536,
485
- "cost": {
486
- "promptUsdPer1kTokens": 0.00125,
487
- "completionUsdPer1kTokens": 0.01,
488
- "longContext": {
489
- "thresholdTokens": 200000,
490
- "promptUsdPer1kTokens": 0.0025,
491
- "completionUsdPer1kTokens": 0.015
492
- }
493
- }
496
+ "cost": { "promptUsdPer1kTokens": 0.00075, "completionUsdPer1kTokens": 0.00375 }
494
497
  },
495
498
  {
496
- "name": "gemini-2.5-flash",
499
+ "name": "gemini-3.5-flash-lite",
497
500
  "contextWindow": 1048576,
498
- "features": ["tool-use"],
501
+ "features": ["tool-use", "structured-output", "long-context"],
499
502
  "maxOutputTokens": 65536,
500
503
  "cost": { "promptUsdPer1kTokens": 0.0003, "completionUsdPer1kTokens": 0.0025 }
501
504
  }
@@ -510,11 +513,17 @@ outside Google Cloud: put a service-account key (its JSON) in a secret
510
513
  - `metadata.region` is the Vertex location: `global`, or a region such as
511
514
  `us-central1` or `northamerica-northeast1` when data must stay in one
512
515
  place. `unspecified` means `global`. Different locations are different
513
- provider rows.
516
+ provider rows. Check that the location serves the model: Gemini 3.8 Flash
517
+ isn't served from `us-central1`.
518
+ - Don't register `gemini-2.5-pro` or `gemini-2.5-flash`: Vertex AI retires
519
+ both on 2026-10-20.
514
520
  - Rates are per 1K tokens, from Google's published pricing; check them
515
- before relying on budgets. Thinking tokens bill as output.
516
- `longContext` switches the whole call to the higher rates past the
517
- threshold; `cachedPromptMultiplier` (default 0.25) prices cached
521
+ before relying on budgets. Thinking tokens bill as output, and Gemini 3.8
522
+ Flash thinks by default. `gemini-3.8-flash`'s rates above are Google's
523
+ launch price, through 2026-12-31 ($0.0015 / $0.0075 from 2027-01-01).
524
+ `longContext` (`{ thresholdTokens, promptUsdPer1kTokens,
525
+ completionUsdPer1kTokens }` in a model's `cost`) switches the whole call
526
+ to the higher rates past the threshold; `cachedPromptMultiplier` (default 0.25) prices cached
518
527
  prompt tokens.
519
528
 
520
529
  **Step 3 — register and check:**
@@ -546,8 +555,10 @@ tenant policy), then sorts survivors in this order:
546
555
  declares `prefer: [{feature: 'thinking', weight: 3}, ...]`, tuples
547
556
  with matching model features (or provider attributes) get higher
548
557
  scores. Sorted by summed score, descending.
549
- 3. **Deterministic lexical tiebreak.** When scores tie, tuples sort by
550
- `(providerId, modelName)` alphabetically — replay-safe and stable.
558
+ 3. **Deterministic tiebreak.** When scores tie, tuples sort by provider
559
+ id, then the provider's `defaultModel` before its other models, then
560
+ model name — replay-safe and stable. A provider without a
561
+ `defaultModel` falls back to its first model by name.
551
562
 
552
563
  **Practical rule:** preferences are soft — they rank, they don't
553
564
  exclude. To guarantee which model runs, make it a hard requirement in
@@ -696,8 +707,9 @@ defineAgent({
696
707
  does nothing. Pin the model with a `models: { allow: [...] }`
697
708
  requirement instead.
698
709
 
699
- 9. **Replies still come from dev-echo** (`Tool responded: …`; the turn's
700
- result has a `fallback-provider` warning). dev-echo is a fallback: it
710
+ 9. **Replies still come from dev-echo** (`⚠ dev-echo isn't a real model: …`
711
+ then `Tool responded: …`; the turn's result has the `fallback-provider`
712
+ and `dev-echo-not-a-model` warnings). dev-echo is a fallback: it
701
713
  answers only when no registered provider satisfies the agent. So your
702
714
  provider doesn't — check its models' `features` against the agent's
703
715
  `capabilities.needs` (mistake 2), a `models` / `providers` allow-list
@@ -15,7 +15,7 @@ description: >
15
15
  model by kindgi-authoring-providers.
16
16
  type: core
17
17
  library: "kindgi (Python)"
18
- version: "0.1.1"
18
+ version: "0.1.4"
19
19
  sdk_version: "0.0.0"
20
20
  pack_languages: [python]
21
21
  sources:
@@ -77,7 +77,7 @@ brief_writer = Agent(
77
77
  instructions=(
78
78
  "You are drafting a brief in {{ jurisdiction }}. The user provides the case "
79
79
  "facts; you produce a Section IV argument citing at least two precedents. "
80
- "Call acme.verify-citation on every cite before using it. Never invent one."
80
+ "Check every cite with the verify-citation tool before using it. Never invent one."
81
81
  ),
82
82
  capabilities=[{"needs": [{"feature": "tool-use"}]}],
83
83
  tools=[verify_citation, fetch_precedent], # Tool objects — or {"id", "version"} refs
@@ -111,7 +111,11 @@ brief_writer = Agent(
111
111
  `parameters` or the runtime's own variables (`today`, `now`,
112
112
  `agent.*`, `conversation.*`), rendered strictly: an unknown variable
113
113
  fails the turn. Write it as a brief for a capable colleague: what to
114
- do, which tools to prefer, what to refuse, the quality bar.
114
+ do, which tools to prefer, what to refuse, the quality bar. Name a
115
+ tool by what it does ("the verify-citation tool"), never by its dotted
116
+ id: the model sees ids in its provider's form (`acme__verify-citation`
117
+ for Anthropic and OpenAI-compatible models), and `acme.verify-citation`
118
+ in the instructions can make it call a name it wasn't given.
115
119
  - **`capabilities`** — what the model must support, e.g.
116
120
  `[{"needs": [{"feature": "tool-use"}]}]`. The turn routes its first
117
121
  capability to pick a provider and model; none declared fails the turn.
@@ -128,9 +132,9 @@ brief_writer = Agent(
128
132
  instructions.
129
133
  - **`preferred_provider`** / **`preferred_model`** — soft hints: the
130
134
  router prefers that provider id (e.g. `"anthropic"`) and/or model name
131
- (e.g. `"claude-haiku-4-5"`) when they satisfy the capabilities. To
135
+ (e.g. `"claude-sonnet-5-5"`) when they satisfy the capabilities. To
132
136
  *require* a model, put it in the capability:
133
- `{"needs": [{"feature": "tool-use"}, {"models": {"allow": ["claude-haiku-4-5"]}}]}`.
137
+ `{"needs": [{"feature": "tool-use"}, {"models": {"allow": ["claude-sonnet-5-5"]}}]}`.
134
138
  - **`conversation_policy`** — `{"historyLimit": n}` caps the prior
135
139
  messages loaded; `hitl` configures approval gates. Absent = the full
136
140
  history, no gates. A tenant's `hitl` policy can tighten the gates
@@ -161,8 +165,9 @@ brief_writer = Agent(
161
165
  Agents run on a registered model provider; the router picks one whose
162
166
  models satisfy `capabilities`. `kindgi dev` gives a new pack `dev-echo`,
163
167
  a **fallback** that answers only while no other provider fits — it
164
- calls the first tool and replies "Tool responded: …", and the turn
165
- carries a `fallback-provider` warning. Register a real model and it
168
+ calls the first tool and replies "⚠ dev-echo isn't a real model: …"
169
+ then "Tool responded: …", and the turn carries the `fallback-provider` and
170
+ `dev-echo-not-a-model` warnings. Register a real model and it
166
171
  takes over: see `kindgi-authoring-providers`
167
172
  (`kindgi providers register --preset=anthropic`).
168
173
 
@@ -14,7 +14,7 @@ description: >
14
14
  kindgi-python-authoring-tools.
15
15
  type: core
16
16
  library: "kindgi (Python)"
17
- version: "0.1.2"
17
+ version: "0.1.3"
18
18
  sdk_version: "0.0.0"
19
19
  pack_languages: [python]
20
20
  sources:
@@ -51,7 +51,7 @@ from kindgi import CheckResult, RunTrace, guardrail
51
51
 
52
52
 
53
53
  class Config(BaseModel):
54
- min_lookups: int = Field(1, alias="minLookups", ge=0)
54
+ min_lookups: int = Field(default=1, alias="minLookups", ge=0)
55
55
 
56
56
 
57
57
  @guardrail(
@@ -14,7 +14,7 @@ description: >
14
14
  kindgi-python-authoring-agents; models by kindgi-authoring-providers.
15
15
  type: core
16
16
  library: "kindgi (Python)"
17
- version: "0.1.6"
17
+ version: "0.1.7"
18
18
  sdk_version: "0.0.0"
19
19
  pack_languages: [python]
20
20
  sources:
@@ -123,9 +123,12 @@ uv run kindgi runs start --agent=my-pack.echo-agent --input='{"userMessage":"Ada
123
123
  ```
124
124
 
125
125
  The answer comes from `dev-echo`, a **fallback** provider a new pack
126
- gets: no model, no key — it calls the first tool and replies "Tool
127
- responded: …", and the turn carries a `fallback-provider` warning. For
128
- a real model, put the key in `.env` and register a provider:
126
+ gets: no model, no key — it calls the first tool and replies "⚠
127
+ dev-echo isn't a real model: …" then "Tool responded: …", and the turn
128
+ carries the `fallback-provider` and `dev-echo-not-a-model` warnings. For a
129
+ real model, put an LLM provider's key in `.env` and register its preset
130
+ (Anthropic below; `kindgi providers presets` lists OpenAI, Gemini, Groq and
131
+ OpenRouter too):
129
132
 
130
133
  ```sh
131
134
  uv run kindgi secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt