lablup / lablup/backend.ai

AgentV2 Strawberry Migration

Open
#6,909 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Motivation

The current `AgentNode` implementation uses `Graphene`-based GraphQL with a flat structure containing 23+ fields at the top level, making it difficult to understand, extend, and maintain. Additionally, the permission model and data access layer are tightly coupled, making it challenging to separate concerns and optimize performance.

- **Poor API ergonomics**: 23 flat fields make it hard to understand which fields are related
- **Limited extensibility**: Adding new fields clutters the already crowded type
- **Performance issues**: All fields are loaded eagerly, even expensive ones
- **Mixed concerns**: Permission checks and data loading are intertwined
- **Legacy patterns**: Graphene-based implementation doesn't align with Strawberry adoption

## Objective

Migrate `AgentNode` to a Strawberry-based `AgentV2` implementation with:

1. **Nested type structure**: Group related fields into 6 logical Info types
1. **Clear separation of concerns**: Separate permission model, service layer, and repository access
1. **Performance optimization**: Use field-level resolvers and DataLoader for efficient data loading
1. **Backward compatibility**: Provide deprecated flat fields for gradual migration
1. **Improved developer experience**: Better type safety, clearer API structure, and easier testing

JIRA Issue: BA-3131

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.