4.9 KiB
4.9 KiB
Product Spec: Oz CLI Named-Agent CRUD
Summary
Add first-class Oz CLI commands for managing named agents. Developers can list, inspect, create, update, and delete named agents from the terminal with output modes that match existing Oz run commands.
Problem
Named agents are manageable through the public API and related Oz surfaces, but the Oz CLI does not expose the full CRUD surface. The existing oz agent list command lists repository-discovered agent skills, so the CLI needs a clear split between named agents and skills before adding CRUD commands.
Goals
- Make
oz agent listmean "list named agents". - Preserve skill discovery by renaming the existing command to
oz agent skills. - Provide terminal-friendly pretty output, script-friendly plain text, and JSON output with
--jqfiltering. - Preserve server patch semantics for updates so users only pass fields they want to modify.
- Make list sorting predictable and client-side.
Non-goals
- Changing the public API behavior or authorization model for named agents.
- Adding interactive prompts for create or update.
- Managing API keys for named agents.
- Changing
oz agent runoroz agent run-cloudsemantics beyond continuing to accept an agent UID where already supported.
Behavior
oz agent skillslists available agent skills using the currentoz agent listbehavior, including the existing--repooption and repository authorization flow.oz agent listlists named agents accessible to the authenticated user's team.oz agent listsupports--sort-by nameand--sort-by created-at.oz agent listsupports--sort-order ascand--sort-order desc. If omitted, name sorting defaults to ascending, and timestamp sorting defaults to descending.- Sorting is performed client-side after the API response is fetched and before rendering pretty, text, or ndjson output.
oz agent get <uid>retrieves a single named agent by UID.oz agent createcreates a named agent.--nameis required. Optional fields are accepted for the fields supported by the API: description, secrets, skills, base model, and default environment.oz agent update <uid>partially updates a named agent. Users only pass fields they want to change.oz agent updatepreserves omitted fields. Passing an empty value through an explicit remove flag clears fields where the API supports clearing.oz agent updatesupports add/remove operations for list fields without requiring users to hand-write replacement arrays. Secrets use--add-secret <NAME>,--remove-secret <NAME>, and--remove-all-secrets; skills use--add-skill <SKILL>,--remove-skill <SKILL>, and--remove-all-skills.oz agent delete <uid>deletes a named agent and reports success. If the server rejects deletion, such as for the default agent, the CLI surfaces the server error.- Pretty output for list uses a readable table with the core fields needed to identify and choose agents: UID, name, created time, description, secret names, skill specs, base model, and default environment when present. Disabled agents are hidden from pretty and text list output; when any are hidden, the CLI prints
N disabled agents hiddento stderr after stdout output. JSON output still preserves the raw API response. - Pretty output for
oz agent listalso includes a hint for users looking for the old skill-discovery behavior:Looking for agent skills? Use <binary> agent skills instead. - Pretty output for get/create/update uses the same readable table shape for the single returned agent.
- Plain-text output is stable and script-friendly tabular text with headers for both list and single-agent output.
- JSON output for list/get/create/update preserves the API response shape so scripts can consume fields exactly as returned by the public API. List JSON is an object with an
agentsarray. - Sort flags are rejected for JSON output, including
--jq, so raw API output remains raw. --jqimplies JSON output even when the global output format is omitted or set to a human-readable format.--jqfilters list/get/create/update JSON output using the same jq behavior asoz run listandoz run get, including unquoted scalar output.- Delete has no JSON API response body. For JSON and ndjson output, the CLI emits a minimal operation result containing the deleted UID and
deleted: true; pretty output reports the deleted UID in a sentence, text output prints the deleted UID, and delete does not support--jq. - All named-agent CRUD commands require authentication and reuse the existing CLI authentication and API-key behavior.
- If the server returns authorization, validation, conflict, or not-found errors, the CLI prints the server-facing error through the existing fatal-error path.
- The command hierarchy remains backward-compatible except for the intentional rename: users who want the previous skill list behavior must use
oz agent skills.