Skip to content

feat(gooddata-sdk): [AUTO] Add JsonApiAgent CRUD entity and DeclarativeAgent/DeclarativeAgents models#1564

Open
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C005-20260420-r82171
Open

feat(gooddata-sdk): [AUTO] Add JsonApiAgent CRUD entity and DeclarativeAgent/DeclarativeAgents models#1564
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C005-20260420-r82171

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Added CatalogAgent entity model with full CRUD service methods for the new JsonApiAgent endpoints. Wired AIAgentsApi (from the auto-generated client) into GoodDataApiClient and CatalogServiceBase, then added get_agent / list_agents / create_agent / update_agent / patch_agent / delete_agent methods to CatalogOrganizationService. All new classes are exported from gooddata_sdk.init. DeclarativeAgent/DeclarativeAgents from the diff are skipped — no generated client models exist for them and no layout API endpoint is present to call.

Impact: new_feature | Services: gooddata-metadata-client
Tickets: GDAI-1284

Files changed

  • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/agent.py
  • packages/gooddata-sdk/src/gooddata_sdk/client.py
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/catalog_service_base.py
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/service.py
  • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • packages/gooddata-sdk/tests/catalog/test_catalog_agent.py

Agent decisions

Decisions (5)

AIAgentsApi vs EntitiesApi — Use standalone AIAgentsApi imported directly from gooddata_api_client.api.ai_agents_api

  • Alternatives: Assume agents would be in EntitiesApi (incorrect)
  • Why: Agent methods are not in EntitiesApi (confirmed by grep). AIAgentsApi is the auto-generated class that exposes create/get/list/patch/update/delete_entity_agents.

DeclarativeAgent / DeclarativeAgents skipped — No SDK wrapper for DeclarativeAgent/DeclarativeAgents

  • Alternatives: Create standalone dataclasses without API backing
  • Why: No auto-generated model files exist (glob returned nothing) and no layout API endpoint calls them. Would be dead code.

from_api key names — Use snake_case keys in safeget calls inside from_api

  • Alternatives: Use camelCase keys – silently returns None for all fields
  • Why: OpenApiModel objects expose snake_case attribute names for dict-like access, matching the Python attribute_map reverse mapping.

Service location — Add agent methods to existing CatalogOrganizationService

  • Alternatives: Create a new CatalogAgentService
  • Why: Agents are org-level resources. LLM providers (same pattern) live in CatalogOrganizationService. Consistency over a new service class.

Expose both PATCH and PUT — Provide both patch_agent and update_agent methods

  • Alternatives: Expose only patch_agent
  • Why: AIAgentsApi exposes both patch_entity_agents and update_entity_agents; giving callers both semantics follows the LLM provider pattern.
Assumptions to verify (3)
  • AIAgentsApi is not in gooddata_api_client.apis.init – importing directly from the module file is correct.
  • API response attributes are exposed with snake_case keys via OpenApiModel dict-like access (consistent with safeget usage elsewhere in the codebase).
  • DeclarativeAgent/DeclarativeAgents will need SDK wrapping only once a layout endpoint is added to the generated LayoutApi.
Risks (2)
  • If the live server returns agent attributes under camelCase keys instead of snake_case, CatalogAgent.from_api() silently returns None for all attributes – would surface immediately during cassette recording.
  • AIAgentsApi imported directly from module path; a client regeneration that renames/moves the class would break this import.
Layers touched (3)
  • entity_model — New CatalogAgent, CatalogAgentAttributes, CatalogAgentDocument, CatalogAgentPatchDocument
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/agent.py
  • public_api — Exported classes; wired AIAgentsApi into client/service-base; CRUD methods on CatalogOrganizationService
    • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
    • packages/gooddata-sdk/src/gooddata_sdk/client.py
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/catalog_service_base.py
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/service.py
  • tests — Unit tests covering init, from_api (full & minimal), document wrappers, attribute defaults – no cassettes needed
    • packages/gooddata-sdk/tests/catalog/test_catalog_agent.py

Source commits (gdc-nas)

  • a544341 Merge pull request #21553 from gooddata/ach/gdai-1522
  • 502429b Merge pull request #21309 from gooddata/ach/gdai-1370-agent-wire
  • e1b236d Merge pull request #21241 from gooddata/ach/gdai-1370-result-fix
  • 19348b5 Merge pull request #21542 from gooddata/ach/gdai-1522
  • 4d55770 Merge pull request #20464 from gooddata/js/GDAI-1284
OpenAPI diff
+      "DeclarativeAgent": {
+        "properties": {
+          "description": { "type": "string" },
+          "id": { "type": "string" },
+          "name": { "type": "string" },
+          "llmProviderId": { "type": "string" }
+        }
+      },
+      "DeclarativeAgents": {
+        "properties": {
+          "agents": { "items": { "$ref": "#/components/schemas/DeclarativeAgent" } }
+        }
+      },
+      "JsonApiAgentIn": { ... },
+      "JsonApiAgentOut": { ... },
+    paths:
+      "/api/v1/entities/agents": { "get": {...}, "post": {...} },
+      "/api/v1/entities/agents/{id}": { "get": {...}, "patch": {...}, "delete": {...} }

Workflow run


Generated by SDK OpenAPI Sync workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant