Skip to content

Refactor teams API contracts: replace old entities with new resource model #32

@rowan-stein

Description

@rowan-stein

User Request

Replace all old team entities in both the gRPC proto and OpenAPI spec with the new resource model defined in agynio/architecture (architecture/resource-definitions.md, architecture/teams.md). This is an intentional breaking change — no new API version needed, update in place.

Old entities to remove: Agent (config-blob style), Tool, McpServer, WorkspaceConfiguration, MemoryBucket, Variable, Attachment (generic source/target)

New entities: Agent (flat fields), Volume, VolumeAttachment, MCP, Skill, Hook, ENV, InitScript

Specification

Design Decisions

  1. EntityMeta stays slim{id, created_at, updated_at}. description is a direct field on each entity that supports it (all except VolumeAttachment).
  2. Cursor-based pagination everywhere — proto already uses page_size/page_token/next_page_token. OpenAPI switches from offset to cursor-based (pageSize/pageToken/nextPageToken). Delete Pagination.yaml.
  3. Mutually-exclusive fields — proto uses oneof for VolumeAttachment target, Env target+source, InitScript target. OpenAPI uses optional fields with descriptive constraints.
  4. Naming: Mcp (not McpServer), Env (not Variable). Paths kebab-case: /volume-attachments, /init-scripts.
  5. VolumeAttachment — immutable: Create/Get/Delete/List only, no Update.
  6. Ownership immutabilityagent_id, mcp_id, hook_id excluded from Update requests.
  7. ComputeResources — shared sub-message: requests_cpu, requests_memory, limits_cpu, limits_memory (all optional strings).

Proto Changes

File: proto/agynio/api/teams/v1/teams.proto — full replacement.

  • Remove google/protobuf/struct.proto import
  • 39 RPCs across 8 entities in TeamsService
  • All old enums removed (ToolType, EntityType, AttachmentKind, etc.)
  • New messages: Agent, Volume, VolumeAttachment, Mcp, Skill, Hook, Env, InitScript + ComputeResources + EntityMeta
  • oneof for mutually exclusive fields

OpenAPI Changes

Files to DELETE (48):

Schemas (35): AgentConfig, Attachment, AttachmentCreateRequest, AttachmentKind, EntityType, McpEnvItem, McpServer, McpServerConfig, McpServerCreateRequest, McpServerUpdateRequest, MemoryBucket, MemoryBucketConfig, MemoryBucketCreateRequest, MemoryBucketUpdateRequest, Pagination, PaginatedAttachments, PaginatedMcpServers, PaginatedMemoryBuckets, PaginatedTools, PaginatedVariables, PaginatedWorkspaceConfigurations, Tool, ToolCreateRequest, ToolType, ToolUpdateRequest, Variable, VariableCreateRequest, VariableUpdateRequest, WorkspaceConfig, WorkspaceConfiguration, WorkspaceConfigurationCreateRequest, WorkspaceConfigurationUpdateRequest, WorkspaceEnvItem, WorkspacePlatform, WorkspaceVolumeConfig

Paths (13): attachments, attachment-by-id, mcp-servers, mcp-server-by-id, memory-buckets, memory-bucket-by-id, tools, tool-by-id, variables, variable-by-id, variable-resolve, workspace-configurations, workspace-configuration-by-id

Files to KEEP unchanged (4): IdPath.yaml, ProblemResponse.yaml, EntityMeta.yaml, Problem.yaml

Files to MODIFY (7): openapi.yaml, Agent.yaml, AgentCreateRequest.yaml, AgentUpdateRequest.yaml, PaginatedAgents.yaml, paths/agents.yaml, paths/agent-by-id.yaml

Files to CREATE (42):

  • 28 schemas: ComputeResources, Volume, VolumeCreateRequest, VolumeUpdateRequest, PaginatedVolumes, VolumeAttachment, VolumeAttachmentCreateRequest, PaginatedVolumeAttachments, Mcp, McpCreateRequest, McpUpdateRequest, PaginatedMcps, Skill, SkillCreateRequest, SkillUpdateRequest, PaginatedSkills, Hook, HookCreateRequest, HookUpdateRequest, PaginatedHooks, Env, EnvCreateRequest, EnvUpdateRequest, PaginatedEnvs, InitScript, InitScriptCreateRequest, InitScriptUpdateRequest, PaginatedInitScripts
  • 14 paths: volumes, volume-by-id, volume-attachments, volume-attachment-by-id, mcps, mcp-by-id, skills, skill-by-id, hooks, hook-by-id, envs, env-by-id, init-scripts, init-script-by-id

CI Note

The buf-pr workflow runs breaking change detection. This PR will intentionally break the proto contract — that CI check is expected to fail and should be overridden for merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions