Skip to content

Commit 6eba0db

Browse files
therealjohnCopilot
andcommitted
ai.docs: add routine doc category for azure.ai.routines
Add a fifth doc category for the Foundry routine resource (the azure.ai.routines extension) alongside agent, connection, toolbox, and skill. Five topics under skills/routine/: overview (trigger+action model, lifecycle, CLI surface), triggers (timer / recurring / github_issue reference with cron, IANA time zones, and the 5-minute minimum interval rule), actions (agent-response vs agent-invoke reference with field matrices), manage (CRUD CLI for create/update/show/list/delete/enable/disable plus the YAML/JSON manifest format and the type-immutability rule), dispatch (manual --input dispatch + run history for debugging failed runs with error_type/error_message correlation). Also: add azd ai routine to the embedded SKILL.md router and allowed-tools list; refresh README directory layout and example snippets; add CHANGELOG entry; add datetimes and repointed to cspell.yaml for the new content. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ae28ea5 commit 6eba0db

15 files changed

Lines changed: 998 additions & 10 deletions

File tree

cli/azd/extensions/azure.ai.docs/CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
### Added
66

7+
* `azd ai doc routine` command group with topics for the Foundry routine
8+
resource (`overview`, `triggers`, `actions`, `manage`, `dispatch`).
9+
Covers the `azure.ai.routines` extension lifecycle: the trigger +
10+
action discriminated-union model, the trigger types reference (timer /
11+
recurring / github_issue) including the 5-minute minimum cron interval
12+
and IANA time-zone rules, the action types reference (agent-response /
13+
agent-invoke) with field matrices, the imperative CLI (create /
14+
update / show / list / delete / enable / disable) including the
15+
manifest file format and the type-immutability rule, and the manual
16+
dispatch + run-history flow for debugging.
717
* `azd ai doc skill` command group with topics for the Foundry skill
818
resource (`overview`, `manage`, `share`, `consume`). Covers the
919
`azure.ai.skills` extension lifecycle: the versioned skill model
@@ -20,6 +30,6 @@
2030
child copies the bundled `azd-ai-skill` coding-agent pack into the
2131
user's project (the existing `--target` / `--path` / `--force` /
2232
`--output` flag surface is unchanged). No backwards-compatible alias.
23-
* The embedded `SKILL.md` router now lists the Foundry skill resource
24-
docs alongside agent / connection / toolbox docs and adds
25-
`azd ai skill` to the `allowed-tools` list.
33+
* The embedded `SKILL.md` router now lists the Foundry skill and routine
34+
resource docs alongside agent / connection / toolbox docs and adds
35+
`azd ai skill` and `azd ai routine` to the `allowed-tools` list.

cli/azd/extensions/azure.ai.docs/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ azd ai doc skill manage
2828
azd ai doc skill share
2929
azd ai doc skill consume
3030

31+
# List topics for Foundry routines (azure.ai.routines)
32+
azd ai doc routine
33+
azd ai doc routine overview
34+
azd ai doc routine triggers
35+
azd ai doc routine actions
36+
azd ai doc routine manage
37+
azd ai doc routine dispatch
38+
3139
# Install the embedded azd-ai-skill coding-agent pack into the project
3240
azd ai doc install skill --target copilot
3341
```
@@ -88,11 +96,18 @@ internal/cmd/
8896
manage.md
8997
share.md
9098
consume.md
99+
routine/ <-- topics for azure.ai.routines (Foundry routine resource)
100+
overview.md
101+
triggers.md
102+
actions.md
103+
manage.md
104+
dispatch.md
91105
doc_catalog.go <-- docCategories table (one entry per skills/ subdir)
92106
doc_agent.go <-- per-extension subcommand (one per category)
93107
doc_connection.go
94108
doc_toolbox.go
95109
doc_skill.go
110+
doc_routine.go
96111
```
97112

98113
To add a new sibling:

cli/azd/extensions/azure.ai.docs/cspell.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ words:
4242
- parseable
4343
# Foundry-skills terms used in skill/* topic markdown bodies.
4444
# `agentskills` references the agentskills.io naming spec.
45-
# `repoint` / `repoints` describe the metadata-only default-version
46-
# update flow on Foundry skills (mirrors azure.ai.skills cspell.yaml).
45+
# `repoint` / `repoints` / `repointed` describe the metadata-only
46+
# default-version update flow on Foundry skills (mirrors azure.ai.skills cspell.yaml).
4747
- agentskills
4848
- repoint
4949
- repoints
50+
- repointed
51+
# Used in routine triggers.md when discussing one-shot timer firings.
52+
- datetimes
5053
overrides:
5154
- filename: internal/cmd/doc_catalog.go
5255
words:

cli/azd/extensions/azure.ai.docs/internal/cmd/doc_catalog.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,34 @@ var docCategories = []DocCategory{
201201
"Print the hosted-agent consumption guide.": "azd ai doc skill consume",
202202
},
203203
},
204+
{
205+
Name: "routine",
206+
DisplayName: "Foundry routines (azure.ai.routines)",
207+
// Foundry routines pair a trigger (timer / recurring / event)
208+
// with an action (invoke an agent). Managed via the
209+
// `azd ai routine` CLI (from the `azure.ai.routines`
210+
// extension). This is how a deployed agent gets billed work
211+
// that fires on its own (scheduled or event-driven), as
212+
// opposed to the on-demand `azd ai agent invoke` path.
213+
Short: "Manage Foundry routines -- trigger + action pairs that fire on a schedule or event and invoke an agent " +
214+
"(azure.ai.routines).",
215+
Preamble: []string{
216+
"A routine pairs a trigger (timer, recurring schedule, or external event) with an action " +
217+
"(invoke an agent). Foundry fires the routine on its own when the trigger matches, " +
218+
"or you can fire it manually with `azd ai routine dispatch`. Each firing records a " +
219+
"RoutineRun row visible via `routine run list`.",
220+
"Use `azd ai doc routine <topic>` to print one topic's body in full. " +
221+
"Start with `overview` for the mental model, then `manage` for the CLI.",
222+
},
223+
Examples: map[string]string{
224+
"List topics for routines.": "azd ai doc routine",
225+
"Print the overview topic.": "azd ai doc routine overview",
226+
"Print the trigger-types reference.": "azd ai doc routine triggers",
227+
"Print the action-types reference.": "azd ai doc routine actions",
228+
"Print the management CLI reference.": "azd ai doc routine manage",
229+
"Print the dispatch + run-history guide.": "azd ai doc routine dispatch",
230+
},
231+
},
204232
}
205233

206234
// init populates the Topics field of every DocCategory from the

cli/azd/extensions/azure.ai.docs/internal/cmd/doc_renderer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ func categoryExtensionName(cat DocCategory) string {
255255
return "azure.ai.agents"
256256
case "skill":
257257
return "azure.ai.skills"
258+
case "routine":
259+
return "azure.ai.routines"
258260
default:
259261
return fmt.Sprintf("azure.ai.%s", cat.Name)
260262
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
// doc_routine.go implements `azd ai doc routine [topic]` -- prints
5+
// embedded routine-friendly markdown from skills/routine/*.md. Mirrors
6+
// doc_agent.go / doc_connection.go / doc_toolbox.go / doc_skill.go; all
7+
// five share printCategoryTopic and the embedded skillsFS in
8+
// doc_agent.go (via the //go:embed skills/*/*.md glob).
9+
//
10+
// These are docs for the Foundry Routine resource (trigger + action
11+
// pairs that fire on a schedule, a one-shot timer, or an external
12+
// event such as a GitHub issue, and invoke an agent on the project).
13+
// Managed via `azd ai routine` from the azure.ai.routines extension.
14+
//
15+
// Add a new topic by dropping a markdown file with front-matter into
16+
// skills/routine/; the catalog loader picks it up automatically.
17+
18+
package cmd
19+
20+
import (
21+
"fmt"
22+
23+
"github.com/spf13/cobra"
24+
)
25+
26+
// newRoutineCommand returns `azd ai doc routine [topic]`. When invoked
27+
// with no positional arg, prints the routine topic list. When invoked
28+
// with a positional topic name, prints that topic body.
29+
//
30+
// Acts as a single entry point an agent uses to load just the slice of
31+
// Foundry routine docs it needs to drive the `azd ai routine` CLI and
32+
// to author a routine manifest (trigger + action) for a deployed agent.
33+
func newRoutineCommand() *cobra.Command {
34+
cmd := &cobra.Command{
35+
Use: "routine [topic]",
36+
Short: "Print agent-friendly documentation for Foundry routines.",
37+
// Long is intentionally empty: the styled Description function
38+
// passed via helpformat.Install in root.go drives the --help
39+
// preamble (the same string the RunE prints below for direct
40+
// invocation). cmd.Example is also intentionally empty so
41+
// helpformat.Install's cmd.Example auto-migration does not
42+
// produce a duplicate Examples block alongside the Footer one
43+
// we wire in root.go.
44+
Args: cobra.MaximumNArgs(1),
45+
RunE: func(cmd *cobra.Command, args []string) error {
46+
if len(args) == 0 {
47+
cat := FindCategory("routine")
48+
if cat == nil {
49+
return fmt.Errorf("doc catalog: routine category not registered")
50+
}
51+
out := cmd.OutOrStdout()
52+
if _, err := fmt.Fprint(out, renderCatalogBody(*cat)); err != nil {
53+
return err
54+
}
55+
if _, err := fmt.Fprint(out, renderCatalogExamples(*cat)); err != nil {
56+
return err
57+
}
58+
return nil
59+
}
60+
return printCategoryTopic(cmd.OutOrStdout(), "routine", args[0])
61+
},
62+
}
63+
return cmd
64+
}

cli/azd/extensions/azure.ai.docs/internal/cmd/help_styling_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ func TestDocRootHelp_StyledSections(t *testing.T) {
6464
"third catalog example title missing")
6565

6666
// Cobra's Available Commands listing should include the visible
67-
// leaves (agent, connection, toolbox, skill, install, version;
68-
// metadata is reserved by the SDK and may appear as well -- not
69-
// asserted).
70-
for _, name := range []string{"agent", "connection", "toolbox", "skill", "install", "version"} {
67+
// leaves (agent, connection, toolbox, skill, routine, install,
68+
// version; metadata is reserved by the SDK and may appear as well
69+
// -- not asserted).
70+
for _, name := range []string{"agent", "connection", "toolbox", "skill", "routine", "install", "version"} {
7171
assert.True(t, strings.Contains(out, name),
7272
"Cobra subcommand list missing %q", name)
7373
}

cli/azd/extensions/azure.ai.docs/internal/cmd/root.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func NewRootCommand() *cobra.Command {
4040
rootCmd.AddCommand(newConnectionCommand())
4141
rootCmd.AddCommand(newToolboxCommand())
4242
rootCmd.AddCommand(newSkillCommand())
43+
rootCmd.AddCommand(newRoutineCommand())
4344
rootCmd.AddCommand(newInstallCommand(extCtx))
4445
rootCmd.AddCommand(newVersionCommand(&extCtx.OutputFormat))
4546
rootCmd.AddCommand(newMetadataCommand(rootCmd))
@@ -105,6 +106,19 @@ func NewRootCommand() *cobra.Command {
105106
}
106107
}
107108

109+
// Same wiring for the routine category command. Mirrors the agent /
110+
// connection / toolbox / skill blocks above. doc_routine.go stays
111+
// cobra-only.
112+
if routineCmd := findChild(rootCmd, "routine"); routineCmd != nil {
113+
if cat := FindCategory("routine"); cat != nil {
114+
c := *cat
115+
helpformat.Install(routineCmd, helpformat.Options{
116+
Description: func(*cobra.Command) string { return renderCatalogBody(c) },
117+
Footer: func(*cobra.Command) string { return renderCatalogExamples(c) },
118+
})
119+
}
120+
}
121+
108122
// Walk the rest of the tree (skills, version, metadata) and apply
109123
// default styling. InstallAll skips already-Installed commands so
110124
// root and agent (above) keep their custom Description/Footer.

cli/azd/extensions/azure.ai.docs/internal/cmd/root_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ func TestNewRootCommand_HasAgentSubcommand(t *testing.T) {
2626
"azd ai doc must expose the toolbox subgroup")
2727
assert.Contains(t, names, "skill",
2828
"azd ai doc must expose the skill subgroup (Foundry skill resource docs)")
29+
assert.Contains(t, names, "routine",
30+
"azd ai doc must expose the routine subgroup (Foundry routine resource docs)")
2931
assert.Contains(t, names, "install",
3032
"azd ai doc must expose the install subgroup (embedded skill-pack installer)")
3133
}
@@ -87,6 +89,26 @@ func TestSkillsFS_HasAllSkillTopics(t *testing.T) {
8789
}, got)
8890
}
8991

92+
func TestSkillsFS_HasAllRoutineTopics(t *testing.T) {
93+
// Pins the topic set for the Foundry routine resource docs (the
94+
// azure.ai.routines extension). A future drop or rename is a
95+
// deliberate test update -- topic names are the wire contract
96+
// callers rely on (`azd ai doc routine <topic>`).
97+
topics, err := loadCategoryTopics("routine")
98+
require.NoError(t, err)
99+
var got []string
100+
for _, top := range topics {
101+
got = append(got, top.Name)
102+
}
103+
assert.ElementsMatch(t, []string{
104+
"overview",
105+
"triggers",
106+
"actions",
107+
"manage",
108+
"dispatch",
109+
}, got)
110+
}
111+
90112
func TestPrintCategoryTopic_KnownTopicEmitsBody(t *testing.T) {
91113
var buf bytes.Buffer
92114
require.NoError(t, printCategoryTopic(&buf, "agent", "initialize"))

cli/azd/extensions/azure.ai.docs/internal/cmd/skills/SKILL.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: azd-ai-skill
33
description: Set up, scaffold, configure, deploy, evaluate, and operate AI agents on Microsoft Foundry using the Azure Developer CLI (azd) and the azure.ai.agents extension. USE FOR azd ai agent, azd ai toolbox, foundry agent, agent.yaml, azure.yaml service config, hosted agent, deploying agents to Azure, running an agent locally, evaluating an agent, optimizing an agent, adding a tool to an agent, web search, code interpreter, file search, function tool, MCP server, OpenAPI tool, A2A peer agent, Azure AI Search RAG, Bing grounding, Bing Custom Search, toolbox, toolbox version, toolbox connection, connection, RemoteTool, CognitiveSearch, RemoteA2A, GroundingWithCustomSearch, OAuth2, UserEntraToken, AgenticIdentity, ProjectManagedIdentity, ApiKey, CustomKeys, model deployment, Foundry project endpoint. DO NOT USE FOR generic Azure CLI tasks unrelated to Foundry, or LLM application code that does not deploy to a Foundry hosted agent.
4-
allowed-tools: ["azd", "azd ai agent", "azd ai project", "azd ai toolbox", "azd ai connection", "azd ai skill", "azd ai doc", "azd version", "azd extension list", "azd auth login", "azd config get defaults", "azd env get-values"]
4+
allowed-tools: ["azd", "azd ai agent", "azd ai project", "azd ai toolbox", "azd ai connection", "azd ai skill", "azd ai routine", "azd ai doc", "azd version", "azd extension list", "azd auth login", "azd config get defaults", "azd env get-values"]
55
---
66
# AZD AI skill
77

@@ -98,6 +98,22 @@ azd ai doc skill <topic>
9898
| Cross-team / cross-project sharing via download | `share` |
9999
| Wire downloaded SKILL.md into a Hosted agent + redeploy flow | `consume` |
100100

101+
## Topics: routines
102+
103+
For managing **Foundry routines** -- trigger + action pairs that fire on a schedule, a one-shot timer, or an external event and invoke a deployed agent (the `azure.ai.routines` extension; `azd ai routine <verb>`). Routines are how a deployed agent gets billed work that fires on its own, as opposed to the on-demand `azd ai agent invoke` path:
104+
105+
```bash
106+
azd ai doc routine <topic>
107+
```
108+
109+
| Want to ... | Topic |
110+
| ------------------------------------------------------------ | ------------- |
111+
| Mental model + trigger+action lifecycle + `azd ai routine` CLI surface | `overview` |
112+
| Trigger types reference (timer / recurring / github_issue) | `triggers` |
113+
| Action types reference (agent-response / agent-invoke) | `actions` |
114+
| CLI reference (create / update / show / list / delete / enable / disable + manifest format) | `manage` |
115+
| Manual dispatch + run history + debugging a failed run | `dispatch` |
116+
101117
## Resolving subscription, location, project ID
102118

103119
`azd ai project show --output json` only returns the **Foundry project endpoint** (plus its resolution source) -- it does NOT return subscription, tenant, location, or resource group. For those, try in order:

0 commit comments

Comments
 (0)