feat: publish a JSON schema for the Agentkitfile for editor autocomplete
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- docker, go, json, yaml
- Domain
- developer-experience, tooling
Research direction
Start by reading the Go config types in pkg/agentkit/config/specs.go, tool.go, and source.go, then compare the generator example at dalec's cmd/gen-jsonschema/main.go. Generate docs/agentkitfile.schema.json from the YAML tags, add the documented special cases, and cover the listed fixtures and invalid examples. The issue's done criteria include a CI freshness check, editor behavior, and the --call feature only after #58 lands.
Written by the indexing model from the issue text.
Description
Problem
The Agentkitfile is strict: an unknown or misspelled field fails the build. But editors give no help while you write one. There's no autocomplete, no hover help and no red underline on a typo, so:
- every typo costs a full build attempt;
- you learn field names by reading
docs/agentkitfile.md.
Most YAML editors can do all of this if they're given a JSON schema, a file that describes which fields are allowed. AgentKit doesn't publish one. dalec generates one from its Go types (cmd/gen-jsonschema/main.go, docs/spec.schema.json) and also serves it through docker buildx build --call dalec.schema.
What
- Generate a JSON schema for the Agentkitfile from the Go config types and check it in as
docs/agentkitfile.schema.json. - Keep it current: CI fails if someone changes the config types without regenerating it.
- Let editors use it with one comment in the file:
#syntax=ghcr.io/orka-agents/agentkit/agentkit:latest # yaml-language-server: $schema=https://raw.githubusercontent.com/orka-agents/agentkit/main/docs/agentkitfile.schema.json apiVersion: v1alpha1 kind: Agent- Order matters. The schema comment must come after the
#syntaxline. BuildKit stops looking for#syntaxat the first comment that isn't a directive (seeDirectiveParser.ParseLinein BuildKit'sfrontend/dockerfile/parser/directives.go). - Matching versions. For a pinned frontend version, use the same tag in the schema URL, for example
.../v0.5.0/docs/agentkitfile.schema.json, so the editor matches the frontend.
- Order matters. The schema comment must come after the
- Serve it from the frontend:
docker buildx build --call agentkit.schema -f agentkitfile.yaml .prints the schema for the exact frontend version in#syntax, the same way dalec's--call dalec.schemadoes. This builds on the--callsupport in #58. If #58 isn't merged yet, leave this part for a follow-up.
The schema is there to help with editing. The Go checks in validate.go remain the source of truth, so don't try to express every rule in the schema.
Out of scope
- A VS Code extension.
- Registering the schema with SchemaStore so editors pick it up without the comment. That's a good follow-up once the file is stable.
Why
- Typos show up while typing, not after a build.
- Autocomplete and hover help make the format easy to learn.
- It's cheap: the schema is generated from code that already exists.
How
Where things are
| File | What it does |
|---|---|
pkg/agentkit/config/specs.go, tool.go, source.go |
The Agentkitfile types. They use yaml tags (no json tags) and have doc comments. |
pkg/agentkit/config/load.go |
Strict loader: unknown fields fail. The schema should match this with additionalProperties: false. |
pkg/agentkit/config/source.go |
Source (used by instructions) accepts a plain string or an {inline} / {file} mapping. It needs a hand-written schema. |
pkg/agentkit/runtimes |
Runtime names and aliases, for the runtime enum. |
dalec cmd/gen-jsonschema/main.go |
Example generator using github.com/invopop/jsonschema. |
Steps
- Add a generator, for example
cmd/gen-schema/main.go, usinggithub.com/invopop/jsonschema.- Field names must come from the
yamltags. invopop readsjsontags by default, so set its option for another tag name. Check the exact option in the version you pick. - Use Go doc comments as field descriptions (
AddGoComments, as dalec does) so editors show hover help. - Set
additionalProperties: falseso unknown fields are flagged, matching the strict loader.
- Field names must come from the
- Hand-write the special cases with a
JSONSchema()method on the type. invopop picks it up automatically.instructions(Source): a string, or an object withinlineorfile.- Fields with fixed values, using
enum:apiVersion: v1alpha1kind: Agentmodel.provider: openai-compatibleruntime: names and aliases frompkg/agentkit/runtimesauth.typecontext.providers[].typetools[].transport
- Fields that hold env var names (
apiKeyEnv,urlEnv,tokenEnv,env[].nameand so on):pattern: "^[A-Z0-9_]+$", the same rule asisEnvVarNameinvalidate.go.
- Add a make target, for example
make schema, that writesdocs/agentkitfile.schema.json. - Add a CI check: regenerate the file and fail on
git diff --exit-code docs/agentkitfile.schema.json. - Add
--call agentkit.schemaonce #58 has landed.- Embed the file in the frontend (
//go:embed) and return it asresult.json/result.txtmetadata, as dalec'shandleJSONSchemadoes infrontend/client.go. - BuildKit's
dockerui.HandleSubrequestrejects unknown calls unlessAllowOther: true, so either handle this call before it or set that option.
- Embed the file in the frontend (
Tests
- Every example file passes the schema: each
test/agentkitfile-*.yamlfixture, and each YAML example inREADME.mdanddocs/, if they're easy to extract. Use a Go JSON Schema validator such asgithub.com/santhosh-tekuri/jsonschema. This catches the schema and the loader drifting apart. - Mistakes fail it: a misspelled field, a wrong
kind, and a lowercase env name. - Manual check: in VS Code with the Red Hat YAML extension, a file with the comment shows autocomplete, hover help and an error on a typo.
Run:
go test ./...
make lint
Docs
docs/agentkitfile.md: add an "Editor support" section with:- the comment line;
- the note that it goes after
#syntax; - the versioned URL;
- how to set it up in VS Code;
- the
--call agentkit.schemacommand, once available.
README.md: add the comment line to the quick-start example.
Done when
docs/agentkitfile.schema.jsonis generated from the Go types, and CI fails when it's out of date.- All fixtures and examples pass the schema, and the sample mistakes fail it.
- With the comment line, VS Code shows autocomplete and flags typos, and
#syntaxstill works. --call agentkit.schemaprints the schema, once #58 has landed.
- Dominant language
- Python
- Stars
- 7
- Forks
- 5
- Avg merge
- 3h 39m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from orka-agents/agentkit
-
fix(pydantic-ai): CI fails with newest pydantic-ai (unexpected 'history' argument)Possibly taken @gambtho claimed this 30 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
orka-agents/agentkit#77 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
orka-agents/agentkit#76 · 3 comments ·
-
area/build area/orka area/runtime blocked enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
orka-agents/agentkit#69 ·
-
area/build area/orka area/runtime enhancement
Difficulty 4/5 3-5 days Newbie friendliness 68/100
orka-agents/agentkit#68 ·
-
area/build enhancement testing
Difficulty 5/5 Over a week Newbie friendliness 42/100
orka-agents/agentkit#65 ·
All issues in orka-agents/agentkit
Similar issues
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 62/100
DaoCloud/DaoCloud-docs#7839 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
sav-oss-org/ptusa_main#1610 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug status/accepted type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/apm#4925 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
sagemathinc/sagebrush#1701 ·
Maintainers usually reply within 1 day