Skip to content

Commit f2e8b2c

Browse files
committed
docs(dsl): add planner agent property and dynamic(plannerAgent) syntax to DSL reference
Signed-off-by: Aleksandr Suvorov <asuvorov@hensu.io>
1 parent ab13d37 commit f2e8b2c

1 file changed

Lines changed: 51 additions & 9 deletions

File tree

docs/dsl-reference.md

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -875,11 +875,52 @@ node("research") {
875875
}
876876
```
877877

878+
#### Planner Agent
879+
880+
Dynamic planning requires an agent to generate the plan. By default the node's own agent handles both planning and execution. To use a dedicated planner agent, pass its ID to `dynamic()`:
881+
882+
```kotlin
883+
agents {
884+
agent("planner") {
885+
role = "Plan generation specialist"
886+
model = Models.GEMINI_3_1_FLASH_LITE
887+
temperature = 0.2
888+
}
889+
agent("researcher") {
890+
role = "Deep research analyst"
891+
model = Models.GEMINI_3_1_PRO
892+
temperature = 0.7
893+
}
894+
}
895+
896+
graph {
897+
node("research") {
898+
agent = "researcher"
899+
planning {
900+
dynamic("planner") // explicit planner agent
901+
maxSteps = 15
902+
review = true
903+
}
904+
prompt = "Research and analyze topic X"
905+
onSuccess goto "synthesize"
906+
}
907+
}
908+
```
909+
910+
Resolution order:
911+
1. **Explicit** – the `agent` property set in the `planning { }` block (or passed to `dynamic()`).
912+
2. **Fallback** – the node's own `agent`.
913+
914+
If neither is set, execution fails fast before the first node runs.
915+
916+
#### Convenience Methods
917+
878918
Convenience methods simplify common configurations:
879919

880920
```kotlin
881921
planning {
882922
dynamic() // Sets DYNAMIC mode with sensible defaults
923+
dynamic("planner") // Sets DYNAMIC mode with explicit planner agent
883924
withReview() // Pause for human review before execution
884925
noReplan() // Disable automatic replanning on failure
885926
}
@@ -891,15 +932,16 @@ planning {
891932

892933
### Planning Properties
893934

894-
| Property | Type | Default | Description |
895-
|------------------|--------------|-----------|-------------------------------------------------|
896-
| `mode` | PlanningMode | DISABLED | DISABLED, STATIC, or DYNAMIC |
897-
| `maxSteps` | Int | 10 | Maximum steps allowed in a plan |
898-
| `maxReplans` | Int | 3 | Maximum plan revisions on failure |
899-
| `allowReplan` | Boolean | true | Whether plan revision is allowed |
900-
| `review` | Boolean | false | Pause for human review before execution |
901-
| `maxDuration` | Duration | 5 minutes | Maximum total execution time |
902-
| `maxTokenBudget` | Int | 10000 | Maximum LLM tokens for planning (0 = unlimited) |
935+
| Property | Type | Default | Description |
936+
|------------------|--------------|-----------|-------------------------------------------------------------|
937+
| `mode` | PlanningMode | DISABLED | DISABLED, STATIC, or DYNAMIC |
938+
| `maxSteps` | Int | 10 | Maximum steps allowed in a plan |
939+
| `maxReplans` | Int | 3 | Maximum plan revisions on failure |
940+
| `allowReplan` | Boolean | true | Whether plan revision is allowed |
941+
| `review` | Boolean | false | Pause for human review before execution |
942+
| `agent` | String? | null | Planner agent ID; `null` falls back to the node's own agent |
943+
| `maxDuration` | Duration | 5 minutes | Maximum total execution time |
944+
| `maxTokenBudget` | Int | 10000 | Maximum LLM tokens for planning (0 = unlimited) |
903945

904946
### Plan Failure Routing
905947

0 commit comments

Comments
 (0)