Skip to content

Add azd ai routine create/update/show/list/delete (plus enable, disable, dispatch, and run subcommands) to manage and run Foundry Routines from any directory #8159

@therealjohn

Description

@therealjohn

Feature Request

Please add azd ai routine commands to the agent extension that provide full CRUD, dispatch, and run-history access on Routines in a Foundry Project, following the design specifications in foundrysdk_specs PR #165. This issue is part of the umbrella consolidation effort tracked in #8135 and is a sibling to the toolbox work in #8143, the connection work in #8139, and the project-context work in #8124.

Design Highlights

  • Command surface: azd ai routine create | update | show | list | delete, azd ai routine enable | disable, azd ai routine dispatch, azd ai routine run list | show | delete.
  • Trigger as a flag: --trigger <schedule|timer|github-issue> plus per-trigger flags (--cron / --time-zone for schedule, --at / --time-zone for timer, --connection / --owner / --repository / --event-action for the stretch github-issue trigger). Same prompt / no-prompt behavior as connection create.
  • Action as a flag: --action <agent-response|agent-invoke> (defaults to agent-response), with --agent-id / --agent-endpoint-id / --conversation-id / --session-id as appropriate per action. CLI value names are short aliases for the API discriminators invoke_agent_responses_api and invoke_agent_invocations_api.
  • State management: enable / disable exposed as dedicated verbs; CLI hides whether the wire format is action routes (:enable / :disable) or a field on PUT.
  • Dispatch: azd ai routine dispatch <name> is synchronous by default; --async switches to the :dispatchAsync route. Supports --input "<text>" for the dispatch payload's user message and --conversation-id to continue an existing conversation thread.
  • Run history: azd ai routine run list <routine> with --top / --orderby / --filter matching the data-plane query parameters. Single-run show and delete are pending API support per the routines spec.
  • Update is merge: GET-then-PUT internally so only named flags change; switching --trigger or --action type after creation is out of scope (delete-and-recreate, mirroring the connection auth-type rule).
  • Endpoint resolution: Inherits the standard 5-level resolution order (flag, azd env, global config, env var, structured error) from the umbrella surface.
  • Standalone operation: Works outside an azd project given a resolvable project endpoint.
  • Cross-cutting flags: --output json, --no-prompt, --debug, -p / --project-endpoint, --force (delete confirmation skip), per the umbrella spec.

Open design questions (from the spec, Open Questions 4-6)

  1. Trigger / action enum values: ship CLI-friendly aliases (agent-response, agent-invoke; schedule, timer, github-issue) that map to the API discriminators (invoke_agent_responses_api, invoke_agent_invocations_api; schedule, timer, github_issue), or use 1:1 API parity values? Default proposed: short CLI aliases.
  2. Multi-trigger routines via the CLI. The Routines TypeSpec models Routine.triggers as a Record<RoutineTrigger> (a named dict). The flat-flag CLI shape implies a single trigger, keyed by the CLI as default. Add a routine trigger add | remove | list sub-collection now, or defer? Default proposed: defer.
  3. --conversation-id on azd ai routine dispatch. The routines spec has conversation_id as a first-class field on DispatchRequest; the TypeSpec PR's DispatchRoutineRequest does not include it. Default proposed: ship the CLI flag now, document as preview-only until the routines spec resolves.

These need Routines-service alignment before implementation.

API dependencies

  • Routines data plane: PUT /routines/{name} (idempotent), GET /routines/{name}, GET /routines, DELETE /routines/{name} -- per Routines TypeSpec PR #42779.
  • Routine dispatch: POST /routines/{name}:dispatch (sync) and POST /routines/{name}:dispatchAsync (async).
  • Routine runs: GET /routines/{name}/runs (list, ready in TypeSpec). Single-run GET and DELETE are pending API work per the routines spec.
  • enable / disable wire format: routines spec defines them as action routes (:enable / :disable); the TypeSpec PR currently models enabled as a field on the PUT body. CLI verbs are stable either way.

Please refer to the full design spec (foundrysdk_specs PR #165) -- specifically the Routines sub-section under Requirements, the API Surface table (rows 12-14), and Open Questions 4-6 -- for implementation guidance. The matching service-side spec lives in foundrysdk_specs/specs/agents/routines/spec.md.

Additional Context

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions