Skip to content

ai-kit/sl-builder: migrate the plugin from raw urllib to kbagent semantic-layer calls #75

Description

@ottomansky

Background

The sl-builder skill in ai-kit currently uses hand-rolled urllib/httpx calls against the Keboola Metastore API (e.g. https://metastore.<stack>.keboola.com/v1/api/...). This pre-dates the kbagent semantic-layer command group (shipped in kbagent v0.34.0, PR keboola/cli#293) which now wraps every metastore operation behind the kbagent error envelope, retry/backoff layer, permission gate, and --hint client|service snippet generator.

Why migrate

Keeping the raw urllib path on top of the new kbagent surface means:

  • Duplicate-name normalization (server's HTTP 500 Failed to create meta object -> ALREADY_EXISTS) is implemented once in kbagent and again in the skill.
  • Constraint shape validators (rule is STRING not OBJECT, name regex ^[a-z][a-z0-9_]*$, 3-level severity enum) live in two places.
  • kbagent semantic-layer build --tables T1,T2,... already does the schema-discovery + heuristic-generate dance the skill orchestrates.
  • The skill bypasses kbagent's permission gates (--deny-writes / --deny-destructive) so policy-enforced runners can't constrain it.
  • The skill cannot leverage --hint client / --hint service for Python code generation when the human operator wants to inspect or customize.

Acceptance criteria

  • Audit every call site in sl-builder that talks to metastore.*.keboola.com.
  • Replace each with the equivalent kbagent semantic-layer ... invocation (CLI subprocess, or import + use SemanticLayerService directly if the skill runs in-process).
  • Where the kbagent surface is too narrow (e.g. bulk batch operations), file a kbagent enhancement issue first rather than working around with raw urllib.
  • Update the skill docs (SKILL.md, references/) to reference the kbagent surface.

Cross-link

Filed from kbagent PR keboola/cli#293 review (pre-merge follow-up tracking). See also issues #294 (edit_metric cascade rollback) and #295 (build_model rollback) for kbagent-side gaps in the same PR.

Filed from PR #293 review (pre-merge follow-up tracking)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions