feat(agent): make model presets session-scoped (#4866)

This commit is contained in:
chengyongru
2026-07-23 00:38:49 +08:00
committed by GitHub
parent 66690fdb0c
commit c22efb5f7a
41 changed files with 1140 additions and 155 deletions
+4 -5
View File
@@ -34,9 +34,8 @@ description: Inspect and optionally adjust the agent's runtime state. Use to che
| Situation | Command |
|-----------|---------|
| Large codebase analysis | `my(action="set", key="context_window_tokens", value=262144)` |
| Switch to a named model preset | `my(action="set", key="model_preset", value="<preset-name>")` |
| Repetitive simple tasks without a preset | `my(action="set", key="model", value="<fast-model>")` |
| Check capacity for a large task | `my(action="check", key="context_window_tokens")` |
| Switch model or context capacity | `my(action="set", key="model_preset", value="<preset-name>")` |
| Long multi-step task | `my(action="set", key="max_iterations", value=80)` |
**Tradeoff:** Bias toward stability. Only set when defaults are genuinely insufficient.
@@ -57,8 +56,8 @@ description: Inspect and optionally adjust the agent's runtime state. Use to che
## Constraints
- All modifications in-memory only — restart resets everything
- Prefer `model_preset` for configured model choices. Direct `model` changes clear the active preset and should only be used when no preset exists.
- `model_preset` is saved for the current session; other modifications are in-memory only
- Direct `model` and `context_window_tokens` writes are rejected during active sessions because they would change the shared instance default. Use a configured `model_preset` instead.
- Protected params have type/range validation: `max_iterations` (1100), `context_window_tokens` (40961M), `model` (non-empty str)
- If `tools.my.allow_set` is false, check only