Open History to see the last commit
1---
2id: SubagentBinding
3title: SubagentBinding
4---
5
6Defined in: packages/ai/src/activities/chat/agents/bound.ts:108
7
8What a host adds to every activity call an agent makes through `ctx`. Apps
9using plain `chat({ subagents })` do not set it.
10
11## Properties
12
13### budget?
14
15```ts
16optional budget?: SubagentBudget;
17```
18
19Defined in: packages/ai/src/activities/chat/agents/bound.ts:123
20
21The subagent tree budget. A child's `ctx.chat({ subagents })` passes it
22down, so limits hold across the whole tree.
23
24***
25
26### chatMiddleware?
27
28```ts
29optional chatMiddleware?: readonly AnyChatMiddleware[];
30```
31
32Defined in: packages/ai/src/activities/chat/agents/bound.ts:113
33
34Added before the call's own middleware on every `ctx.chat` call. A
35child's `ctx.chat({ subagents })` passes it down to its own children.
36
37***
38
39### generationMiddleware?
40
41```ts
42optional generationMiddleware?: readonly GenerationMiddleware<unknown>[];
43```
44
45Defined in: packages/ai/src/activities/chat/agents/bound.ts:118
46
47Added before the call's own middleware on every generation call. A
48child's `ctx.chat({ subagents })` passes it down to its own children.
49
50***
51
52### keys?
53
54```ts
55optional keys?: ProviderKeys;
56```
57
58Defined in: packages/ai/src/activities/chat/agents/bound.ts:129
59
60The provider keys an agent reads as `ctx.keys`. `subagents.keys` sets
61them. A child's `ctx.chat({ subagents })` passes them down to its own
62children. Without them, `ctx.keys` reads each provider's `env` names.
63
64***
65
66### promptCache?
67
68```ts
69optional promptCache?: PromptCacheRetention;
70```
71
72Defined in: packages/ai/src/activities/chat/agents/bound.ts:134
73
74The prompt cache retention of the parent call. A child's `ctx.chat()`
75uses it when the call gives no `promptCache`.
76
77***
78
79### start?
80
81```ts
82optional start?: (call, options) => Promise<{
83 done: Promise<unknown>;
84 subagentRunId: string;
85}>;
86```
87
88Defined in: packages/ai/src/activities/chat/agents/bound.ts:141
89
90Starts a child without waiting for it and returns its id at once. The
91agent tools call it for `background: true`. With
92`wake: true`, the host starts a new parent turn when the child ends. It
93does not pass down to nested children.
94
95#### Parameters
96
97##### call
98
99###### agent
100
101`string`
102
103###### input?
104
105`unknown`
106
107###### parentToolCallId?
108
109`string`
110
111###### prompt?
112
113`string`
114
115##### options
116
117###### wake
118
119`true`
120
121#### Returns
122
123`Promise`\<\{
124 `done`: `Promise`\<`unknown`\>;
125 `subagentRunId`: `string`;
126\}\>