Skip to content

Commit 35ebf84

Browse files
Craig ShoemakerCopilot
authored andcommitted
[SRE Agent] Update agent features and capabilities documentation
Update documentation for agent playground, hooks, reasoning, sub-agents, test tool playground, deep investigation, workflow automation, memory, skills, and run modes. Co-authored-by: Copilot <[email protected]>
1 parent f95e174 commit 35ebf84

17 files changed

Lines changed: 343 additions & 318 deletions

articles/sre-agent/agent-hooks.md

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Agent Hooks in Azure SRE Agent
33
description: Intercept and control agent behavior with custom scripts or LLM-based validation that runs before or after specific agent actions.
44
ms.topic: conceptual
55
ms.service: azure-sre-agent
6-
ms.date: 03/09/2026
6+
ms.date: 03/18/2026
77
author: craigshoemaker
88
ms.author: cshoe
99
ms.ai-usage: ai-assisted
@@ -13,7 +13,7 @@ ms.custom: hooks, agent hooks, stop hook, post tool use, validation, audit, poli
1313

1414
# Agent hooks in Azure SRE Agent
1515

16-
Hooks are custom checkpoints that intercept and control agent behavior at key moments. Use hooks to enforce quality gates on agent responses, audit and control tool usage, block dangerous operations with policy enforcement, and prevent early task completion by validating agent output.
16+
Hooks are custom checkpoints that intercept and control agent behavior at key moments. Use hooks to enforce quality gates on agent responses, audit and control tool usage, block dangerous operations by enforcing policies, and prevent early task completion by validating agent output.
1717

1818
<!-- > [!VIDEO https://www.youtube.com/embed/VIDEO_ID]
1919
>
@@ -44,7 +44,18 @@ Two hook events are currently supported:
4444
| Event | Triggers when | What you can do |
4545
|---|---|---|
4646
| **Stop** | Agent is about to return a final response | Validate completeness, reject and force the agent to continue |
47-
| **PostToolUse** | A tool finishes executing successfully | Audit usage, block results, inject additional context |
47+
| **PostToolUse** | A tool finishes executing successfully | Audit usage, block results, inject extra context |
48+
49+
### Two levels of hooks
50+
51+
Hooks operate at two levels:
52+
53+
| Level | Where to configure | Scope |
54+
|-------|--------------------|-------|
55+
| **Agent level** | **Builder → Hooks** in the portal | Applies to the entire agent including all threads and all custom agents |
56+
| **Custom agent level** | **Agent Canvas → Custom agent → Manage Hooks**, or via the REST API v2 | Applies only when that specific custom agent runs |
57+
58+
Both levels can coexist. If an agent-level hook and a custom-agent-level hook both match the same event, **both run**. The agent-level hooks fire first.
4859

4960
### Execution types
5061

@@ -55,11 +66,11 @@ You can implement hooks by using either an LLM or a shell script:
5566
| **Prompt** | An LLM evaluates your prompt and returns a JSON decision | Nuanced validation ("Is this response complete?") |
5667
| **Command** | A bash or Python script runs in a sandboxed environment | Deterministic checks, policy enforcement, auditing |
5768

58-
**Prompt hooks** are powerful for subjective evaluation, such as checking if a response addresses all user concerns or verifying that an investigation was thorough enough. They use the `$ARGUMENTS` placeholder to receive the full hook context. If `$ARGUMENTS` isn't present in the prompt, the context is appended automatically. Prompt hooks also receive `ReadFile` and `GrepSearch` tools when a conversation transcript is available, which lets the LLM reason about the full conversation history.
69+
**Prompt hooks** are powerful for subjective evaluation, such as checking if a response addresses all user concerns or verifying that an investigation was thorough enough. They use the `$ARGUMENTS` placeholder to receive the full hook context. If `$ARGUMENTS` isn't present in the prompt, the context is appended automatically. When a conversation transcript is available, prompt hooks also receive `ReadFile` and `GrepSearch` tools, which let the LLM reason about the full conversation history.
5970

6071
**Command hooks** are better for deterministic checks, such as validating that a response contains required markers, blocking dangerous commands, or logging tool usage to an external system.
6172

62-
## What makes this different
73+
## What makes this approach different
6374

6475
The following table compares agent behavior with and without hooks.
6576

@@ -83,21 +94,15 @@ Hooks don't replace run mode safety controls - they complement them. Run modes c
8394

8495
## Configure hooks
8596

86-
Hooks require the **v2 YAML format** (`api_version: azuresre.ai/v2`, `kind: ExtendedAgent`). Define hooks under `spec.hooks` in the agent configuration.
97+
The easiest way to create hooks is through the portal UI:
8798

88-
> [!WARNING]
89-
> The portal's Subagent builder YAML tab displays agent configuration in **v1 format only**. It doesn't show or support editing hooks. To configure hooks, use the **REST API v2** endpoint:
90-
>
91-
> ```
92-
> PUT /api/v2/extendedAgent/agents/{agentName}
93-
> Content-Type: application/json
94-
> ```
95-
>
96-
> Hooks configured through the API are active even though they don't appear in the portal YAML view. You can verify hooks are working by testing the agent in the portal's **Test playground**.
97-
>
98-
> :::image type="content" source="media/agent-hooks/hooks-portal-v1-limitation.png" alt-text="Screenshot of the portal YAML tab showing v1 format without hooks." lightbox="media/agent-hooks/hooks-portal-v1-limitation.png":::
99+
1. **Agent-level hooks:** Go to **Builder****Hooks** → select **Create hook**.
100+
2. **Custom-agent-level hooks:** Go to **Agent Canvas** → select a custom agent → **Manage Hooks**.
101+
102+
> [!TIP]
103+
> You can also configure hooks through **REST API v2** by using `PUT /api/v2/extendedAgent/agents/{agentName}`. The YAML format in the following section shows the full configuration schema. To learn more, see the [API tutorial](tutorial-agent-hooks.md).
99104
>
100-
> The portal YAML tab displays v1 format. Hooks aren't visible here but are active on the server.
105+
> The **Agent Canvas YAML** tab displays v1 format and doesn't show hooks. Use the **Hooks** page under **Builder** to view and manage hooks.
101106
102107
The following example shows a complete hook configuration:
103108

@@ -168,7 +173,7 @@ Command hooks can also use exit codes instead of JSON output:
168173
|---|---|
169174
| `0` with no output | Allow (no objection) |
170175
| `0` with JSON | Parse JSON for decision |
171-
| `2` | Always block stderr becomes the reason |
176+
| `2` | Always block. stderr becomes the reason |
172177
| Other | Uses `failMode` setting (`allow` or `block`) |
173178

174179
> [!CAUTION]
@@ -252,7 +257,7 @@ The following limits apply to agent hooks.
252257

253258
## Example: Audit all tool usage
254259

255-
The following PostToolUse hook logs every tool call and injects an audit context message:
260+
The following PostToolUse hook logs every tool call and adds an audit context message:
256261

257262
```yaml
258263
hooks:
@@ -279,7 +284,7 @@ hooks:
279284
print(json.dumps(output))
280285
```
281286
282-
The `additionalContext` field is injected as a user message into the conversation, giving the agent visibility into the audit trail.
287+
The `additionalContext` field is added as a user message into the conversation, giving the agent visibility into the audit trail.
283288

284289
## Example: Require a completion marker
285290

@@ -308,25 +313,28 @@ hooks:
308313

309314
Follow these guidelines when you configure agent hooks:
310315

311-
1. **Always provide a reason when rejecting** — Rejections without reasons are treated as approvals.
312-
1. **Use appropriate timeouts** Long-running hooks slow down agent execution.
313-
1. **Handle errors gracefully** Use `failMode: allow` unless strict enforcement is required.
314-
1. **Be specific with matchers** Overly broad PostToolUse matchers can cause performance problems.
315-
1. **Test hooks thoroughly** Hooks that always reject can cause loops (mitigated by `maxRejections`).
316-
1. **Log to stderr**Use stderr for debugging output. Stdout is parsed as the hook result.
316+
1. **Always provide a reason when rejecting**. Treat rejections without reasons as approvals.
317+
1. **Use appropriate timeouts**: Long-running hooks slow down agent execution.
318+
1. **Handle errors gracefully**: Use `failMode: allow` unless strict enforcement is required.
319+
1. **Be specific with matchers**: Overly broad PostToolUse matchers can cause performance problems.
320+
1. **Test hooks thoroughly**: Hooks that always reject can cause loops (mitigated by `maxRejections`).
321+
1. **Log to stderr**: Use stderr for debugging output. The system parses stdout as the hook result.
317322

318323
## Try it yourself
319324

320325
The following screenshot shows a Stop hook in action. The agent initially responds with just "4", but the hook rejects the response because the completion marker is missing. The agent then continues and adds the marker.
321326

322327
:::image type="content" source="media/agent-hooks/hooks-stop-hook-working.png" alt-text="Screenshot showing a Stop hook in action where the agent response is decorated with a completion marker after hook rejection." lightbox="media/agent-hooks/hooks-stop-hook-working.png":::
323328

324-
## Next step
329+
## Get started
325330

326-
> [!div class="nextstepaction"]
327-
> [Tutorial: Configure agent hooks](./tutorial-agent-hooks.md)
331+
| Resource | What you'll learn |
332+
|----------|-------------------|
333+
| [Configure agent hooks (API)](tutorial-agent-hooks.md) | Set up hooks by using REST API v2 and YAML |
328334

329335
## Related content
330336

331-
- [Run modes](./run-modes.md)
332-
- [Python code execution](python-code-execution.md)
337+
| Capability | How it relates |
338+
|------------|----------------|
339+
| [Run modes](run-modes.md) | Hooks complement run mode safety controls. Modes control *what* runs, hooks control *how well* it runs. |
340+
| [Python tools](python-code-execution.md) | Create custom tools that hooks can audit and validate. |

articles/sre-agent/agent-playground.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ title: Agent Playground in Azure SRE Agent
33
description: Test and refine your agent configurations in real time before deploying changes with the split-screen editor and AI-powered evaluation.
44
ms.topic: conceptual
55
ms.service: azure-sre-agent
6-
ms.date: 03/09/2026
6+
ms.date: 03/18/2026
77
author: craigshoemaker
88
ms.author: cshoe
99
ms.ai-usage: ai-assisted
10-
ms.custom: playground, testing, subagent, evaluation, quality, iterate
10+
ms.custom: playground, testing, custom agent, evaluation, quality, iterate
1111
#customer intent: As an SRE, I want to test my agent configurations in an isolated playground so that I can iterate quickly without affecting production workflows.
1212
---
1313

1414
# Agent playground in Azure SRE Agent
15-
Test subagent behavior in real time before deploying changes. Edit instructions, tools, and handoffs with instant feedback in a split-screen layout. Evaluate agent quality with AI-powered scoring and quick fixes.
15+
Test custom agent behavior in real time before deploying changes. Edit instructions, tools, and handoffs with instant feedback in a split-screen layout. Evaluate agent quality with AI-powered scoring and quick fixes.
1616

1717
## The problem
1818

@@ -22,41 +22,41 @@ Without a dedicated testing environment, you deploy changes to see how they beha
2222

2323
## How the playground works
2424

25-
The playground is a dedicated view in the **Subagent builder** alongside Canvas and Table views. Select **Test playground** from the view toggle to enter a split-screen environment where you edit on the left and test on the right.
25+
The playground is a dedicated view in the **Agent Canvas** alongside Canvas and Table views. Select **Test playground** from the view toggle to enter a split-screen environment where you edit and test.
2626

2727
:::image type="content" source="media/common/playground-agent-selected.png" alt-text="Screenshot of agent playground showing split-screen layout with form editor on left and chat test panel on right.":::
2828

2929
### Select what to test
3030

31-
Use the **Subagent/Tool** dropdown at the top to choose what to test.
31+
Use the **Custom agent/Tool** dropdown at the top to choose what to test.
3232

3333
| Entity | What you can test |
3434
|---|---|
35-
| **Subagent** | Instructions, tools, handoffs, and memory in a live chat |
36-
| **Main agent (meta_agent)** | Override the orchestrator prompt and test routing behavior |
35+
| **Custom agent** | Instructions, tools, handoffs, and memory in a live chat |
36+
| **Your agent** | Override the orchestrator prompt and test routing behavior |
3737
| **System tool** | Execute built-in tools with custom parameters |
3838
| **Kusto tool** | Run queries against your connected clusters |
3939

40-
:::image type="content" source="media/common/playground-entity-selector.png" alt-text="Screenshot of entity selector dropdown showing subagents and tools available for testing.":::
40+
:::image type="content" source="media/common/playground-entity-selector.png" alt-text="Screenshot of entity selector dropdown showing custom agents and tools available for testing.":::
4141

4242
### Edit and test side by side
4343

44-
For subagents, the playground splits into two panels.
44+
For custom agents, the playground splits into two panels.
4545

46-
**Left panel — Editor:**
46+
**Editor:**
4747

48-
- **Form view**Edit subagent name, instructions, handoff instructions, handoff subagents, tools, and knowledge base access.
49-
- **YAML view** Edit the full agent configuration as YAML.
48+
- **Form view**: Edit custom agent name, instructions, handoff instructions, handoff custom agents, tools, and knowledge base access.
49+
- **YAML view**: Edit the full agent configuration as YAML.
5050

51-
**Right panel — Testing:**
51+
**Testing:**
5252

53-
- **Test tab** Chat with your agent by using the current configuration.
54-
- **Evaluation tab** Run AI-powered quality analysis.
53+
- **Test tab**: Chat with your agent by using the current configuration.
54+
- **Evaluation tab**: Run AI-powered quality analysis.
5555

5656
> [!NOTE]
5757
> When you modify the configuration, chat input is disabled until you select **Apply** to save your changes or **Discard** to revert. This behavior prevents testing stale configurations. Selecting **Apply** also starts a fresh chat thread so you can test the updated configuration from scratch.
5858
59-
## What makes this different
59+
## What makes this approach different
6060

6161
Unlike testing in live conversations, the playground provides an isolated environment where changes don't affect production threads. The split-screen layout means you see the effect of instruction changes immediately without switching between views or waiting for deployments.
6262

@@ -82,47 +82,50 @@ The evaluation returns the following scores:
8282
| **Completeness** | Whether the prompt covers role, goal, and operational guidance |
8383
| **Tool fit** | Whether the right tools are configured |
8484
| **Prompt clarity** | How clear and actionable the instructions are |
85+
| **Actionability** | Whether responses include concrete, executable next steps |
8586
| **Safety** | Error handling, confirmation prompts, and safeguards |
8687

8788
### Quick fixes
8889

89-
When evaluation identifies improvements, select **Review and apply** to open the quick fixes dialog. Select the fixes you want, preview the YAML diff on the right, and then use the **Accept selected fixes** button. You can choose to continue editing or save immediately.
90+
When evaluation identifies improvements, select **Review and apply** to open the quick fixes dialog. Select the fixes you want, preview the YAML diff, and then use the **Accept selected fixes** button. You can choose to continue editing or save immediately.
9091

9192
> [!TIP]
9293
> Run evaluation after a few test conversations. The evaluation considers chat behavior alongside your configuration to provide more accurate scoring.
9394
9495
> [!NOTE]
95-
> If you change the agent configuration after running an evaluation, the results are marked as **outdated** and you're prompted to re-evaluate. Similarly, new chat activity after an evaluation marks results as **stale**. Re-evaluate to get insights that reflect your latest testing.
96+
> If you change the agent configuration after running an evaluation, the results are marked as **outdated** and you're prompted to reevaluate. Similarly, new chat activity after an evaluation marks results as **stale**. Reevaluate to get insights that reflect your latest testing.
9697
9798
## Test tools in isolation
9899

99100
You can test system tools and Kusto tools independently from the agent playground.
100101

101102
### System tools
102103

103-
Select a system tool from the **Subagent/Tool** dropdown to test built-in capabilities independently. Enter parameter values and select **Execute Tool** to see the raw JSON output.
104+
Select a system tool from the **Custom agent/Tool** dropdown to test built-in capabilities independently. Enter parameter values and select **Execute Tool** to see the raw JSON output.
104105

105106
### Kusto tools
106107

107-
Select a Kusto tool to test your query against connected clusters. The test panel shows query results with row counts, columns, and execution time. Adjust your KQL on the left and rerun on the right.
108+
Select a Kusto tool to test your query against connected clusters. The test panel shows query results with row counts, columns, and execution time. Adjust your KQL and rerun.
108109

109110
For step-by-step instructions, see [Test a tool in the playground](test-tool-playground.md).
110111

111112
## AI-assisted configuration
112113

113-
The playground includes two AI assistance features for refining subagent instructions:
114+
The playground includes two AI assistance features for refining custom agent instructions:
114115

115116
- **Refine with AI**: Rewrites your instructions and handoff description in place. This feature directly replaces your current text with an AI-improved version, so review the changes before saving.
116117
- **View AI suggestions**: Opens a read-only panel alongside the form showing AI recommendations: suggestions for improvement, warnings about potential problems, and improved versions of your instructions and handoff description. This feature doesn't modify your configuration. Use it as a reference while editing.
117118

118-
## Next step
119+
## Get started
119120

120-
> [!div class="nextstepaction"]
121-
> [Test a tool in the playground](./test-tool-playground.md)
121+
| Resource | What you learn |
122+
|---|---|
123+
| [Test a tool in the playground](test-tool-playground.md) | Step-by-step walkthrough of the playground interface |
122124

123125
## Related content
124126

125-
- [Subagents](sub-agents.md)
126-
- [Kusto tools](kusto-tools.md)
127-
- [Python code execution](python-code-execution.md)
128-
- [Tutorial: Test a tool in the playground](test-tool-playground.md)
127+
| Resource | Description |
128+
|---|---|
129+
| [Custom agents](sub-agents.md) | How custom agents work and when to use them |
130+
| [Kusto tools](kusto-tools.md) | Build reusable KQL queries for your agent |
131+
| [Python code execution](python-code-execution.md) | Create custom Python tools |

0 commit comments

Comments
 (0)