Skip to content

ap: refactor deployment apis to provider+id-based model#209

Merged
peterj merged 5 commits intomainfrom
api-refactor-6
Feb 26, 2026
Merged

ap: refactor deployment apis to provider+id-based model#209
peterj merged 5 commits intomainfrom
api-refactor-6

Conversation

@ilackarms
Copy link
Copy Markdown
Contributor

Description

The deployments API had mixed identity models (name/version vs ID), outdated update semantics, and duplicated client/server code paths. This refactor aligns deployments on a single provider-based, ID-first model and removes legacy flows.

Change Type

/kind breaking_change
/kind cleanup
/kind design

Changelog

refactor deployment apis to provider+id-based model

if err != nil {
return nil, err
// DeployServer deploys a server with configuration.
func (c *Client) DeployServer(name, version string, config map[string]string, preferRemote bool, provider string) (*DeploymentResponse, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while you're at it here, can we remove the prefereRemote?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later we should think about adding a similar arg that would tell us whether the user prefers OCI, Github source, npx/pypi, remote, etc. (basically different package types a server can have)

func (c *Client) DeployAgent(name, version string, config map[string]string, runtimeTarget string) (*DeploymentResponse, error) {
func (c *Client) DeployAgent(name, version string, config map[string]string, provider string) (*DeploymentResponse, error) {
if provider == "" {
provider = "docker"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you define an enum for the providers

DefaultKubernetesProviderID = "kubernetes-default"
)

var errBuiltinProviderReadOnly = errors.New("builtin providers are read-only")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this? What does read-only refer to?

if err != nil {
return nil, huma.Error400BadRequest("Invalid version encoding", err)
if adapter, ok := extensions.ResolveDeploymentAdapter(deployment.Provider); ok {
err = adapter.Undeploy(ctx, deployment)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename this "Undeploy" to "Remove"?

return &struct{}{}, nil
}

if deployment.Provider == "docker" || deployment.Provider == "kubernetes" {
Copy link
Copy Markdown
Contributor

@peterj peterj Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we do this check early on?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean before we resolve for deployment adapters

provider, err := adapter.CreateProvider(ctx, &input.Body)
if err != nil {
if errors.Is(err, errBuiltinProviderReadOnly) {
return nil, huma.Error400BadRequest("Provider is read-only")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the concept of "read-only"?

Runtime string `json:"runtime"` // "local" or "kubernetes"
IsExternal bool `json:"isExternal"` // true if not managed by registry
ID string `json:"id"`
ServerName string `json:"serverName"` // resource name (legacy field name retained for compatibility)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove the ServerName is we aren't using it anymore?

Comment on lines +9 to +10
Version string `json:"version"`
Provider string `json:"provider"` // "docker", "kubernetes", "gcp", "aws"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Version string `json:"version"`
Provider string `json:"provider"` // "docker", "kubernetes", "gcp", "aws"
Provider string `json:"provider"` // "docker", "kubernetes"

type DeploymentFilter struct {
Runtime *string // "local" or "kubernetes"
ResourceType *string // "mcp" or "agent"
Provider *string // docker, kubernetes, gcp, aws
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provider *string // docker, kubernetes, gcp, aws
Provider *string // docker, kubernetes

type Provider struct {
ID string `json:"id"`
Name string `json:"name"`
Platform string `json:"platform"` // local, kubernetes, gcp, aws
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Platform string `json:"platform"` // local, kubernetes, gcp, aws
Platform string `json:"platform"` // local, kubernetes


func mapProviderToBackend(provider string) string {
if provider == "kubernetes" {
return "kubernetes"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way we could ahe these as consts as we're referring to them in a lot of places

Copy link
Copy Markdown
Contributor

@peterj peterj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some comments

arctl agent deploy my-agent --version latest
arctl agent deploy my-agent --version 1.2.3
arctl agent deploy my-agent --version latest --runtime kubernetes`,
arctl agent deploy my-agent --version latest --provider-id kubernetes-default`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this just be 'kubernetes' instead of 'kubernetes-default'?

if runtime == "" {
runtime = "local"
if providerID == "" {
providerID = "local"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is local docker or is provider local and then platform is docker? (we'll need to make sure we document these terms)

Runtime string `json:"runtime"` // "local" or "kubernetes"
IsExternal bool `json:"isExternal"` // true if not managed by registry
ID string `json:"id"`
ServerName string `json:"serverName"` // resource name (legacy field name retained for compatibility)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this ServerName?

@peterj peterj merged commit 50741c8 into main Feb 26, 2026
5 checks passed
christian-posta pushed a commit to christian-posta/agentregistry that referenced this pull request Mar 9, 2026
…y-dev#209)

<!--
Thanks for opening a PR! Please delete any sections that don't apply.
-->

# Description

<!--
A concise explanation of the change. You may include:
- **Motivation:** why this change is needed
- **What changed:** key implementation details
- **Related issues:** e.g., `Fixes agentregistry-dev#123`
-->

The deployments API had mixed identity models (name/version vs ID),
outdated update semantics, and duplicated client/server code paths. This
refactor aligns deployments on a single provider-based, ID-first model
and removes legacy flows.


# Change Type

<!--
Select one or more of the following by including the corresponding
slash-command:
```
/kind breaking_change
/kind bump
/kind cleanup
/kind design
/kind deprecation
/kind documentation
/kind feature
/kind fix
/kind flake
/kind install
```
-->

/kind breaking_change
/kind cleanup
/kind design

# Changelog

<!--
Provide the exact line to appear in release notes for the chosen
changelog type.

If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
-->

```release-note
refactor deployment apis to provider+id-based model
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants