Skip to content

refactor(entities): migrate entities consumers to typed EntitiesClient - #1494

Open
maxdubrinsky wants to merge 5 commits into
mainfrom
aircore-827-migrate-entities/mdubrinsky
Open

refactor(entities): migrate entities consumers to typed EntitiesClient#1494
maxdubrinsky wants to merge 5 commits into
mainfrom
aircore-827-migrate-entities/mdubrinsky

Conversation

@maxdubrinsky

Copy link
Copy Markdown
Contributor

Summary

Migrate entities API call sites from sdk.entities.* (Stainless SDK) to client_from_platform(sdk, TypedClient).* (typed HTTP client), following the pattern established in #1277.

Related Issue

AIRCORE-827

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with documentation updates
  • Documentation only
  • Contributor tooling or automation
  • CI, build, or test infrastructure

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification: same API calls, different client
  • Tests not applicable — justification:
  • Documentation updated for user-visible behavior
  • Documentation not applicable — justification: internal refactoring

Verification

  • Pull request title follows the repository's Conventional Commit format
  • Every commit includes an appropriate Signed-off-by: trailer
  • uv run pre-commit run -a passes, or any blocked checks are identified below
  • Targeted tests pass, or tests are marked not applicable above
  • No secrets, API keys, or credentials are included

…ent compat layer

Add 8 new typed HTTP clients in nemo_platform_plugin, following the
proven files/models pattern (types.py + endpoints.py + client.py):

- workspaces: WorkspacesClient (workspace + members CRUD)
- guardrail: GuardrailClient (config CRUD + check)
- projects: ProjectsClient (CRUD)
- agents: AgentsClient (agent + deployment CRUD + invoke)
- auditor: AuditorClient (config/target CRUD + submit + job list/get)
- iron_swarm: IronSwarmClient (manifest CRUD + refresh + run CRUD + validate_model)
- evaluator: EvaluatorClient (submit jobs + results + metrics CRUD)
- data_designer: DataDesignerClient (preview stream + job CRUD)

Add convenience properties to BaseNemoClient so sdk.files, sdk.models,
sdk.workspaces, etc. each return the corresponding typed client via
from_client(self). Add _InferenceNamespace compat shim dispatching
sdk.inference.providers/deployments/virtual_models to the existing
ModelsClient/VirtualModelsClient.

Add NemoResponse.__getattr__ proxy delegating unknown attribute access
to the parsed body, so callers use result.name instead of
result.data().name (eliminates .data() unwrapping at ~980 call sites
during consumer migration).

Purely additive: no existing code changed, only additions. The
Stainless SDK remains in place; this builds the landing pad for the
per-area consumer migration PRs.

AIRCORE-1058

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
…lient

Add _client property (returns the underlying httpx transport) and
default_headers property (returns the default headers dict) to
BaseNemoClient. Plugin SDK resources (auditor, evaluator, anonymizer,
data-designer, customizer, safe-synthesizer, insights) access
platform._client and platform.default_headers to make raw HTTP calls.
These properties let them work with NemoClient after the spine flip.

AIRCORE-1058

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Add __getattr__ to BaseNemoClient that mirrors NeMoPlatform's
plugin SDK discovery: discovers plugin SDK resources via entry
points (discover_sdk) and instantiates them with self as the
platform. Handles sdk.auditor, sdk.evaluator, sdk.agents,
sdk.iron_swarm, sdk.anonymizer, sdk.customizer, and any other
plugin-level resource not covered by convenience properties.

Combined with the _client property (previous commit), this lets
plugin SDK resources work with NemoClient after the spine flip
without any changes to the plugin code.

AIRCORE-1058

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
@maxdubrinsky
maxdubrinsky force-pushed the aircore-827-migrate-entities/mdubrinsky branch 2 times, most recently from 849334f to 25c6f0a Compare August 24, 2026 21:04
Migrate entities API call sites from sdk.entities.* (Stainless SDK)
to client_from_platform(sdk, EntitiesClient).* (typed HTTP client),
following the pattern established in #1277.

Changes:
- e2e/test_entities.py: create/get_entity_by_name/update_entity_by_name/
  delete_entity_by_name -> create_entity/get_entity_by_name/
  update_entity_by_name/delete_entity_by_name with EntityCreateInput/
  EntityUpdate body models + .data()
- nmp_testing/client.py: docstring example updated
- 4 iron-swarm files: entities.create/get_entity_by_name/update_entity_by_name/
  list -> create_entity/get_entity_by_name/update_entity_by_name/
  list_entities with body models + .data()
- services/core/entities/tests/integration/test_workspaces_crud_with_auth.py:
  entities.create -> create_entity with EntityCreateInput
- 2 agentic-use test files: entities.list/get_entity_by_name ->
  list_entities/get_entity_by_name + .data()

Skipped:
- services/core/entities/e2e/test_e2e.py: uses sdk.v2.entities (entity_id-based
  v2 API, no typed client equivalent)
- 3 controller files (agents, deployments, insights): already migrated
  to client_from_platform + AsyncEntitiesClient
- 5 evaluator test files: self.entities is a local dict, not SDK calls
- services/studio/tests/unit/test_assistant.py: self.entities is a local dict

AIRCORE-827

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
@maxdubrinsky
maxdubrinsky force-pushed the aircore-827-migrate-entities/mdubrinsky branch from 25c6f0a to 16ecccd Compare August 24, 2026 22:08
@maxdubrinsky
maxdubrinsky marked this pull request as ready for review August 24, 2026 22:21
@maxdubrinsky
maxdubrinsky requested review from a team as code owners August 24, 2026 22:21
@maxdubrinsky
maxdubrinsky force-pushed the mdubrinsky/aircore-1058-add-typed-clients-for-remaining-service-areas-nemoclient branch from 2070a49 to c8aeb8a Compare August 25, 2026 16:35
Base automatically changed from mdubrinsky/aircore-1058-add-typed-clients-for-remaining-service-areas-nemoclient to main August 25, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant