feat(agent): let the assistant create workloads - #290
Open
scotwells wants to merge 4 commits into
Open
Conversation
Add discovery, render, validate, and token-bound plan/apply tools to compute-mcp, a workload-create skill, and a shared workloadspec package used by both the assistant and datumctl compute deploy. Prefix every published tool with compute_. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
compute_locations_list now reads compute's own ServiceAvailability records and the Locations they name, never LocationBindings. A control plane that does not serve those kinds fails loudly instead of answering with an empty list. Adds ServiceAvailability as a manager location source without changing the default. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Main moved placement from city codes to locations (#264), added runtime classes (#259), published a shared instance-type catalog, and grew `datumctl compute deploy` a URL-publishing path (#289). The assistant's workload-creation surface was rebuilt on top of those rather than beside them. Semantic resolutions: - Placements are locations. `workloadspec.Placement` drops `CityCodes` for `Locations []string` plus `LocationSelector`, exactly one of which must be set; render emits `spec.placements[].locations` or the selector and refuses an empty or malformed one, the way admission does. The render tool's schema, its notes, the diff summary, the workload-create skill, llms-full.txt and the README all say "location" and point the model at `compute_locations_list` for the names, with `locationSelector` named as the way to place in every location of a city or region. - Location resolution keeps main's structure. `SourceServiceAvailability` is gone; `locations.ListAvailableLocations` is built on main's `AvailableLocations` and errors with `ErrAvailabilityNotServed` when the control plane serves no availability, so `compute_locations_list` still fails loud rather than reporting a project with nowhere to run. The manager's placement reads, which treat an unserved kind as no gate at all, are unchanged. The tool now reports `placeable` and `ready` alongside the name, city code and topology. - Instance types read `pkg/instancetype`. `validation.SupportedInstanceTypes` and the duplicated sizing table in the agent are deleted, along with TODO(#137): the catalog is the single source now. - Runtime classes: `workloadspec.Input` gains an optional `RuntimeClass`, passed through verbatim with no default, so the server picks its own. - `internal/cmd/compute/deploy/deploy.go` is main's version wholesale, for `--location`, `--location-selector`, `--city` and `--http-port`. The CLI no longer renders through workloadspec, so the parity test that pinned the two together is deleted rather than left stale. - Docs take main's triage-skill changes with this branch's `compute_` renames on top, and workload-create now says that a public HTTPS URL is published separately — today only by `datumctl compute deploy --http-port` — so `ports` makes a port reachable on the instance's address, not on a managed URL. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What a customer gets
Until now the assistant could only explain why a workload was broken. This PR lets it help create one, without the customer needing a shell or knowing the Workload API.
A customer can now ask Patch "deploy my image to Dallas" and have the assistant discover what the project may use, draft a valid manifest, check it against the platform before anything is created, show the customer exactly what will change, and only then apply it. Every step runs as the customer, and the assistant cannot apply anything it has not first shown them.
Discovery. Four new read-only tools answer the questions a first deploy stalls on:
compute_locations_list(where compute is offered and this project can use it, resolved from compute's own ServiceAvailability records),compute_networks_list,compute_quota_get(limit, used, available), andcompute_instance_types_list. Nothing to guess and no submit-and-read-the-error loop.Draft and check.
compute_workload_renderturns a handful of inputs (image, location, replicas, port, env, ConfigMap and Secret mounts, public IPv4, VM) into a complete manifest, and tells the customer in plain words which choices cannot be changed after create.compute_workload_validateruns the real server-side dry-run and returns the exact rejection as a field error. Both write nothing.Plan, confirm, apply.
compute_workload_planvalidates, reports create vs update, shows the diff, says whether the network will be created, and mints a token bound to that exact manifest, project, and object version.compute_workload_applyonly accepts a manifest whose token still matches. Edit one character, wait past fifteen minutes, or let someone else change the workload first, and it refuses and asks the assistant to re-plan. A refusal is the check working.A skill to drive it.
workload-createwalks the assistant through prerequisites, the container-vs-VM choice, the input list, the traps in customer language (one instance type today,namevssecretName, every volume must be attached, IPv6-only by default, SSH keys for VMs, ConfigMap size limits), and the render, validate, plan, confirm, apply, diagnose sequence. It is written API-first; datumctl appears only as an optional aside for customers who have a shell.Also in this PR
compute_so the assistant can compose tools from several services without collisions. The capability document must register the prefixed names.internal/workloadspecis the assistant's manifest renderer. The CLI keeps its own spec building for now (its flag surface moved on in Use canonical locations for compute placement #264 and feat(cli): publish workloads on a URL with --http-port #289); folding it onto the shared package is a follow-up.SupportedInstanceTypes()so the tool and the webhook cannot disagree. Sizing is still duplicated pending Define an authoritative instance-type resource catalog (single source of truth for vCPU/memory) #137.internal/quotaview, shared by the CLI and the MCP server.Verified against staging
Ran the server locally against
datum-cloudon staging with a real session token, before and after merging main's move to location-named placements: all thirteen tools published;compute_locations_listreturnedus-central-1andus-east-1from the availability records; networks, quota, and instance types returned correct data; render emittedplacements[].locations; validate accepted a good manifest and surfaced the webhook's exact rejection for an unknown location name; plan minted a token and reported the network state; apply refused a forged token and a tampered manifest, and the workload was confirmed absent afterwards. Apply was not run for real.Follow-ups
compute_tool names and theworkload-createrunbook URL.datumctl compute deploy's spec building ontointernal/workloadspecso the CLI and the assistant render identical manifests.PLAN_TOKEN_KEYin the compute-mcp deployment so plan tokens validate across replicas.ServiceAvailabilityas alocationSourcebut its default is stillNetworkServices, so the webhook validates placements against LocationBindings while the tool reads availability records. Switch the manager in deployment config so the two cannot disagree.locationsandlocationSelectorfrom Use canonical locations for compute placement #264;cityCodesis deprecated and not emitted by the renderer.