lablup / lablup/backend.ai

Expose ImageV2.installedAgents connection field in v2 GQL and REST (Valkey-backed)

Open
#13,410 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

Add an installedAgents connection field to the v2 image type, following the Deployment.replicas scoped-search pattern (gql/deployment/types/deployment.py). The resolver injects the installation scope as a base condition and calls the agent scoped search, so filter / orderBy / pagination of AgentV2Connection work as usual.

Scope:
- Extend the agent adapter admin_search (api/adapters/agent/adapter.py) with a base_conditions parameter, replicating the image-alias adapter pattern.
- Data source at this stage stays Valkey: read the agent id set for the image and pass AgentConditions.by_ids as the base condition (an empty list safely yields no results). Nested filtering by installation is out of scope (added after DB migration).
- Add a scope input DTO (image_id) under common/dto/manager/v2/agent/request.py; node response DTOs unchanged.
- REST v2 scoped search endpoint: POST /v2/agents/images/{image_id}/search.
- hide_agents policy: for non-superadmin with hide_agents enabled, return null for the field (authorization handled at the service/adapter layer).

Success Criteria
- [ ] ImageV2.installedAgents returns a connection of agents that have the image, with working filter / orderBy / pagination
- [ ] installedAgents(first: 0) exposes a total count usable as an installed indicator
- [ ] image with no installed agents: connection with count 0, not an error
- [ ] non-superadmin with hide_agents config enabled receives null for the field
- [ ] REST v2 scoped agent search by image id returns the same data
- [ ] pants test passes for affected packages

JIRA Issue: BA-7161

Contributor guide

Open the contributing guide

Research direction

Start with gql/deployment/types/deployment.py and the agent adapter at api/adapters/agent/adapter.py, then inspect common/dto/manager/v2/agent/request.py and the affected v2 agent routes. Run the affected packages' pants tests. Done means ImageV2.installedAgents and POST /v2/agents/images/{image_id}/search support filtering, ordering, pagination, empty results, counts, and the stated hide_agents behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, python
Domain
api, backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.