Skip to content

Commit 8ef3124

Browse files
feat(steering): add AfterModelCallEvent steering documentation (strands-agents#451)
1 parent 0f4c445 commit 8ef3124

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

docs/user-guide/concepts/experimental/steering.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,48 @@ flowchart LR
2929

3030
## Steering
3131

32-
When agents attempt tool calls, steering handlers evaluate the action and provide guidance:
32+
Steering handlers can intercept agent behavior at two points: before tool calls and after model responses.
33+
34+
### Tool Steering
35+
36+
When agents attempt tool calls, steering handlers evaluate the action via `steer_before_tool()`:
3337

3438
```mermaid
3539
flowchart LR
3640
A[Tool Call Attempt] --> B[BeforeToolCallEvent]
37-
B --> C["Handler.steer()"]
38-
C --> D{SteeringAction}
41+
B --> C["Handler.steer_before_tool()"]
42+
C --> D{ToolSteeringAction}
3943
D -->|Proceed| E[Tool Executes]
4044
D -->|Guide| F[Cancel + Feedback]
4145
D -->|Interrupt| G[Human Input]
4246
```
4347

44-
**SteeringHandler** intercepts tool calls via BeforeToolCallEvent, evaluates using local `steering_context`, and returns a **SteeringAction**:
48+
**Tool steering** returns a `ToolSteeringAction`:
4549

4650
- **Proceed**: Tool executes immediately
4751
- **Guide**: Tool cancelled, agent receives contextual feedback
4852
- **Interrupt**: Tool execution paused for human input
4953

54+
### Model Steering
55+
56+
After each model response, steering handlers can evaluate output via `steer_after_model()`:
57+
58+
```mermaid
59+
flowchart LR
60+
A[Model Response] --> B[AfterModelCallEvent]
61+
B --> C["Handler.steer_after_model()"]
62+
C --> D{ModelSteeringAction}
63+
D -->|Proceed| E[Response Accepted]
64+
D -->|Guide| F[Discard + Retry]
65+
```
66+
67+
**Model steering** returns a `ModelSteeringAction`:
68+
69+
- **Proceed**: Accept the response as-is
70+
- **Guide**: Discard the response and retry with guidance injected into the conversation
71+
72+
This enables handlers to validate model responses, ensure required tools are used before completion, or guide conversation flow based on output.
73+
5074
## Getting Started
5175

5276
### Natural Language Steering
@@ -95,7 +119,7 @@ sequenceDiagram
95119
participant A as Agent
96120
participant S as Steering Handler
97121
participant T as Tool
98-
122+
99123
U->>A: "Send frustrated email to client"
100124
A->>A: Reason about request
101125
A->>S: Evaluate send_email tool call
@@ -106,8 +130,6 @@ sequenceDiagram
106130

107131

108132

109-
110-
111133
## Built-in Context Providers
112134

113135
### Ledger Provider

0 commit comments

Comments
 (0)