99from ...models .agent_response import AgentResponse
1010from ...models .error_response import ErrorResponse
1111from ...models .http_validation_error import HTTPValidationError
12- from ...types import Response
12+ from ...models .response_mode import ResponseMode
13+ from ...types import UNSET , Response , Unset
1314
1415
1516def _get_kwargs (
1617 graph_id : str ,
1718 * ,
1819 body : AgentRequest ,
20+ mode : Union [None , ResponseMode , Unset ] = UNSET ,
1921) -> dict [str , Any ]:
2022 headers : dict [str , Any ] = {}
2123
24+ params : dict [str , Any ] = {}
25+
26+ json_mode : Union [None , Unset , str ]
27+ if isinstance (mode , Unset ):
28+ json_mode = UNSET
29+ elif isinstance (mode , ResponseMode ):
30+ json_mode = mode .value
31+ else :
32+ json_mode = mode
33+ params ["mode" ] = json_mode
34+
35+ params = {k : v for k , v in params .items () if v is not UNSET and v is not None }
36+
2237 _kwargs : dict [str , Any ] = {
2338 "method" : "post" ,
2439 "url" : f"/v1/graphs/{ graph_id } /agent" ,
40+ "params" : params ,
2541 }
2642
2743 _kwargs ["json" ] = body .to_dict ()
@@ -40,6 +56,10 @@ def _parse_response(
4056
4157 return response_200
4258
59+ if response .status_code == 202 :
60+ response_202 = cast (Any , None )
61+ return response_202
62+
4363 if response .status_code == 400 :
4464 response_400 = cast (Any , None )
4565 return response_400
@@ -84,10 +104,11 @@ def sync_detailed(
84104 * ,
85105 client : AuthenticatedClient ,
86106 body : AgentRequest ,
107+ mode : Union [None , ResponseMode , Unset ] = UNSET ,
87108) -> Response [Union [AgentResponse , Any , ErrorResponse , HTTPValidationError ]]:
88109 r"""Auto-select agent for query
89110
90- Automatically select the best agent for your query.
111+ Automatically select the best agent for your query with intelligent execution strategy .
91112
92113 **Agent Selection Process:**
93114
@@ -96,7 +117,8 @@ def sync_detailed(
96117 2. Enriching context with RAG if enabled
97118 3. Evaluating all available agents against selection criteria
98119 4. Selecting the best match based on confidence scores
99- 5. Executing the query with the selected agent
120+ 5. Choosing execution strategy (sync/SSE/async) based on expected time
121+ 6. Executing the query with the selected agent
100122
101123 **Available Agent Types:**
102124 - `financial`: Financial analysis, SEC filings, company metrics
@@ -109,6 +131,14 @@ def sync_detailed(
109131 - `extended`: Comprehensive analysis (~15-60s), deep research
110132 - `streaming`: Real-time response streaming
111133
134+ **Execution Strategies (automatic):**
135+ - Fast operations (<5s): Immediate synchronous response
136+ - Medium operations (5-30s): SSE streaming with progress updates
137+ - Long operations (>30s): Async Celery worker with operation tracking
138+
139+ **Response Mode Override:**
140+ Use query parameter `?mode=sync|async` to override automatic strategy selection.
141+
112142 **Confidence Score Interpretation:**
113143 - `0.9-1.0`: High confidence, agent is ideal match
114144 - `0.7-0.9`: Good confidence, agent is suitable
@@ -132,6 +162,8 @@ def sync_detailed(
132162
133163 Args:
134164 graph_id (str):
165+ mode (Union[None, ResponseMode, Unset]): Override execution mode: sync, async, stream, or
166+ auto
135167 body (AgentRequest): Request model for agent interactions.
136168
137169 Raises:
@@ -145,6 +177,7 @@ def sync_detailed(
145177 kwargs = _get_kwargs (
146178 graph_id = graph_id ,
147179 body = body ,
180+ mode = mode ,
148181 )
149182
150183 response = client .get_httpx_client ().request (
@@ -159,10 +192,11 @@ def sync(
159192 * ,
160193 client : AuthenticatedClient ,
161194 body : AgentRequest ,
195+ mode : Union [None , ResponseMode , Unset ] = UNSET ,
162196) -> Optional [Union [AgentResponse , Any , ErrorResponse , HTTPValidationError ]]:
163197 r"""Auto-select agent for query
164198
165- Automatically select the best agent for your query.
199+ Automatically select the best agent for your query with intelligent execution strategy .
166200
167201 **Agent Selection Process:**
168202
@@ -171,7 +205,8 @@ def sync(
171205 2. Enriching context with RAG if enabled
172206 3. Evaluating all available agents against selection criteria
173207 4. Selecting the best match based on confidence scores
174- 5. Executing the query with the selected agent
208+ 5. Choosing execution strategy (sync/SSE/async) based on expected time
209+ 6. Executing the query with the selected agent
175210
176211 **Available Agent Types:**
177212 - `financial`: Financial analysis, SEC filings, company metrics
@@ -184,6 +219,14 @@ def sync(
184219 - `extended`: Comprehensive analysis (~15-60s), deep research
185220 - `streaming`: Real-time response streaming
186221
222+ **Execution Strategies (automatic):**
223+ - Fast operations (<5s): Immediate synchronous response
224+ - Medium operations (5-30s): SSE streaming with progress updates
225+ - Long operations (>30s): Async Celery worker with operation tracking
226+
227+ **Response Mode Override:**
228+ Use query parameter `?mode=sync|async` to override automatic strategy selection.
229+
187230 **Confidence Score Interpretation:**
188231 - `0.9-1.0`: High confidence, agent is ideal match
189232 - `0.7-0.9`: Good confidence, agent is suitable
@@ -207,6 +250,8 @@ def sync(
207250
208251 Args:
209252 graph_id (str):
253+ mode (Union[None, ResponseMode, Unset]): Override execution mode: sync, async, stream, or
254+ auto
210255 body (AgentRequest): Request model for agent interactions.
211256
212257 Raises:
@@ -221,6 +266,7 @@ def sync(
221266 graph_id = graph_id ,
222267 client = client ,
223268 body = body ,
269+ mode = mode ,
224270 ).parsed
225271
226272
@@ -229,10 +275,11 @@ async def asyncio_detailed(
229275 * ,
230276 client : AuthenticatedClient ,
231277 body : AgentRequest ,
278+ mode : Union [None , ResponseMode , Unset ] = UNSET ,
232279) -> Response [Union [AgentResponse , Any , ErrorResponse , HTTPValidationError ]]:
233280 r"""Auto-select agent for query
234281
235- Automatically select the best agent for your query.
282+ Automatically select the best agent for your query with intelligent execution strategy .
236283
237284 **Agent Selection Process:**
238285
@@ -241,7 +288,8 @@ async def asyncio_detailed(
241288 2. Enriching context with RAG if enabled
242289 3. Evaluating all available agents against selection criteria
243290 4. Selecting the best match based on confidence scores
244- 5. Executing the query with the selected agent
291+ 5. Choosing execution strategy (sync/SSE/async) based on expected time
292+ 6. Executing the query with the selected agent
245293
246294 **Available Agent Types:**
247295 - `financial`: Financial analysis, SEC filings, company metrics
@@ -254,6 +302,14 @@ async def asyncio_detailed(
254302 - `extended`: Comprehensive analysis (~15-60s), deep research
255303 - `streaming`: Real-time response streaming
256304
305+ **Execution Strategies (automatic):**
306+ - Fast operations (<5s): Immediate synchronous response
307+ - Medium operations (5-30s): SSE streaming with progress updates
308+ - Long operations (>30s): Async Celery worker with operation tracking
309+
310+ **Response Mode Override:**
311+ Use query parameter `?mode=sync|async` to override automatic strategy selection.
312+
257313 **Confidence Score Interpretation:**
258314 - `0.9-1.0`: High confidence, agent is ideal match
259315 - `0.7-0.9`: Good confidence, agent is suitable
@@ -277,6 +333,8 @@ async def asyncio_detailed(
277333
278334 Args:
279335 graph_id (str):
336+ mode (Union[None, ResponseMode, Unset]): Override execution mode: sync, async, stream, or
337+ auto
280338 body (AgentRequest): Request model for agent interactions.
281339
282340 Raises:
@@ -290,6 +348,7 @@ async def asyncio_detailed(
290348 kwargs = _get_kwargs (
291349 graph_id = graph_id ,
292350 body = body ,
351+ mode = mode ,
293352 )
294353
295354 response = await client .get_async_httpx_client ().request (** kwargs )
@@ -302,10 +361,11 @@ async def asyncio(
302361 * ,
303362 client : AuthenticatedClient ,
304363 body : AgentRequest ,
364+ mode : Union [None , ResponseMode , Unset ] = UNSET ,
305365) -> Optional [Union [AgentResponse , Any , ErrorResponse , HTTPValidationError ]]:
306366 r"""Auto-select agent for query
307367
308- Automatically select the best agent for your query.
368+ Automatically select the best agent for your query with intelligent execution strategy .
309369
310370 **Agent Selection Process:**
311371
@@ -314,7 +374,8 @@ async def asyncio(
314374 2. Enriching context with RAG if enabled
315375 3. Evaluating all available agents against selection criteria
316376 4. Selecting the best match based on confidence scores
317- 5. Executing the query with the selected agent
377+ 5. Choosing execution strategy (sync/SSE/async) based on expected time
378+ 6. Executing the query with the selected agent
318379
319380 **Available Agent Types:**
320381 - `financial`: Financial analysis, SEC filings, company metrics
@@ -327,6 +388,14 @@ async def asyncio(
327388 - `extended`: Comprehensive analysis (~15-60s), deep research
328389 - `streaming`: Real-time response streaming
329390
391+ **Execution Strategies (automatic):**
392+ - Fast operations (<5s): Immediate synchronous response
393+ - Medium operations (5-30s): SSE streaming with progress updates
394+ - Long operations (>30s): Async Celery worker with operation tracking
395+
396+ **Response Mode Override:**
397+ Use query parameter `?mode=sync|async` to override automatic strategy selection.
398+
330399 **Confidence Score Interpretation:**
331400 - `0.9-1.0`: High confidence, agent is ideal match
332401 - `0.7-0.9`: Good confidence, agent is suitable
@@ -350,6 +419,8 @@ async def asyncio(
350419
351420 Args:
352421 graph_id (str):
422+ mode (Union[None, ResponseMode, Unset]): Override execution mode: sync, async, stream, or
423+ auto
353424 body (AgentRequest): Request model for agent interactions.
354425
355426 Raises:
@@ -365,5 +436,6 @@ async def asyncio(
365436 graph_id = graph_id ,
366437 client = client ,
367438 body = body ,
439+ mode = mode ,
368440 )
369441 ).parsed
0 commit comments