Skip to content

feat(sdk): typed return models + py.typed for the service layer #428

Description

@padak

Context

kbagent ships an importable Python SDK (keboola_agent_cli.client + keboola_agent_cli.services.*). Consumers such as the FIIA Scaffold Kit program against it directly, in-process.

Problem

The service layer mostly returns dict[str, Any] (e.g. JobService.run_job() -> dict[str, Any], WorkspaceService.execute_query(), StorageService.upload_table()). Consequences for SDK consumers:

  • they couple to undocumented dict shapes,
  • a breaking change in a return shape surfaces at runtime, not at type-check time,
  • no IDE autocomplete on results.

The pattern for typed models already exists in the codebase — lineage_service and agent_service use pydantic — so this is about completing and exporting it consistently.

Request

  1. Define + export typed return models (pydantic) for the high-traffic service methods. Even a documented stable subset would help first: workspace query result, job result, sync push result, config detail, upload-table result.
  2. Ship a py.typed marker in the package so downstream mypy / IDEs treat the SDK as typed.

Benefit

The SDK is an agent-facing surface (relates to #152, Modern Agentic CLI). Typed contracts make integrations robust against version drift, self-documenting, and statically checkable — so a consumer's CI catches an SDK contract change before a customer build does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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