Commit 7c6902b
authored
feat: add background, effort, permissionMode to AgentDefinition (#782)
## Summary
Adds 3 fields to `AgentDefinition` that are present in the TS SDK's
`AgentDefinitionSchema` (`coreSchemas.ts`) but missing from the Python
SDK:
- **`background: bool | None`** -- Run this agent as a background task
(non-blocking, fire-and-forget) when invoked. This is the key addition:
it enables parallel subagent execution without spawning multiple SDK
sessions.
- **`effort: Literal["low", "medium", "high", "max"] | int | None`** --
Reasoning effort level for the agent. Accepts either a named level or an
integer.
- **`permissionMode: PermissionMode | None`** -- Permission mode
controlling how tool executions are handled for this agent.
All three are optional pass-through fields that the CLI already supports
via the `AgentDefinitionSchema` in the control protocol. The existing
`asdict()` + None-filtering serialization in `_internal/client.py`
handles them automatically -- no serialization changes needed.
`permissionMode` reuses the existing `PermissionMode` type alias already
defined in `types.py`.
## Tests
Added 5 new tests in `TestAgentDefinition`:
- `test_background_serializes_correctly` -- verifies boolean
serialization
- `test_effort_accepts_named_level` -- verifies string effort ("high")
- `test_effort_accepts_integer` -- verifies integer effort (32000)
- `test_permission_mode_serializes_as_camelcase` -- verifies camelCase
key
- `test_new_fields_omitted_when_none` -- verifies all 3 fields absent
when unset
All 44 tests pass.
<\!-- CHANGELOG-SDK:START -->
- Added `background`, `effort`, and `permissionMode` fields to
`AgentDefinition` for TS SDK parity
<\!-- CHANGELOG-SDK:END -->1 parent b63e8f1 commit 7c6902b
2 files changed
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
0 commit comments