Commit 028d591
authored
feat(types): add disallowedTools, maxTurns, initialPrompt to AgentDefinition (#759)
Brings `AgentDefinition` to parity with the TypeScript SDK.
## New fields
| Field | Type | Purpose |
|---|---|---|
| `disallowedTools` | `list[str] \| None` | Tool names to explicitly
block for this agent |
| `maxTurns` | `int \| None` | Cap on agentic API round-trips before
stopping |
| `initialPrompt` | `str \| None` | Auto-submitted first turn when used
as main-thread agent |
## Changed
- `model` widened from `Literal["sonnet", "opus", "haiku", "inherit"]`
to `str` — TS accepts full model IDs (e.g. `claude-opus-4-5`) in
addition to aliases. Existing callers using the literal values are
unaffected.
## Not included
- `criticalSystemReminder_EXPERIMENTAL` — experimental, skipping for now
- Frontmatter-only fields (`background`, `permissionMode`, `hooks`,
`effort`, `isolation`) — neither SDK exposes these yet; separate effort
## Transport
Serialization in `client.py` already uses `asdict()` with a None-filter,
so new optional fields flow to the initialize request without transport
changes. Field names are camelCase to match the CLI's expected JSON keys
(same pattern as `mcpServers` from #684).1 parent f9fc8e0 commit 028d591
2 files changed
Lines changed: 47 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
0 commit comments