Open History to see the last commit
1---
2id: SubagentBudget
3title: SubagentBudget
4---
5
6Defined in: [packages/ai/src/activities/chat/agents/limits.ts:17](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L17)
7
8The shared budget of one subagent tree.
9
10## Properties
11
12### deadline
13
14```ts
15readonly deadline: number | undefined;
16```
17
18Defined in: [packages/ai/src/activities/chat/agents/limits.ts:24](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L24)
19
20Epoch ms after which this run's children must stop, if any.
21
22***
23
24### depth
25
26```ts
27readonly depth: number;
28```
29
30Defined in: [packages/ai/src/activities/chat/agents/limits.ts:21](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L21)
31
32The depth of the run that owns this budget view.
33
34***
35
36### limits
37
38```ts
39readonly limits: SubagentLimits;
40```
41
42Defined in: [packages/ai/src/activities/chat/agents/limits.ts:19](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L19)
43
44## Accessors
45
46### calls
47
48#### Get Signature
49
50```ts
51get calls(): number;
52```
53
54Defined in: [packages/ai/src/activities/chat/agents/limits.ts:33](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L33)
55
56How many children the tree started so far.
57
58##### Returns
59
60`number`
61
62## Methods
63
64### child()
65
66```ts
67child(deadline?): SubagentBudget;
68```
69
70Defined in: [packages/ai/src/activities/chat/agents/limits.ts:72](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L72)
71
72The budget a child's own subagents use: one level deeper, same counters.
73
74#### Parameters
75
76##### deadline?
77
78`number`
79
80#### Returns
81
82`SubagentBudget`
83
84***
85
86### childTimeout()
87
88```ts
89childTimeout(now?): number | undefined;
90```
91
92Defined in: [packages/ai/src/activities/chat/agents/limits.ts:63](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L63)
93
94Milliseconds a child started now may run, or `undefined` for no limit.
95
96#### Parameters
97
98##### now?
99
100`number` = `...`
101
102#### Returns
103
104`number` \| `undefined`
105
106***
107
108### release()
109
110```ts
111release(): void;
112```
113
114Defined in: [packages/ai/src/activities/chat/agents/limits.ts:58](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L58)
115
116Undo one `reserve`. A background start that throws never began.
117
118#### Returns
119
120`void`
121
122***
123
124### reserve()
125
126```ts
127reserve(active): string | undefined;
128```
129
130Defined in: [packages/ai/src/activities/chat/agents/limits.ts:42](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L42)
131
132Reserve one child spawn. Returns the refusal message the model sees, or
133`undefined` when the child may start. `active` is how many children this
134run has running now.
135
136#### Parameters
137
138##### active
139
140`number`
141
142#### Returns
143
144`string` \| `undefined`
145
146***
147
148### root()
149
150```ts
151static root(limits?): SubagentBudget;
152```
153
154Defined in: [packages/ai/src/activities/chat/agents/limits.ts:28](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/agents/limits.ts#L28)
155
156A budget for a root run.
157
158#### Parameters
159
160##### limits?
161
162[`SubagentLimits`](../interfaces/SubagentLimits.md) = `{}`
163
164#### Returns
165
166`SubagentBudget`