@kindgi/sdk 0.1.4-rc.3 → 0.1.4-rc.5

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.3",
3
+ "version": "0.1.4-rc.5",
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.3",
59
- "@kindgi/client": "0.1.4-rc.3",
60
- "@kindgi/crypto": "0.1.4-rc.3",
61
- "@kindgi/flow": "0.1.4-rc.3",
62
- "@kindgi/guardrails": "0.1.4-rc.3",
63
- "@kindgi/handler-runtime": "0.1.4-rc.3",
64
- "@kindgi/schema": "0.1.4-rc.3",
65
- "@kindgi/tools": "0.1.4-rc.3",
66
- "@kindgi/types": "0.1.4-rc.3"
58
+ "@kindgi/agents": "0.1.4-rc.5",
59
+ "@kindgi/client": "0.1.4-rc.5",
60
+ "@kindgi/crypto": "0.1.4-rc.5",
61
+ "@kindgi/flow": "0.1.4-rc.5",
62
+ "@kindgi/guardrails": "0.1.4-rc.5",
63
+ "@kindgi/handler-runtime": "0.1.4-rc.5",
64
+ "@kindgi/schema": "0.1.4-rc.5",
65
+ "@kindgi/tools": "0.1.4-rc.5",
66
+ "@kindgi/types": "0.1.4-rc.5"
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.3"
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.
@@ -22,7 +22,7 @@ description: >
22
22
  kindgi-getting-started.
23
23
  type: core
24
24
  library: "@kindgi/sdk"
25
- version: "0.9.3"
25
+ version: "0.9.5"
26
26
  sdk_version: "0.0.0"
27
27
  pack_languages: [node, python]
28
28
  sources:
@@ -241,7 +241,14 @@ capability requirement (see "How the router picks…" below).
241
241
 
242
242
  Nothing to switch off: `dev-echo` is a fallback, so the new provider
243
243
  answers every agent it satisfies. A turn that still lands on dev-echo
244
- carries a `fallback-provider` warning — see mistake 9.
244
+ carries the `fallback-provider` and `dev-echo-not-a-model` warnings — see
245
+ mistake 9.
246
+
247
+ **The other one-key presets** work the same way, with their own key:
248
+ `--preset=openai` (`OPENAI_API_KEY`), `--preset=gemini-api` (`GEMINI_API_KEY`,
249
+ a Google AI Studio key; `gemini` is Vertex AI), `--preset=groq`
250
+ (`GROQ_API_KEY`) and `--preset=openrouter` (`OPENROUTER_API_KEY`).
251
+ `kindgi providers presets` lists them with their models.
245
252
 
246
253
  ## Path B — Hosted via OpenAI-compat
247
254
 
@@ -305,15 +312,23 @@ kindgi secrets set GROQ_API_KEY --env=local --scope=tenant
305
312
 
306
313
  **Steps 3–5** same as Path A.
307
314
 
308
- ## Path C — Local via in-process ONNX
315
+ ## Path C — Local via in-process ONNX (runtime from source only)
316
+
317
+ > ⚠️ **Not in the runtime image, so not under `kindgi dev`.** The adapter
318
+ > runs ONNX through `onnxruntime-node`, which ships glibc binaries only,
319
+ > and the Kindgi runtime image is Alpine (musl): the adapter can't load
320
+ > there (`Error loading shared library ld-linux-…`). `kindgi dev` runs
321
+ > that image, so this path fails under it. It works only when the
322
+ > runtime itself runs from source on macOS or a glibc Linux. **For a
323
+ > local model under `kindgi dev`, use Ollama** ([Local via Ollama](#local-via-ollama-via-path-b)).
309
324
 
310
325
  > ⚠️ **Dev-only.** The in-process ONNX adapter writes weights to
311
326
  > `~/.cache/huggingface/hub/` — a per-machine cache with no production
312
327
  > recipe (no volume-mount recipe, no image-bake pattern, no offline
313
- > mode, no SHA pinning). Good for local dev, smoke tests, and CI
314
- > runners that keep the same disk between runs. **Do not ship packs
315
- > that rely on this adapter to production.** Use hosted providers
316
- > (Path A) or Ollama (Path B) instead.
328
+ > mode, no SHA pinning). Good for smoke tests and CI runners that run
329
+ > the runtime from source and keep the same disk between runs. **Do not
330
+ > ship packs that rely on this adapter to production.** Use hosted
331
+ > providers (Path A) or Ollama (Path B) instead.
317
332
 
318
333
  No API key. No network. Bundled with the framework — the adapter ships
319
334
  `smollm2-360m` by default (~273 MB weights, cached at
@@ -385,7 +400,8 @@ production. Skip only for scripted teardown where the model is already
385
400
  cached (`~/.cache/huggingface/hub/models--HuggingFaceTB--SmolLM2-360M-Instruct/`).
386
401
 
387
402
  `prepare` is idempotent: subsequent invocations are cache hits and
388
- return almost instantly, so put it in every `kindgi dev` boot script.
403
+ return almost instantly, so put it in the script that boots your
404
+ from-source runtime.
389
405
 
390
406
  Multi-model providers: prepare each model separately.
391
407
  ```sh
@@ -687,8 +703,9 @@ defineAgent({
687
703
  does nothing. Pin the model with a `models: { allow: [...] }`
688
704
  requirement instead.
689
705
 
690
- 9. **Replies still come from dev-echo** (`Tool responded: …`; the turn's
691
- result has a `fallback-provider` warning). dev-echo is a fallback: it
706
+ 9. **Replies still come from dev-echo** (`⚠ dev-echo isn't a real model: …`
707
+ then `Tool responded: …`; the turn's result has the `fallback-provider`
708
+ and `dev-echo-not-a-model` warnings). dev-echo is a fallback: it
692
709
  answers only when no registered provider satisfies the agent. So your
693
710
  provider doesn't — check its models' `features` against the agent's
694
711
  `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.0"
18
+ version: "0.1.3"
19
19
  sdk_version: "0.0.0"
20
20
  pack_languages: [python]
21
21
  sources:
@@ -25,9 +25,11 @@ sources:
25
25
 
26
26
  # Authoring Kindgi agents in Python
27
27
 
28
- > **Running `kindgi`:** a Python pack has no Node project, so the
29
- > `kindgi` CLI is the one on `PATH`. Python commands run in the pack's
30
- > environment: `uv run …` (or `.venv/bin/python …`).
28
+ > **Running `kindgi`:** the CLI is `kindgi-cli` from PyPI, pinned in the
29
+ > pack's dev group, so every `kindgi <command>` below runs as
30
+ > `uv run kindgi <command>` (Poetry: `poetry run kindgi <command>`). Python
31
+ > commands run in the pack's environment the same way: `uv run …` (or
32
+ > `.venv/bin/python …`).
31
33
 
32
34
  An **agent** is a versioned, model-driven orchestrator: instructions (a
33
35
  prompt template), the tools it may call, the capabilities its model
@@ -75,7 +77,7 @@ brief_writer = Agent(
75
77
  instructions=(
76
78
  "You are drafting a brief in {{ jurisdiction }}. The user provides the case "
77
79
  "facts; you produce a Section IV argument citing at least two precedents. "
78
- "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."
79
81
  ),
80
82
  capabilities=[{"needs": [{"feature": "tool-use"}]}],
81
83
  tools=[verify_citation, fetch_precedent], # Tool objects — or {"id", "version"} refs
@@ -109,7 +111,11 @@ brief_writer = Agent(
109
111
  `parameters` or the runtime's own variables (`today`, `now`,
110
112
  `agent.*`, `conversation.*`), rendered strictly: an unknown variable
111
113
  fails the turn. Write it as a brief for a capable colleague: what to
112
- 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.
113
119
  - **`capabilities`** — what the model must support, e.g.
114
120
  `[{"needs": [{"feature": "tool-use"}]}]`. The turn routes its first
115
121
  capability to pick a provider and model; none declared fails the turn.
@@ -159,8 +165,9 @@ brief_writer = Agent(
159
165
  Agents run on a registered model provider; the router picks one whose
160
166
  models satisfy `capabilities`. `kindgi dev` gives a new pack `dev-echo`,
161
167
  a **fallback** that answers only while no other provider fits — it
162
- calls the first tool and replies "Tool responded: …", and the turn
163
- 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
164
171
  takes over: see `kindgi-authoring-providers`
165
172
  (`kindgi providers register --preset=anthropic`).
166
173
 
@@ -16,7 +16,7 @@ description: >
16
16
  kindgi-python-authoring-agents.
17
17
  type: core
18
18
  library: "kindgi (Python)"
19
- version: "0.1.1"
19
+ version: "0.1.2"
20
20
  sdk_version: "0.0.0"
21
21
  pack_languages: [python]
22
22
  sources:
@@ -27,9 +27,11 @@ sources:
27
27
 
28
28
  # Authoring Kindgi flows in Python
29
29
 
30
- > **Running `kindgi`:** a Python pack has no Node project, so the
31
- > `kindgi` CLI is the one on `PATH`. Python commands run in the pack's
32
- > environment: `uv run …` (or `.venv/bin/python …`).
30
+ > **Running `kindgi`:** the CLI is `kindgi-cli` from PyPI, pinned in the
31
+ > pack's dev group, so every `kindgi <command>` below runs as
32
+ > `uv run kindgi <command>` (Poetry: `poetry run kindgi <command>`). Python
33
+ > commands run in the pack's environment the same way: `uv run …` (or
34
+ > `.venv/bin/python …`).
33
35
 
34
36
  A **flow** is a versioned, durable graph of steps: tools (your code) and
35
37
  agents (a model's judgment), joined by edges that can carry conditions.
@@ -14,7 +14,7 @@ description: >
14
14
  kindgi-python-authoring-tools.
15
15
  type: core
16
16
  library: "kindgi (Python)"
17
- version: "0.1.1"
17
+ version: "0.1.3"
18
18
  sdk_version: "0.0.0"
19
19
  pack_languages: [python]
20
20
  sources:
@@ -25,9 +25,11 @@ sources:
25
25
 
26
26
  # Authoring Kindgi guardrails in Python
27
27
 
28
- > **Running `kindgi`:** a Python pack has no Node project, so the
29
- > `kindgi` CLI is the one on `PATH`. Python commands run in the pack's
30
- > environment: `uv run …` (or `.venv/bin/python …`).
28
+ > **Running `kindgi`:** the CLI is `kindgi-cli` from PyPI, pinned in the
29
+ > pack's dev group, so every `kindgi <command>` below runs as
30
+ > `uv run kindgi <command>` (Poetry: `poetry run kindgi <command>`). Python
31
+ > commands run in the pack's environment the same way: `uv run …` (or
32
+ > `.venv/bin/python …`).
31
33
 
32
34
  A **guardrail** is a rule an agent's turn must satisfy: a **check** (a
33
35
  function over the turn's trace) plus an **action** (what happens when it
@@ -49,7 +51,7 @@ from kindgi import CheckResult, RunTrace, guardrail
49
51
 
50
52
 
51
53
  class Config(BaseModel):
52
- min_lookups: int = Field(1, alias="minLookups", ge=0)
54
+ min_lookups: int = Field(default=1, alias="minLookups", ge=0)
53
55
 
54
56
 
55
57
  @guardrail(
@@ -14,7 +14,7 @@ description: >
14
14
  kindgi-python-getting-started.
15
15
  type: core
16
16
  library: "kindgi (Python)"
17
- version: "0.1.1"
17
+ version: "0.1.2"
18
18
  sdk_version: "0.0.0"
19
19
  pack_languages: [python]
20
20
  sources:
@@ -25,9 +25,11 @@ sources:
25
25
 
26
26
  # Authoring Kindgi tools in Python
27
27
 
28
- > **Running `kindgi`:** a Python pack has no Node project, so the
29
- > `kindgi` CLI is the one on `PATH`. Python commands run in the pack's
30
- > environment: `uv run …` (or `.venv/bin/python …`).
28
+ > **Running `kindgi`:** the CLI is `kindgi-cli` from PyPI, pinned in the
29
+ > pack's dev group, so every `kindgi <command>` below runs as
30
+ > `uv run kindgi <command>` (Poetry: `poetry run kindgi <command>`). Python
31
+ > commands run in the pack's environment the same way: `uv run …` (or
32
+ > `.venv/bin/python …`).
31
33
 
32
34
  A **tool** is a unit of work an agent (or a flow step) calls: typed
33
35
  input, typed output, your code in between. In a Python pack it is a
@@ -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.5"
17
+ version: "0.1.7"
18
18
  sdk_version: "0.0.0"
19
19
  pack_languages: [python]
20
20
  sources:
@@ -25,9 +25,11 @@ sources:
25
25
 
26
26
  # Getting started with Kindgi in Python
27
27
 
28
- > **Running `kindgi`:** a Python pack has no Node project, so the
29
- > `kindgi` CLI (a Node 22.12+ program) is the one on `PATH`. Python
30
- > commands run in the pack's environment: `uv run …`.
28
+ > **Running `kindgi`:** the CLI is `kindgi-cli` from PyPI (the Kindgi CLI
29
+ > with its own Node, so no Node install), pinned in the pack's dev group.
30
+ > Every `kindgi <command>` below runs as `uv run kindgi <command>` (Poetry:
31
+ > `poetry run kindgi <command>`). Python commands run in the pack's
32
+ > environment the same way: `uv run …`.
31
33
 
32
34
  ## What a pack is
33
35
 
@@ -52,11 +54,11 @@ primitive; `test_*.py`, `*_test.py` and `conftest.py` are skipped.
52
54
  ## Scaffold a new pack
53
55
 
54
56
  ```sh
55
- kindgi init my-pack --template=python
57
+ uvx --from "kindgi-cli>=0.1,<0.2" kindgi init my-pack --template=python
56
58
  cd my-pack
57
- uv sync # .venv with the kindgi package
59
+ uv sync # .venv with the kindgi package and the kindgi CLI
58
60
  uv run pytest
59
- kindgi dev # boots Kindgi locally and runs this pack, reloading on save
61
+ uv run kindgi dev # boots Kindgi locally and runs this pack, reloading on save
60
62
  ```
61
63
 
62
64
  `kindgi dev` needs Postgres: it starts one in Docker unless
@@ -70,9 +72,10 @@ kindgi dev # boots Kindgi locally and runs this pack, reloading on save
70
72
  In the app's directory (where its `pyproject.toml` is):
71
73
 
72
74
  ```sh
73
- kindgi init # --pack-id=<id> if the app's name doesn't make one
75
+ uv add --dev "kindgi-cli>=0.1,<0.2" # the CLI (Poetry: poetry add --group dev …)
76
+ uv run kindgi init # --pack-id=<id> if the app's name doesn't make one
74
77
  uv sync # or what it prints for Poetry / pip
75
- kindgi dev
78
+ uv run kindgi dev
76
79
  ```
77
80
 
78
81
  `kindgi init` edits the app's `pyproject.toml` in place — your layout and
@@ -116,17 +119,20 @@ The `[tool.kindgi]` keys are the ones `kindgi.config.ts` takes —
116
119
  With `kindgi dev` running, from another terminal in the pack directory:
117
120
 
118
121
  ```sh
119
- kindgi runs start --agent=my-pack.echo-agent --input='{"userMessage":"Ada"}'
122
+ uv run kindgi runs start --agent=my-pack.echo-agent --input='{"userMessage":"Ada"}'
120
123
  ```
121
124
 
122
125
  The answer comes from `dev-echo`, a **fallback** provider a new pack
123
- gets: no model, no key — it calls the first tool and replies "Tool
124
- responded: …", and the turn carries a `fallback-provider` warning. For
125
- 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):
126
132
 
127
133
  ```sh
128
- kindgi secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt
129
- kindgi providers register --preset=anthropic
134
+ uv run kindgi secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt
135
+ uv run kindgi providers register --preset=anthropic
130
136
  ```
131
137
 
132
138
  It takes over at the next turn. That registration is in this project's dev