@kindgi/cli 0.1.4-rc.5 → 0.1.5-rc.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.
- package/README.md +16 -10
- package/dist/build/defaults.d.ts +3 -1
- package/dist/build/defaults.d.ts.map +1 -1
- package/dist/build/defaults.js +44 -1
- package/dist/build/defaults.js.map +1 -1
- package/dist/build/java-image.d.ts +31 -0
- package/dist/build/java-image.d.ts.map +1 -0
- package/dist/build/java-image.js +146 -0
- package/dist/build/java-image.js.map +1 -0
- package/dist/build/pack-root.d.ts +1 -31
- package/dist/build/pack-root.d.ts.map +1 -1
- package/dist/build/pack-root.js +22 -2
- package/dist/build/pack-root.js.map +1 -1
- package/dist/build/runners.d.ts +44 -0
- package/dist/build/runners.d.ts.map +1 -1
- package/dist/build/scala-image.d.ts +21 -0
- package/dist/build/scala-image.d.ts.map +1 -0
- package/dist/build/scala-image.js +150 -0
- package/dist/build/scala-image.js.map +1 -0
- package/dist/cli-pin.d.ts +16 -0
- package/dist/cli-pin.d.ts.map +1 -0
- package/dist/cli-pin.js +66 -0
- package/dist/cli-pin.js.map +1 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +9 -8
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/approvals.d.ts.map +1 -1
- package/dist/commands/approvals.js +30 -4
- package/dist/commands/approvals.js.map +1 -1
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +100 -37
- package/dist/commands/artifacts.js.map +1 -1
- package/dist/commands/auth.js +2 -2
- package/dist/commands/blocks.d.ts.map +1 -1
- package/dist/commands/blocks.js +5 -4
- package/dist/commands/blocks.js.map +1 -1
- package/dist/commands/build.d.ts +10 -2
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +109 -16
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/capabilities.d.ts.map +1 -1
- package/dist/commands/capabilities.js +37 -10
- package/dist/commands/capabilities.js.map +1 -1
- package/dist/commands/console.d.ts +21 -0
- package/dist/commands/console.d.ts.map +1 -0
- package/dist/commands/console.js +87 -0
- package/dist/commands/console.js.map +1 -0
- package/dist/commands/conversations.d.ts.map +1 -1
- package/dist/commands/conversations.js +13 -2
- package/dist/commands/conversations.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +2 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +11 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +211 -39
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +18 -5
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +421 -21
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env-scoped.d.ts +44 -0
- package/dist/commands/env-scoped.d.ts.map +1 -0
- package/dist/commands/env-scoped.js +222 -0
- package/dist/commands/env-scoped.js.map +1 -0
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +85 -123
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/eval-runs.d.ts +9 -0
- package/dist/commands/eval-runs.d.ts.map +1 -1
- package/dist/commands/eval-runs.js +20 -19
- package/dist/commands/eval-runs.js.map +1 -1
- package/dist/commands/eval-suites.d.ts.map +1 -1
- package/dist/commands/eval-suites.js +16 -8
- package/dist/commands/eval-suites.js.map +1 -1
- package/dist/commands/exports.d.ts +3 -0
- package/dist/commands/exports.d.ts.map +1 -0
- package/dist/commands/exports.js +82 -0
- package/dist/commands/exports.js.map +1 -0
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +6 -5
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/flows.d.ts.map +1 -1
- package/dist/commands/flows.js +2 -1
- package/dist/commands/flows.js.map +1 -1
- package/dist/commands/gate-policies.d.ts.map +1 -1
- package/dist/commands/gate-policies.js +2 -1
- package/dist/commands/gate-policies.js.map +1 -1
- package/dist/commands/guardrails.d.ts.map +1 -1
- package/dist/commands/guardrails.js +3 -2
- package/dist/commands/guardrails.js.map +1 -1
- package/dist/commands/helpers.js +5 -5
- package/dist/commands/helpers.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +14 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +254 -18
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/judge-classes.d.ts.map +1 -1
- package/dist/commands/judge-classes.js +11 -10
- package/dist/commands/judge-classes.js.map +1 -1
- package/dist/commands/judgments.d.ts.map +1 -1
- package/dist/commands/judgments.js +7 -6
- package/dist/commands/judgments.js.map +1 -1
- package/dist/commands/key.js +4 -4
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +277 -25
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/people.d.ts +3 -0
- package/dist/commands/people.d.ts.map +1 -0
- package/dist/commands/people.js +166 -0
- package/dist/commands/people.js.map +1 -0
- package/dist/commands/proposals.d.ts.map +1 -1
- package/dist/commands/proposals.js +390 -69
- package/dist/commands/proposals.js.map +1 -1
- package/dist/commands/provenance.d.ts.map +1 -1
- package/dist/commands/provenance.js +6 -7
- package/dist/commands/provenance.js.map +1 -1
- package/dist/commands/providers.d.ts.map +1 -1
- package/dist/commands/providers.js +46 -7
- package/dist/commands/providers.js.map +1 -1
- package/dist/commands/reviewers.d.ts.map +1 -1
- package/dist/commands/reviewers.js +3 -2
- package/dist/commands/reviewers.js.map +1 -1
- package/dist/commands/runs.d.ts.map +1 -1
- package/dist/commands/runs.js +24 -14
- package/dist/commands/runs.js.map +1 -1
- package/dist/commands/schedules.d.ts +3 -0
- package/dist/commands/schedules.d.ts.map +1 -0
- package/dist/commands/schedules.js +275 -0
- package/dist/commands/schedules.js.map +1 -0
- package/dist/commands/secrets.d.ts.map +1 -1
- package/dist/commands/secrets.js +10 -11
- package/dist/commands/secrets.js.map +1 -1
- package/dist/commands/service-accounts.d.ts +3 -0
- package/dist/commands/service-accounts.d.ts.map +1 -0
- package/dist/commands/service-accounts.js +175 -0
- package/dist/commands/service-accounts.js.map +1 -0
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +11 -4
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sso.d.ts +6 -0
- package/dist/commands/sso.d.ts.map +1 -0
- package/dist/commands/sso.js +318 -0
- package/dist/commands/sso.js.map +1 -0
- package/dist/commands/tokens.d.ts +11 -0
- package/dist/commands/tokens.d.ts.map +1 -1
- package/dist/commands/tokens.js +144 -11
- package/dist/commands/tokens.js.map +1 -1
- package/dist/commands/tools.d.ts.map +1 -1
- package/dist/commands/tools.js +4 -3
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/unwired.d.ts.map +1 -1
- package/dist/commands/unwired.js +1 -30
- package/dist/commands/unwired.js.map +1 -1
- package/dist/commands/upgrade.d.ts +11 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +160 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/context.d.ts +7 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -0
- package/dist/context.js.map +1 -1
- package/dist/dev/defaults.d.ts +28 -11
- package/dist/dev/defaults.d.ts.map +1 -1
- package/dist/dev/defaults.js +114 -35
- package/dist/dev/defaults.js.map +1 -1
- package/dist/dev/google-credentials.d.ts +50 -0
- package/dist/dev/google-credentials.d.ts.map +1 -0
- package/dist/dev/google-credentials.js +157 -0
- package/dist/dev/google-credentials.js.map +1 -0
- package/dist/dev/java-builder.d.ts +56 -0
- package/dist/dev/java-builder.d.ts.map +1 -0
- package/dist/dev/java-builder.js +204 -0
- package/dist/dev/java-builder.js.map +1 -0
- package/dist/dev/jvm-run-files.d.ts +29 -0
- package/dist/dev/jvm-run-files.d.ts.map +1 -0
- package/dist/dev/jvm-run-files.js +94 -0
- package/dist/dev/jvm-run-files.js.map +1 -0
- package/dist/dev/lines.d.ts +13 -0
- package/dist/dev/lines.d.ts.map +1 -0
- package/dist/dev/lines.js +24 -0
- package/dist/dev/lines.js.map +1 -0
- package/dist/dev/log-view.d.ts +116 -0
- package/dist/dev/log-view.d.ts.map +1 -0
- package/dist/dev/log-view.js +233 -0
- package/dist/dev/log-view.js.map +1 -0
- package/dist/dev/pack-code.d.ts +79 -4
- package/dist/dev/pack-code.d.ts.map +1 -1
- package/dist/dev/pack-code.js +262 -3
- package/dist/dev/pack-code.js.map +1 -1
- package/dist/dev/pack-env.d.ts.map +1 -1
- package/dist/dev/pack-env.js +4 -0
- package/dist/dev/pack-env.js.map +1 -1
- package/dist/dev/pack-service.d.ts +11 -1
- package/dist/dev/pack-service.d.ts.map +1 -1
- package/dist/dev/pack-service.js +56 -20
- package/dist/dev/pack-service.js.map +1 -1
- package/dist/dev/paths.d.ts +6 -0
- package/dist/dev/paths.d.ts.map +1 -1
- package/dist/dev/paths.js +8 -0
- package/dist/dev/paths.js.map +1 -1
- package/dist/dev/project-database.js +1 -1
- package/dist/dev/project-database.js.map +1 -1
- package/dist/dev/runners.d.ts +35 -9
- package/dist/dev/runners.d.ts.map +1 -1
- package/dist/dev/runtime-container.d.ts +10 -2
- package/dist/dev/runtime-container.d.ts.map +1 -1
- package/dist/dev/runtime-container.js +48 -20
- package/dist/dev/runtime-container.js.map +1 -1
- package/dist/dev/runtime-env.d.ts +10 -0
- package/dist/dev/runtime-env.d.ts.map +1 -1
- package/dist/dev/runtime-env.js +8 -4
- package/dist/dev/runtime-env.js.map +1 -1
- package/dist/dev/runtime-image.d.ts +1 -1
- package/dist/dev/runtime-image.js +1 -1
- package/dist/dev/scala-builder.d.ts +72 -0
- package/dist/dev/scala-builder.d.ts.map +1 -0
- package/dist/dev/scala-builder.js +347 -0
- package/dist/dev/scala-builder.js.map +1 -0
- package/dist/env/project-env.d.ts.map +1 -1
- package/dist/env/project-env.js +3 -1
- package/dist/env/project-env.js.map +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -1
- package/dist/help.d.ts +14 -0
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +55 -0
- package/dist/help.js.map +1 -1
- package/dist/init/dependency-specs.d.ts +26 -0
- package/dist/init/dependency-specs.d.ts.map +1 -1
- package/dist/init/dependency-specs.js +38 -0
- package/dist/init/dependency-specs.js.map +1 -1
- package/dist/init/java-augment.d.ts +24 -0
- package/dist/init/java-augment.d.ts.map +1 -0
- package/dist/init/java-augment.js +198 -0
- package/dist/init/java-augment.js.map +1 -0
- package/dist/init/mode-detect.d.ts +2 -2
- package/dist/init/mode-detect.d.ts.map +1 -1
- package/dist/init/mode-detect.js +12 -1
- package/dist/init/mode-detect.js.map +1 -1
- package/dist/init/scala-augment.d.ts +23 -0
- package/dist/init/scala-augment.d.ts.map +1 -0
- package/dist/init/scala-augment.js +213 -0
- package/dist/init/scala-augment.js.map +1 -0
- package/dist/init/template-files.d.ts +40 -2
- package/dist/init/template-files.d.ts.map +1 -1
- package/dist/init/template-files.js +56 -5
- package/dist/init/template-files.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +30 -4
- package/dist/main.js.map +1 -1
- package/dist/open-url.d.ts +15 -0
- package/dist/open-url.d.ts.map +1 -0
- package/dist/open-url.js +41 -0
- package/dist/open-url.js.map +1 -0
- package/dist/package-manager.d.ts +10 -3
- package/dist/package-manager.d.ts.map +1 -1
- package/dist/package-manager.js +19 -1
- package/dist/package-manager.js.map +1 -1
- package/dist/providers/preset-loader.d.ts.map +1 -1
- package/dist/providers/preset-loader.js +9 -1
- package/dist/providers/preset-loader.js.map +1 -1
- package/dist/providers/presets/anthropic.json +35 -4
- package/dist/providers/presets/gemini-api.json +3 -0
- package/dist/providers/presets/gemini.json +3 -0
- package/dist/providers/presets/groq.json +1 -0
- package/dist/providers/presets/openai.json +36 -4
- package/dist/providers/presets/openrouter.json +6 -2
- package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +28 -4
- package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +47 -3
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +7 -5
- package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +81 -52
- package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +27 -1
- package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +5 -4
- package/dist/sdk-skills/kindgi-getting-started/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +220 -0
- package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +390 -0
- package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +209 -0
- package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +334 -0
- package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +270 -0
- package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +23 -5
- package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +10 -3
- package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +36 -5
- package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +2 -2
- package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +217 -0
- package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +357 -0
- package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +199 -0
- package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +302 -0
- package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +302 -0
- package/dist/templates/java/.mvn/wrapper/maven-wrapper.properties +3 -0
- package/dist/templates/java/AGENTS.md +31 -0
- package/dist/templates/java/README.md.tmpl +69 -0
- package/dist/templates/java/gitignore +9 -0
- package/dist/templates/java/kindgi.config.json.tmpl +8 -0
- package/dist/templates/java/kindgiw +33 -0
- package/dist/templates/java/kindgiw.cmd +28 -0
- package/dist/templates/java/mvnw +295 -0
- package/dist/templates/java/pom.xml.tmpl +65 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/agents/EchoAgent.java.tmpl +27 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/flows/EchoFlow.java.tmpl +18 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/guardrails/ResponseNotEmpty.java.tmpl +28 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/tools/Echo.java.tmpl +22 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/tools/Greet.java.tmpl +23 -0
- package/dist/templates/java/src/test/java/__PACKAGE__/ToolsTest.java.tmpl +30 -0
- package/dist/templates/minimal/README.md.tmpl +8 -14
- package/dist/templates/python/README.md.tmpl +6 -6
- package/dist/templates/sample/README.md.tmpl +7 -13
- package/dist/templates/scala/AGENTS.md +32 -0
- package/dist/templates/scala/README.md.tmpl +75 -0
- package/dist/templates/scala/build.sbt.tmpl +16 -0
- package/dist/templates/scala/gitignore +13 -0
- package/dist/templates/scala/kindgi.config.json.tmpl +8 -0
- package/dist/templates/scala/project/build.properties +1 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/agents/EchoAgent.scala.tmpl +23 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/flows/EchoFlow.scala.tmpl +16 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/guardrails/ResponseNotEmpty.scala.tmpl +21 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Echo.scala.tmpl +16 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Greet.scala.tmpl +17 -0
- package/dist/templates/scala/src/test/scala/__PACKAGE__/ToolsSuite.scala.tmpl +23 -0
- package/package.json +13 -12
|
@@ -14,8 +14,8 @@ description: >
|
|
|
14
14
|
kindgi-python-authoring-tools.
|
|
15
15
|
type: core
|
|
16
16
|
library: "kindgi (Python)"
|
|
17
|
-
version: "0.1.
|
|
18
|
-
sdk_version: "0.1.
|
|
17
|
+
version: "0.1.4"
|
|
18
|
+
sdk_version: "0.1.5-rc.0"
|
|
19
19
|
pack_languages: [python]
|
|
20
20
|
sources:
|
|
21
21
|
- sdks/python/src/kindgi/pack/define.py
|
|
@@ -121,7 +121,14 @@ def no_fabricated_quotes(config: Config, trace: RunTrace) -> CheckResult:
|
|
|
121
121
|
- **`config`** — the values the check runs with (above); **`config_type`**
|
|
122
122
|
— the config's type when the check's first parameter isn't annotated
|
|
123
123
|
with it.
|
|
124
|
-
- **`name`** — a display name. **`check_id`** — defaults to the id.
|
|
124
|
+
- **`name`** — a display name. **`check_id`** — defaults to the id. It
|
|
125
|
+
can't be a built-in check's id (`must-cite`, `never-call-tool`,
|
|
126
|
+
`max-tool-calls`, `output-matches`, `tool-order`, `required-substring`,
|
|
127
|
+
`forbidden-substring`): a pack can't replace a built-in, and the
|
|
128
|
+
decorator raises `DefinitionError`. Name yours
|
|
129
|
+
`<pack>.checks.<name>`. A Python pack can't use a built-in check yet,
|
|
130
|
+
since `@guardrail` always decorates a check function: write the rule
|
|
131
|
+
as your own check.
|
|
125
132
|
- `sandbox=`, `limits=`, `network=` are recorded in the index.
|
|
126
133
|
|
|
127
134
|
## Testing
|
|
@@ -15,7 +15,7 @@ description: >
|
|
|
15
15
|
type: core
|
|
16
16
|
library: "kindgi (Python)"
|
|
17
17
|
version: "0.1.2"
|
|
18
|
-
sdk_version: "0.1.
|
|
18
|
+
sdk_version: "0.1.5-rc.0"
|
|
19
19
|
pack_languages: [python]
|
|
20
20
|
sources:
|
|
21
21
|
- sdks/python/src/kindgi/pack/define.py
|
|
@@ -116,7 +116,11 @@ def verify_citation(citation: Citation, ctx: ToolContext) -> Verdict:
|
|
|
116
116
|
or wait with `ctx.cancellation.wait(timeout)` between slow steps.
|
|
117
117
|
- `ctx.secrets` — the secrets the tool declares in `needs_spec`,
|
|
118
118
|
resolved for the call's tenant (below).
|
|
119
|
-
- `ctx.env
|
|
119
|
+
- `ctx.env` — the env values the tool declares in `needs_spec`, resolved
|
|
120
|
+
for the call: its project's value, else its org's, else the tenant's
|
|
121
|
+
(`kindgi env set NAME <value> --scope=project:<id> --env=<env>`).
|
|
122
|
+
Strings, and not secret. Empty from an older runtime.
|
|
123
|
+
- `ctx.config` — **reserved, empty today**.
|
|
120
124
|
|
|
121
125
|
## Configuration and secrets
|
|
122
126
|
|
|
@@ -140,6 +144,33 @@ fails the call, naming the secret, when it is missing or doesn't match.
|
|
|
140
144
|
Every declared secret is required. In a test, pass them:
|
|
141
145
|
`ToolContext.for_test(secrets={"CITATOR_KEY": "…"})`.
|
|
142
146
|
|
|
147
|
+
A value that differs per tenant, org or project but isn't secret (a base URL, a region, an account id) is an **env value**: declared in `needs_spec`, read from `ctx.env`:
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
@tool(
|
|
151
|
+
id="acme.find-order",
|
|
152
|
+
mutating=False,
|
|
153
|
+
needs_spec={
|
|
154
|
+
"env": {
|
|
155
|
+
"ORDERS_BASE_URL": {"type": "string", "pattern": "^https://"},
|
|
156
|
+
"ORDERS_REGION": {"type": "string", "enum": ["eu", "us"], "default": "eu"},
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
)
|
|
160
|
+
def find_order(lookup: Lookup, ctx: ToolContext) -> Found:
|
|
161
|
+
"""…"""
|
|
162
|
+
return Found(url=f"{ctx.env['ORDERS_BASE_URL']}/{ctx.env['ORDERS_REGION']}/orders/{lookup.order_id}")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- **Which value a call gets:** its project's, else its org's, else the tenant's, in the runtime's env; a schema `default` makes a name optional. The values a call used are recorded with it, so a retry or a resume sees the same ones.
|
|
166
|
+
- **Setting them:** `kindgi env set ORDERS_REGION us --scope=project:<project-id> --env=local` (or `--scope=tenant`, for every project). Changing a value that's already set takes `--force`.
|
|
167
|
+
- **A declared value nobody set** stops the call before the tool runs. For a tool `acme-orders.needs-account` that declares `ACME_ACCOUNT_ID`, the message reads:
|
|
168
|
+
```text
|
|
169
|
+
precondition-failed: Tool "acme-orders.needs-account" was not run: env-value-missing: tool "acme-orders.needs-account" needs env value "ACME_ACCOUNT_ID" in env "local", and none is set for project e889c1f5-eae7-45dc-8669-5bd029a5d85c, its org, or the tenant. Set it: kindgi env set ACME_ACCOUNT_ID <value> --scope=project:e889c1f5-eae7-45dc-8669-5bd029a5d85c --env=local (or --scope=tenant, for every project)
|
|
170
|
+
```
|
|
171
|
+
- **Not secret:** env values are recorded with each run that uses them and shown in its journal. A credential is a secret, never an env value.
|
|
172
|
+
- **In a test:** `ToolContext.for_test(env={"ORDERS_BASE_URL": "…"})`.
|
|
173
|
+
|
|
143
174
|
Everything else comes from the process environment: `os.environ["CITATOR_URL"]`.
|
|
144
175
|
The pack service runs with the pack's environment — in `kindgi dev`
|
|
145
176
|
that is the pack's `.env` and `.env.local` (or `[tool.kindgi.dev]
|
|
@@ -274,9 +305,9 @@ removed field, a narrower type — not on every save.
|
|
|
274
305
|
## Common mistakes
|
|
275
306
|
|
|
276
307
|
1. **Copying the sample tool's shape without asking what the tool should do.**
|
|
277
|
-
2. **Reading `ctx.
|
|
278
|
-
|
|
279
|
-
declares; use `os.environ` for the rest.
|
|
308
|
+
2. **Reading `ctx.config`, or an undeclared `ctx.env` or `ctx.secrets` name.**
|
|
309
|
+
`ctx.config` is empty, and `ctx.env` and `ctx.secrets` hold only what
|
|
310
|
+
`needs_spec` declares; use `os.environ` for the rest.
|
|
280
311
|
3. **A non-object input** (`def f(n: int)`): the input must be a model,
|
|
281
312
|
TypedDict, dataclass or object schema.
|
|
282
313
|
4. **No docstring and no `description=`**, or an unannotated input or
|
|
@@ -15,7 +15,7 @@ description: >
|
|
|
15
15
|
type: core
|
|
16
16
|
library: "kindgi (Python)"
|
|
17
17
|
version: "0.1.7"
|
|
18
|
-
sdk_version: "0.1.
|
|
18
|
+
sdk_version: "0.1.5-rc.0"
|
|
19
19
|
pack_languages: [python]
|
|
20
20
|
sources:
|
|
21
21
|
- sdks/python/README.md
|
|
@@ -189,7 +189,7 @@ from kindgi.client import Kindgi
|
|
|
189
189
|
client = Kindgi() # KINDGI_API_URL + KINDGI_API_TOKEN, or Kindgi(url, token=…)
|
|
190
190
|
run = client.runs.start(agent="my-pack.echo-agent", input={"userMessage": "Ada"})
|
|
191
191
|
print(run.status, run.output["response"]["content"])
|
|
192
|
-
for event in client.runs.
|
|
192
|
+
for event in client.runs.follow(run.id): # to the run's end, reconnecting
|
|
193
193
|
print(event.kind)
|
|
194
194
|
```
|
|
195
195
|
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kindgi-scala-authoring-agents
|
|
3
|
+
description: >
|
|
4
|
+
Covers writing agents for a Kindgi pack in Scala (`kindgi-pack-scala`,
|
|
5
|
+
`com.kindgi.pack.scaladsl`): `Agent(id)` as a `val` of an object named like
|
|
6
|
+
its file, wiring tools (`Tool` vals or an id with a version range) and
|
|
7
|
+
guardrails, capabilities and model choice (preferredProvider /
|
|
8
|
+
preferredModel), conversation policy, turn budgets, prompt parameters, a
|
|
9
|
+
typed answer from a case class (`output[T]`), and tool-error retries, all
|
|
10
|
+
as data with Scala maps. Load this whenever you are authoring or editing
|
|
11
|
+
code in a Scala pack's agents packages (a pack whose `kindgi.config.json`
|
|
12
|
+
says `"language": "scala"`), defining an agent, or when the user asks to
|
|
13
|
+
add, change or refactor one. Scala tools are covered by
|
|
14
|
+
kindgi-scala-authoring-tools, Scala guardrails by
|
|
15
|
+
kindgi-scala-authoring-guardrails, connecting a real model by
|
|
16
|
+
kindgi-authoring-providers.
|
|
17
|
+
type: core
|
|
18
|
+
library: "kindgi-pack-scala"
|
|
19
|
+
version: "0.1.0"
|
|
20
|
+
sdk_version: "0.1.5-rc.0"
|
|
21
|
+
pack_languages: [scala]
|
|
22
|
+
sources:
|
|
23
|
+
- sdks/scala/README.md
|
|
24
|
+
- sdks/scala/kindgi-pack-scala/src/main/scala/com/kindgi/pack/scaladsl/Agent.scala
|
|
25
|
+
- packages/specs/schemas/agent.schema.json
|
|
26
|
+
- packages/specs/schemas/pack-index.schema.json
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# Authoring Kindgi agents in Scala
|
|
30
|
+
|
|
31
|
+
> **Running `kindgi`:** the pack pins its CLI (`"cli"` in
|
|
32
|
+
> `kindgi.config.json`), and `./kindgiw` runs that version, so every
|
|
33
|
+
> `kindgi <command>` below runs as `./kindgiw <command>`.
|
|
34
|
+
>
|
|
35
|
+
> Scala support is in preview: tested and supported, but the API may still
|
|
36
|
+
> change in 0.1.6 without the usual deprecation period.
|
|
37
|
+
|
|
38
|
+
An **agent** is a versioned, model-driven orchestrator. It's made of:
|
|
39
|
+
- instructions (a prompt template);
|
|
40
|
+
- the tools it may call;
|
|
41
|
+
- the capabilities its model needs;
|
|
42
|
+
- guardrails that gate its answer;
|
|
43
|
+
- optionally, a conversation policy.
|
|
44
|
+
|
|
45
|
+
In a Scala pack it is **data**: a `val` of type `Agent` in an object named
|
|
46
|
+
like its file, in an `agents` package. The model runs in the Kindgi runtime,
|
|
47
|
+
not in your JVM. Your Scala code runs only inside the agent's tools and
|
|
48
|
+
guardrail checks.
|
|
49
|
+
|
|
50
|
+
## Ask before building
|
|
51
|
+
|
|
52
|
+
"Add an agent" is a conversation opener, not a ticket. Before writing a
|
|
53
|
+
file, ask:
|
|
54
|
+
|
|
55
|
+
- **What should the agent do?** The purpose drives everything else.
|
|
56
|
+
- **Which tools does it need?** New ones, or existing ones?
|
|
57
|
+
- **Multi-turn or one-shot?** History changes the shape.
|
|
58
|
+
- **Any rules it must respect?** Those become guardrails.
|
|
59
|
+
|
|
60
|
+
The pack's sample agent proves the runtime works end to end. It is not the
|
|
61
|
+
shape to imitate unless the user asks for that.
|
|
62
|
+
|
|
63
|
+
## An agent
|
|
64
|
+
|
|
65
|
+
```scala
|
|
66
|
+
// src/main/scala/acme/agents/BriefWriter.scala
|
|
67
|
+
package acme.agents
|
|
68
|
+
|
|
69
|
+
import acme.guardrails.ResponseNotEmpty
|
|
70
|
+
import acme.tools.Echo
|
|
71
|
+
import com.kindgi.pack.scaladsl._
|
|
72
|
+
|
|
73
|
+
/** acme.brief-writer: drafts a brief's argument from the case facts. */
|
|
74
|
+
object BriefWriter {
|
|
75
|
+
/** The typed answer: the final message must be JSON of this shape. */
|
|
76
|
+
final case class Brief(argument: String, citations: List[String])
|
|
77
|
+
|
|
78
|
+
val agent: Agent = Agent("acme.brief-writer")
|
|
79
|
+
.version("0.1.0")
|
|
80
|
+
.name("Brief Writer")
|
|
81
|
+
.description("Drafts appellate briefs from a case file; cites precedents.")
|
|
82
|
+
.instructions(
|
|
83
|
+
"You are drafting a brief in {{ jurisdiction }}. The user gives the case facts; you write " +
|
|
84
|
+
"a Section IV argument citing at least two precedents. Check every cite with the echo tool " +
|
|
85
|
+
"before using it. Never invent one.")
|
|
86
|
+
.capability(Map("needs" -> List(Map("feature" -> "tool-use"))))
|
|
87
|
+
.tool(Echo.tool)
|
|
88
|
+
.guardrail(ResponseNotEmpty.guardrail)
|
|
89
|
+
.set("parameters", List(Map("name" -> "jurisdiction", "type" -> "string", "required" -> true)))
|
|
90
|
+
.set("conversationPolicy", Map("historyLimit" -> 20))
|
|
91
|
+
.set("budget", Map("maxSteps" -> 8, "maxCostUsd" -> 0.5, "maxWallMs" -> 60000))
|
|
92
|
+
.set("toolErrors", Map("maxRetries" -> 1, "retryOn" -> List("invalid-arguments", "unknown-tool")))
|
|
93
|
+
.output[Brief]
|
|
94
|
+
.build()
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- Tools and guardrails are the pack's own vals, imported like any member:
|
|
99
|
+
`.tool(Echo.tool)`, `.guardrail(ResponseNotEmpty.guardrail)`.
|
|
100
|
+
- **`build()` needs a version, a name and instructions.** Anything missing
|
|
101
|
+
is an error where the agent is defined, and the indexer reports it with
|
|
102
|
+
the file.
|
|
103
|
+
- **Every other field is `set(field, value)`, keyed as on the wire,** with
|
|
104
|
+
Scala maps and lists: the field and its maps are camelCase
|
|
105
|
+
(`conversationPolicy`, `maxSteps`, `historyLimit`), as `agent.schema.json`
|
|
106
|
+
names them. The indexer checks each agent against the pack index's
|
|
107
|
+
schema, and `kindgi dev` reports a mistake with its file.
|
|
108
|
+
- An object may hold several agents, each in its own `val`.
|
|
109
|
+
|
|
110
|
+
## Field by field
|
|
111
|
+
|
|
112
|
+
- **`id`:** `<pack-id>.<agent-name>`, kebab-case, dot-namespaced.
|
|
113
|
+
- **`version`:** an exact semver. Conversations pin the version they started
|
|
114
|
+
on.
|
|
115
|
+
- **`name`, `description`**, and `set("tags", List(…))`: for people and
|
|
116
|
+
listings. The model never sees the description.
|
|
117
|
+
- **`instructions`:** a LiquidJS template. `{{ variable }}` comes from
|
|
118
|
+
`parameters` or the runtime's own variables (`today`, `now`, `agent.*`,
|
|
119
|
+
`conversation.*`). It's rendered strictly: an unknown variable fails the
|
|
120
|
+
turn. Write it as a brief for a capable colleague: what to do, which tools
|
|
121
|
+
to prefer, what to refuse, the quality bar. Name a tool by what it does
|
|
122
|
+
("the verify-citation tool"), never by its dotted id. The model sees ids in
|
|
123
|
+
its provider's form (`acme__verify-citation` for Anthropic and
|
|
124
|
+
OpenAI-compatible models), and a dotted id in the instructions can make it
|
|
125
|
+
call a name it wasn't given. `instructions(Map("prompt" -> …, "version" -> …))`
|
|
126
|
+
references a registered prompt block instead.
|
|
127
|
+
- **`capability(Map(…))`:** what the model must support, such as
|
|
128
|
+
`Map("needs" -> List(Map("feature" -> "tool-use")))`. Call it once per
|
|
129
|
+
capability. The turn routes its first capability to pick a provider and
|
|
130
|
+
model; with none declared, the turn fails.
|
|
131
|
+
- **`tool(tool)`:** pins that tool's version (its own, or the pack's).
|
|
132
|
+
**`tool(id, range)`** is a tool of another pack, with a semver **range**
|
|
133
|
+
(`"^1.0.0"`); the highest active matching version is picked at turn
|
|
134
|
+
start. An agent with no tools is chat-only.
|
|
135
|
+
- **`guardrail(guardrail)`** or **`guardrail(id)`:** evaluated once per turn
|
|
136
|
+
on the final answer, before it is stored. An id with no registered
|
|
137
|
+
guardrail fails the turn.
|
|
138
|
+
- **`set("parameters", List(Map("name" -> …, "type" -> …, "required" -> …)))`:**
|
|
139
|
+
inputs the caller supplies per run. They fill `{{ … }}` in the
|
|
140
|
+
instructions.
|
|
141
|
+
- **`set("preferredProvider", "anthropic")`, `set("preferredModel", "claude-haiku-4-5")`:**
|
|
142
|
+
soft hints. The router prefers them when they satisfy the capabilities.
|
|
143
|
+
To *require* a model, put it in the capability:
|
|
144
|
+
`Map("needs" -> List(Map("feature" -> "tool-use"), Map("models" -> Map("allow" -> List("claude-haiku-4-5")))))`.
|
|
145
|
+
- **`set("conversationPolicy", …)`:** `historyLimit` caps the prior messages
|
|
146
|
+
loaded, and `hitl` configures approval gates. Absent, the turn loads the
|
|
147
|
+
full history with no gates. A tenant's `hitl` policy can tighten the gates
|
|
148
|
+
(a shorter timeout, a higher reviewer role, stricter per tool), never
|
|
149
|
+
loosen them.
|
|
150
|
+
- **`set("budget", …)`:** per turn. `maxSteps` counts model calls (default
|
|
151
|
+
8); `maxCostUsd`; `maxWallMs` (default 120 000). Exceeding the steps or the
|
|
152
|
+
cost fails the turn (`budget-exceeded`); running out of wall time aborts
|
|
153
|
+
it. Leave room for real models: a turn with tool calls can take tens of
|
|
154
|
+
seconds.
|
|
155
|
+
- **`output[T]`:** a typed answer, with its schema derived from the case
|
|
156
|
+
class. The final answer must be JSON matching it. A wrong one goes back to
|
|
157
|
+
the model with the problems (`maxRepairs`, default 1), and then the turn
|
|
158
|
+
fails (`output-schema-violation`). For `maxRepairs` or a schema of your
|
|
159
|
+
own, use `set("output", Map("schema" -> …, "maxRepairs" -> 2))`. The parsed
|
|
160
|
+
answer is the turn result's `output`. In a flow it is
|
|
161
|
+
`nodeOutputs.<step>.output.<field>`.
|
|
162
|
+
- **`set("toolErrors", …)`:** `maxRetries` and `retryOn`. A failed tool call
|
|
163
|
+
goes back to the model as the call's result, so it can fix the call. The
|
|
164
|
+
default kinds are `invalid-arguments` and `unknown-tool` (nothing ran). Add
|
|
165
|
+
`tool-error` only when retrying the tool is safe. Each retry costs a step.
|
|
166
|
+
|
|
167
|
+
## Which model answers
|
|
168
|
+
|
|
169
|
+
Agents run on a registered model provider: the router picks one whose
|
|
170
|
+
models satisfy the capabilities. `kindgi dev` gives a new pack `dev-echo`, a
|
|
171
|
+
**fallback** that answers only while no other provider fits. It calls the
|
|
172
|
+
first tool and replies "⚠ dev-echo isn't a real model: …", then "Tool
|
|
173
|
+
responded: …". The turn carries the `fallback-provider` and
|
|
174
|
+
`dev-echo-not-a-model` warnings. dev-echo can't fill in any other tool
|
|
175
|
+
input, and can't give a typed answer: an agent with an output type fails
|
|
176
|
+
with `output-schema-violation` until a real model is registered. To register
|
|
177
|
+
one, see `kindgi-authoring-providers` (`./kindgiw providers register --preset=anthropic`,
|
|
178
|
+
or `"providers": [{"preset": "anthropic"}]` in `kindgi.config.json`).
|
|
179
|
+
|
|
180
|
+
## Iterating
|
|
181
|
+
|
|
182
|
+
Save the file: `kindgi dev` recompiles through sbt's server, re-indexes, and
|
|
183
|
+
the next run uses it, with no restart. Bump `version` when you break what
|
|
184
|
+
callers rely on (a removed parameter, an incompatible output), not on every
|
|
185
|
+
save.
|
|
186
|
+
|
|
187
|
+
Run an agent from another terminal in the pack directory:
|
|
188
|
+
|
|
189
|
+
```sh
|
|
190
|
+
./kindgiw runs start --agent=acme.brief-writer --input='{"userMessage":"…","parameters":{"jurisdiction":"US"}}'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Common mistakes
|
|
194
|
+
|
|
195
|
+
1. **Building an agent without asking what it should do.** Copying the
|
|
196
|
+
sample's shape answers the wrong question.
|
|
197
|
+
2. **No `capability(…)`.** The turn can't pick a model.
|
|
198
|
+
3. **Scala names inside the maps.** `set("budget", Map("max_steps" -> 4))`
|
|
199
|
+
isn't a budget: the keys are the wire's camelCase (`maxSteps`,
|
|
200
|
+
`historyLimit`, `maxRetries`).
|
|
201
|
+
4. **An unregistered guardrail id.** Pass the `Guardrail` val, or make sure
|
|
202
|
+
the id is one the tenant has.
|
|
203
|
+
5. **`{{ variable }}` not in `parameters`.** The turn fails when the
|
|
204
|
+
instructions render.
|
|
205
|
+
6. **An agent as a `def` or a `lazy val`.** It's a file error: make it a
|
|
206
|
+
`val`.
|
|
207
|
+
7. **A tight `maxWallMs` with a real model.** 15 s aborts real turns under
|
|
208
|
+
load; 60 s is a safer start.
|
|
209
|
+
8. **Expecting dev-echo to give a typed answer.** It can't: register a real
|
|
210
|
+
model first.
|
|
211
|
+
|
|
212
|
+
## When the framework itself is the problem
|
|
213
|
+
|
|
214
|
+
If the bug is in Kindgi, kindgi-pack or the Scala layer (the index dropping
|
|
215
|
+
a field, a misleading error, the router picking the wrong model) and not in
|
|
216
|
+
the pack's code, load `kindgi-framework-feedback` and file it with
|
|
217
|
+
`./kindgiw feedback write`.
|