SIGN IN SIGN UP

feat(deepagents): introduce ForkedSubAgent type for subagent conversation forking (#752)

## Summary

Replaces the `mode` field on `SubAgent` with a new `ForkedSubAgent` type
for opt-in conversation forking. A `ForkedSubAgent` has no
`systemPrompt` of its own — it always inherits the parent's message
history and exact system prompt, plus mirrored middleware when its model
matches the parent's. `CompiledSubAgent` keeps its existing `mode:
"handoff" | "fork"` field, unchanged.

## Changes

- New `ForkedSubAgent` type — same shape as `SubAgent` minus
`systemPrompt`; always forks.
- `SubAgent` no longer has a `mode` field — always isolated (same as
before this feature existed).
- `CompiledSubAgent.mode` unchanged.
- Mirrored middleware (memory/custom) only added when the model matches
the parent's; the system prompt itself is inherited unconditionally
either way.
- Updated fork test coverage in `subagent.test.ts` for the new type.

---------

Co-authored-by: Hunter Lovell <hunter@hntrl.io>
T
Thushanth Bengre committed
b20d6adc3dc7caf01281832548a17f381561318c
Parent: d4045de
Committed by GitHub <noreply@github.com> on 8/20/2026, 2:56:11 AM