Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ That's it. `chat.messages()` is an Angular Signal. Bind it directly in your temp
| Tool call progress | `toolProgress()` | `toolProgress` |
| Tool calls with results | `toolCalls()` | `toolCalls` |
| Branch / history | `branch()` / `history()` | `branch` / `history` |
| Pending run queue | `queue()` | `queue` |
| Subagent streaming | `subagents()` / `activeSubagents()` | `subagents` / `activeSubagents` |
| Reactive thread switching | `Signal<string \| null>` input | prop |
| Submit | `submit(values, opts?)` | `submit(values, opts?)` |
Expand All @@ -116,7 +117,7 @@ That's it. `chat.messages()` is an Angular Signal. Bind it directly in your temp
/>
</p>

`agent()` creates 12 `BehaviorSubject`s at injection-context time — once, at component construction. The `StreamManager` bridge (the only file that touches `@langchain/langgraph-sdk` internals) pushes stream events into those subjects. `toSignal()` converts each subject to an Angular Signal, also at construction time. Dynamic actions (`submit`, `stop`, `switchThread`) push into the existing subjects — no new subjects are ever created after construction. This architecture is required because `toSignal()` must be called in an injection context and cannot be called again later.
`agent()` creates its internal `BehaviorSubject`s at injection-context time — once, at component construction. The `StreamManager` bridge (the only file that touches `@langchain/langgraph-sdk` internals) pushes stream events into those subjects. `toSignal()` converts each subject to an Angular Signal, also at construction time. Dynamic actions (`submit`, `stop`, `switchThread`) push into the existing subjects — no new subjects are ever created after construction. This architecture is required because `toSignal()` must be called in an injection context and cannot be called again later.

---

Expand Down
287 changes: 285 additions & 2 deletions apps/website/content/docs/agent/api/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,62 @@
],
"properties": [],
"methods": [
{
"name": "cancelRun",
"signature": "cancelRun(threadId: string, runId: string, signal: AbortSignal)",
"description": "Cancel a server-side run.",
"params": [
{
"name": "threadId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "runId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "signal",
"type": "AbortSignal",
"description": "",
"optional": false
}
]
},
{
"name": "createQueuedRun",
"signature": "createQueuedRun(assistantId: string, threadId: string, payload: unknown, signal: AbortSignal)",
"description": "Create a pending server-side run using LangGraph's enqueue strategy.",
"params": [
{
"name": "assistantId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "threadId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "payload",
"type": "unknown",
"description": "",
"optional": false
},
{
"name": "signal",
"type": "AbortSignal",
"description": "",
"optional": false
}
]
},
{
"name": "joinStream",
"signature": "joinStream(threadId: string, runId: string, lastEventId: string | undefined, signal: AbortSignal)",
Expand Down Expand Up @@ -101,14 +157,89 @@
"examples": [
"```typescript\nconst transport = new MockAgentTransport([\n [{ type: 'values', data: { messages: [aiMsg('Hello')] } }],\n [{ type: 'values', data: { status: 'done' } }],\n]);\n```"
],
"properties": [],
"properties": [
{
"name": "cancelledRuns",
"type": "object[]",
"description": "",
"optional": false
},
{
"name": "createdQueuedRuns",
"type": "AgentQueueEntry<unknown>[]",
"description": "",
"optional": false
},
{
"name": "joinedRuns",
"type": "object[]",
"description": "",
"optional": false
}
],
"methods": [
{
"name": "cancelRun",
"signature": "cancelRun(threadId: string, runId: string, signal: AbortSignal)",
"description": "Optional: cancel a server-side run.",
"params": [
{
"name": "threadId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "runId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "signal",
"type": "AbortSignal",
"description": "",
"optional": false
}
]
},
{
"name": "close",
"signature": "close()",
"description": "Close the stream. Remaining queued events are drained before completion.",
"params": []
},
{
"name": "createQueuedRun",
"signature": "createQueuedRun(_assistantId: string, threadId: string, payload: unknown, signal: AbortSignal)",
"description": "Optional: create a server-side queued run without joining it immediately.",
"params": [
{
"name": "_assistantId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "threadId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "payload",
"type": "unknown",
"description": "",
"optional": false
},
{
"name": "signal",
"type": "AbortSignal",
"description": "",
"optional": false
}
]
},
{
"name": "emit",
"signature": "emit(events: StreamEvent[])",
Expand Down Expand Up @@ -141,6 +272,37 @@
"description": "Returns true if a stream is currently active.",
"params": []
},
{
"name": "joinStream",
"signature": "joinStream(threadId: string, runId: string, lastEventId: string | undefined, signal: AbortSignal)",
"description": "Optional: join an already-started run without creating a new one.",
"params": [
{
"name": "threadId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "runId",
"type": "string",
"description": "",
"optional": false
},
{
"name": "lastEventId",
"type": "string | undefined",
"description": "",
"optional": false
},
{
"name": "signal",
"type": "AbortSignal",
"description": "",
"optional": false
}
]
},
{
"name": "nextBatch",
"signature": "nextBatch()",
Expand Down Expand Up @@ -292,11 +454,93 @@
],
"examples": []
},
{
"name": "AgentQueue",
"kind": "interface",
"description": "Public queue surface for pending server-side LangGraph runs.",
"properties": [
{
"name": "cancel",
"type": "object",
"description": "Cancel a specific pending run by server run ID.",
"optional": false
},
{
"name": "clear",
"type": "object",
"description": "Cancel all pending runs and clear the queue.",
"optional": false
},
{
"name": "entries",
"type": "readonly AgentQueueEntry<T>[]",
"description": "Read-only pending queue entries.",
"optional": false
},
{
"name": "size",
"type": "number",
"description": "Number of pending queue entries.",
"optional": false
}
],
"examples": []
},
{
"name": "AgentQueueEntry",
"kind": "interface",
"description": "A queued server-side LangGraph run.",
"properties": [
{
"name": "createdAt",
"type": "Date",
"description": "Timestamp when the queued run was registered locally.",
"optional": false
},
{
"name": "id",
"type": "string",
"description": "Server-side run ID.",
"optional": false
},
{
"name": "options",
"type": "LangGraphSubmitOptions",
"description": "Submit options used when the queued run was created.",
"optional": true
},
{
"name": "threadId",
"type": "string",
"description": "Thread that owns the queued run.",
"optional": false
},
{
"name": "values",
"type": "T | null | undefined",
"description": "Values submitted for the queued run.",
"optional": false
}
],
"examples": []
},
{
"name": "AgentTransport",
"kind": "interface",
"description": "Transport interface for connecting to a LangGraph agent.",
"properties": [
{
"name": "cancelRun",
"type": "unknown",
"description": "",
"optional": true
},
{
"name": "createQueuedRun",
"type": "unknown",
"description": "",
"optional": true
},
{
"name": "joinStream",
"type": "unknown",
Expand Down Expand Up @@ -483,6 +727,12 @@
"description": "",
"optional": false
},
{
"name": "queue",
"type": "Signal<AgentQueue<unknown>>",
"description": "Pending server-side runs created via `multitaskStrategy: 'enqueue'`.",
"optional": false
},
{
"name": "reload",
"type": "object",
Expand Down Expand Up @@ -552,6 +802,26 @@
],
"examples": []
},
{
"name": "LangGraphSubmitOptions",
"kind": "interface",
"description": "Options accepted by LangGraph-backed submit calls.",
"properties": [
{
"name": "multitaskStrategy",
"type": "LangGraphMultitaskStrategy",
"description": "Strategy for handling concurrent runs on the same thread.",
"optional": true
},
{
"name": "signal",
"type": "AbortSignal",
"description": "",
"optional": true
}
],
"examples": []
},
{
"name": "MockLangGraphAgent",
"kind": "interface",
Expand Down Expand Up @@ -665,6 +935,12 @@
"description": "",
"optional": false
},
{
"name": "queue",
"type": "WritableSignal<AgentQueue<unknown>>",
"description": "Pending server-side runs created via `multitaskStrategy: 'enqueue'`.",
"optional": false
},
{
"name": "reload",
"type": "object",
Expand Down Expand Up @@ -759,7 +1035,7 @@
},
{
"name": "type",
"type": "\"error\" | \"values\" | `values|${string}` | \"messages\" | `messages|${string}` | `messages/${string}` | `messages/${string}|${string}` | \"updates\" | `updates|${string}` | \"tools\" | `tools|${string}` | \"custom\" | `custom|${string}` | `error|${string}` | \"metadata\" | \"checkpoints\" | `checkpoints|${string}` | \"tasks\" | `tasks|${string}` | \"debug\" | `debug|${string}` | \"events\" | `events|${string}` | \"interrupt\" | \"interrupts\"",
"type": "\"error\" | \"interrupt\" | \"values\" | `values|${string}` | \"messages\" | `messages|${string}` | `messages/${string}` | `messages/${string}|${string}` | \"updates\" | `updates|${string}` | \"tools\" | `tools|${string}` | \"custom\" | `custom|${string}` | `error|${string}` | \"metadata\" | \"checkpoints\" | `checkpoints|${string}` | \"tasks\" | `tasks|${string}` | \"debug\" | `debug|${string}` | \"events\" | `events|${string}` | \"interrupts\"",
"description": "Event type identifier (e.g., 'values', 'messages', 'error', 'interrupt').",
"optional": false
}
Expand Down Expand Up @@ -990,6 +1266,13 @@
"signature": "T extends { ~agentTypes: unknown } ? BagTemplate : B",
"examples": []
},
{
"name": "LangGraphMultitaskStrategy",
"kind": "type",
"description": "Strategy for handling concurrent LangGraph runs on the same thread.",
"signature": "\"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\"",
"examples": []
},
{
"name": "ResourceStatus",
"kind": "type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ agent.branch() // Signal<string> — time-travel branch

agent.toolCalls() // Signal<ToolCallWithResult[]> — tool results
agent.toolProgress() // Signal<ToolProgress[]> — active tool execution
agent.queue() // Signal<AgentQueue> — pending enqueue runs
agent.subagents() // Signal<Map<string, Subagent>> — delegated agents
agent.activeSubagents() // Signal<SubagentStreamRef[]> — running workers
```
Expand Down
Loading
Loading