Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
50998de
feat(core): add typed application state to the session contract
blove Nov 18, 2026
bf1780d
feat(ag-ui): type the session's state and publish it in the core view
blove Nov 18, 2026
3894f08
feat(ag-ui): make the session a core AgentSession
blove Nov 18, 2026
016a123
test(ag-ui): expect core fields on the session snapshot in the packag…
blove Nov 18, 2026
72675d9
feat(core): add interrupts, resume and child agents to the session co…
blove Nov 19, 2026
d666233
feat(langgraph): answer interrupts by id through the core resume command
blove Nov 19, 2026
50984f8
test(native-conversation): send the unmatched-id diagnostic through t…
blove Nov 19, 2026
9812d7c
Merge remote-tracking branch 'origin/main' into blove/ag-ui-typed-ses…
blove Nov 19, 2026
84473df
Merge remote-tracking branch 'origin/main' into HEAD
blove Nov 19, 2026
f43223d
Merge remote-tracking branch 'origin/main' into blove/core-interrupts…
blove Nov 19, 2026
a73307f
Merge remote-tracking branch 'origin/main' into blove/core-interrupts…
blove Nov 19, 2026
a9376fc
Merge remote-tracking branch 'origin/main' into blove/core-interrupts…
blove Nov 19, 2026
ca50ac4
Merge the final head of #1658 into blove/ag-ui-session-is-agent-session
blove Nov 19, 2026
1e81b58
Merge the squash of #1658 into blove/ag-ui-session-is-agent-session (…
blove Nov 19, 2026
2d3100d
Merge remote-tracking branch 'origin/main' into blove/ag-ui-session-i…
blove Nov 19, 2026
ef1042c
Merge branch 'blove/core-interrupts-subagents' into blove/ag-ui-core-…
blove Nov 19, 2026
6815ffd
Merge remote-tracking branch 'origin/main' into HEAD
blove Nov 19, 2026
d31ac51
docs(ag-ui): the candidate emits the core session, not a view
blove Nov 19, 2026
1b4a8f8
feat(ag-ui): answer interrupts through the core resume command and pu…
blove Nov 19, 2026
f015faf
Merge the final head of #1659 into blove/ag-ui-core-resume
blove Nov 19, 2026
251be93
Merge the squash of #1659 into blove/ag-ui-core-resume (already merge…
blove Nov 19, 2026
51833c0
Merge remote-tracking branch 'origin/main' into blove/ag-ui-core-resume
blove Nov 19, 2026
24df2a7
feat(langgraph): publish child graphs as core child agents
blove Nov 19, 2026
0b3b702
test(parity): list the AG-UI child projection in the reviewed candida…
blove Nov 19, 2026
6409626
feat(ag-ui): keep earlier child agents, continue a paused child, and …
blove Nov 19, 2026
1387761
Merge branch 'blove/langgraph-core-subagents' into blove/react-chat-s…
blove Nov 19, 2026
fa88cb8
feat(react): show the session's child agents as subagent cards in Chat
blove Nov 19, 2026
fb5fb6c
feat(react): answer session interrupts from Chat with renderInterrupt
blove Nov 19, 2026
eb7dec8
test(cockpit): answer the Strands fixture's pauses through the core r…
blove Nov 20, 2026
0952bcf
Merge branch 'blove/ag-ui-core-resume' into blove/langgraph-core-suba…
blove Nov 20, 2026
47b6bb8
test(parity): count the child-agent projection and check child tool c…
blove Nov 20, 2026
4ea4717
Merge branch 'blove/langgraph-core-subagents' into blove/react-chat-s…
blove Nov 20, 2026
6e556cf
test(parity): list sessionSubagents among the supported React chat ex…
blove Nov 20, 2026
6cf21cf
Merge branch 'blove/react-chat-session-subagents' into blove/react-ch…
blove Nov 20, 2026
a912975
Merge the squash of #1677 into blove/langgraph-core-subagents (alread…
blove Nov 20, 2026
670c133
Keep the canonical demo bundle budget from main (#1679)
blove Nov 20, 2026
eff8566
Merge branch 'blove/langgraph-core-subagents' into blove/react-chat-s…
blove Nov 20, 2026
76e0b1d
Merge branch 'blove/react-chat-session-subagents' into blove/react-ch…
blove Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,41 @@ The shared backend runs c-interrupts by default. Runtime settings can select a d

Moving between Code and Run preserves the mounted example and unsent draft. Reloading starts an empty page-local conversation.

## Answer session interrupts from Chat

A session that can pause lists what it waits on in `snapshot.interrupts`. `Chat` shows nothing for an interrupt by itself, because which value answers an interrupt is the backend's contract. Pass `renderInterrupt` to draw each one, and call `respond.resolve(value)` or `respond.cancel()` from your card:

```tsx
import { ApprovalCard, Chat } from '@threadplane/react/chat';

<Chat
session={session}
renderInterrupt={(interrupt, respond) => (
<ApprovalCard
disabled={respond.sending || respond.answered}
actions={[
{
id: 'approve',
label: 'Approve',
onSelect: () => respond.resolve({ approved: true }),
},
{
id: 'decline',
label: 'Decline',
onSelect: () => respond.resolve({ approved: false }),
},
]}
>
{interrupt.message ?? interrupt.reason}
</ApprovalCard>
)}
/>;
```

The cards take the place of the `approval` slot, so the composer reads "Answer the approval to continue" while they are pending and focus returns to it afterwards. `Chat` holds each answer until every pending interrupt has one, then sends them together with one `session.resume`, because a paused run continues once. `respond.answered` is true for an interrupt whose answer waits on the others, and `respond.sending` is true while the answers are on their way.

If `session.resume` rejects, the answers are dropped so the person can answer again, and the failure goes to `onInterruptError`. `renderInterrupt` is ignored while `approval` is set and on a session that has no `resume`.

## Build from source

From a Threadplane checkout with dependencies installed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ The existing shared backend runs c-subagents. Runtime settings can select a deve

`SubagentCard` shows one child agent: its name, a status, a message count, and the child's messages and tool activity behind a closed disclosure. It only presents the data you pass it. Your application still owns the run, the session and any saved history.

Pass `subagents` to `MessageList` or `Chat` to place cards for you. A child whose `toolCallId` matches a tool call in a row renders as a card in place of that call's activity. A child with no matching call is not placed; render `SubagentCard` yourself where it belongs.
`Chat` shows a card for each child agent its session reports in `snapshot.subagents`, with no code from you. A child that names the tool call that started it takes that call's place. A child that names no call, such as a LangGraph child graph, follows the tool calls of the first assistant message of the latest turn, so its card keeps its place as the turn goes on. `toolLabel` and `toolOutcome` apply to the children's own tool calls.

Pass `subagents` to `Chat` to show your own list instead; an empty list shows no cards. Pass `subagents` to `MessageList` to place cards for you there. A child whose `toolCallId` matches a tool call in a row renders as a card in place of that call's activity. A child with no matching call is not placed unless you set `placeUnanchoredSubagents`; otherwise render `SubagentCard` yourself where it belongs.

`sessionSubagents(snapshot.subagents)` returns the same card data `Chat` builds, for an application that renders `MessageList` itself. It keeps each card's reference while its child is unchanged.

```tsx
import { MessageList, subagentsFromEvidence } from '@threadplane/react/chat';
Expand Down
8 changes: 5 additions & 3 deletions cockpit/ag-ui/subagents/react/src/children.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ export function observeChildren(
const cards = new Map(previous.map((card) => [card.id, card]));
let unsupported = false;
try {
// Cards follow the current run; children of earlier runs are history.
const children = snapshot.subagents.filter((child) => !child.earlier);
if (
cards.size !== previous.length ||
previous.length > 100 ||
snapshot.subagents.length > 30
children.length > 30
)
throw new Error();
const attributed = new Set(
snapshot.subagents.map((child) => child.started.subagentRunId)
children.map((child) => child.started.subagentRunId)
);
if (
snapshot.transcript.some(
Expand All @@ -68,7 +70,7 @@ export function observeChildren(
)
throw new Error();
const seen = new Set<string>();
for (const child of snapshot.subagents) {
for (const child of children) {
const started = child.started;
const id = started.subagentRunId,
callId = started.parentToolCallId;
Expand Down
2 changes: 1 addition & 1 deletion cockpit/ag-ui/subagents/react/src/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function confirmParent(
if (!valid()) return;
const run = snapshot.run,
transcript = snapshot.transcript,
children = snapshot.subagents;
children = snapshot.subagents.filter((child) => !child.earlier);
if (
!valid() ||
snapshot.status !== 'idle' ||
Expand Down
27 changes: 17 additions & 10 deletions libs/ag-ui/src/runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,23 @@ const session = createSession({ threadId, url });
is sent. Each entry is the protocol's interrupt, so it has the core `id`,
`reason`, `message` and `toolCallId` and any other field the backend sent. It
is absent when nothing is waiting, and for a pause this session cannot answer.
- `subagents` lists the current run's children as core child agents: `id`,
`name`, `description`, `toolCallId`, `parentId`, `status`, and the child's own
`messages` and `toolCalls`, which the root lists do not repeat. The protocol
evidence stays on each child as `started` and `terminal`. A child with
finished evidence is `complete`, one with error evidence is `error` and
carries its message, and one with neither is `running` while the root run is
going and `unknown` after it. A child keeps its reference until its evidence,
status or records change. Children of earlier runs are bare evidence in
`earlierSubagents`. Records are matched by run id, so a later child that
reuses an id also lists the earlier child's records.
- `subagents` lists every child the session knows as a core child agent:
children of earlier root runs first, marked `earlier`, then the current run's,
each in start order. A child has `id`, `name`, `description`, `toolCallId`,
`parentId`, `status`, and its own `messages` and `toolCalls`, which the root
lists do not repeat. The protocol evidence stays on each child as `started`
and `terminal`. `earlierSubagents` still holds the earlier children's bare
evidence.
- Error evidence is `error` and carries its message. Finished evidence is
`complete`, unless the child finished `suspended`: it paused and can
continue, so it is `running` in its own run and while a later run is going,
and `unknown` once a later run ends without continuing it. A child with no
ending is `running` while the root run is going and `unknown` after it.
- A child lists the records attributed to its run id within its own run. A
child that starts again after pausing continues: it is one child, and keeps
the records from before the pause. Any other child that reuses a run id
replaces the earlier one and starts with none of its records.
- A child keeps its reference until its evidence, status or records change.
- Every publication notifies subscribers, including one that changes only
protocol evidence such as a decision or a child.
- `submit` takes text, or `{ message, state? }` with a state patch.
Expand Down
7 changes: 4 additions & 3 deletions libs/ag-ui/src/runtime/agent-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ export type SessionSnapshot<TState = unknown> = Omit<
*/
readonly interrupts?: readonly SessionInterrupt[];
/**
* The current root run's children, each with its own messages and tool
* calls and the protocol evidence it was read from. Children of earlier
* runs are in `earlierSubagents`.
* Every child agent the session knows, each with its own messages and
* tool calls and the protocol evidence it was read from: children of
* earlier root runs first, marked `earlier`, then the current run's.
* `earlierSubagents` still holds the earlier children's bare evidence.
*/
readonly subagents: readonly SessionSubagent[];
/**
Expand Down
96 changes: 96 additions & 0 deletions libs/ag-ui/src/runtime/child-projection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,102 @@ describe('core interrupts and child agents on the AG-UI snapshot', () => {
}
});

it('keeps a paused child running and continues it with its records after resume', async () => {
const fixture = bindingFixture();
try {
const run = fixture.session.submit('Book it');
const exchange = await fixture.started();
const paused = fixture.changed(
(snapshot) => snapshot.subagents[0]?.terminal !== undefined
);
exchange.emit({
type: 'SUBAGENT_STARTED',
subagentRunId: 'child',
name: 'booker',
});
exchange.emit({
type: 'TEXT_MESSAGE_START',
messageId: 'before',
role: 'assistant',
subagentRunId: 'child',
});
exchange.emit({
type: 'TEXT_MESSAGE_CONTENT',
messageId: 'before',
delta: 'Need approval',
});
exchange.emit({ type: 'TEXT_MESSAGE_END', messageId: 'before' });
exchange.emit({
type: 'SUBAGENT_FINISHED',
subagentRunId: 'child',
outcome: { type: 'suspended', interruptIds: ['approval'] },
});
await paused;
exchange.emit({
type: 'RUN_FINISHED',
threadId: exchange.body.threadId,
runId: exchange.body.runId,
outcome: {
type: 'interrupt',
interrupts: [{ id: 'approval', reason: 'approve' }],
},
});
await expect(run).resolves.toBe('paused');
// Paused is not finished: the child can continue.
expect(fixture.session.getSnapshot().subagents[0].status).toBe('running');

const resumed = fixture.session.resume([
{ interruptId: 'approval', status: 'resolved' },
]);
const next = await fixture.started(1);
// Between the answer and the child's restart it is history, still going.
expect(fixture.session.getSnapshot().subagents).toMatchObject([
{ id: 'child', status: 'running', earlier: true },
]);
const continued = fixture.changed(
(snapshot) =>
snapshot.subagents.length === 1 &&
snapshot.subagents[0].messages.length === 2
);
next.emit({
type: 'SUBAGENT_STARTED',
subagentRunId: 'child',
name: 'booker',
});
next.emit({
type: 'TEXT_MESSAGE_START',
messageId: 'after',
role: 'assistant',
subagentRunId: 'child',
});
next.emit({
type: 'TEXT_MESSAGE_CONTENT',
messageId: 'after',
delta: 'Booked',
});
next.emit({ type: 'TEXT_MESSAGE_END', messageId: 'after' });
// One child, not two, and it keeps what it said before the pause.
const child = (await continued).subagents[0];
expect(child).not.toHaveProperty('earlier');
expect(child.messages.map((message) => message.content)).toEqual([
'Need approval',
'Booked',
]);
next.emit({ type: 'SUBAGENT_FINISHED', subagentRunId: 'child' });
next.emit({
type: 'RUN_FINISHED',
threadId: next.body.threadId,
runId: next.body.runId,
});
await expect(resumed).resolves.toBe('success');
expect(fixture.session.getSnapshot().subagents[0].status).toBe(
'complete'
);
} finally {
await fixture.cleanup();
}
});

it('lists pending interrupts until an answer is sent, and answers them by id', async () => {
const fixture = bindingFixture();
try {
Expand Down
Loading
Loading