77from typing import Any , AsyncIterator , Callable , Iterator , List , Optional , Tuple , Union
88
99from llama_stack_client import LlamaStackClient
10- from llama_stack_client .types import ToolResponseMessage , ToolResponseParam , UserMessage
11- from llama_stack_client .types .agent_create_params import AgentConfig
12- from llama_stack_client .types .agents .agent_turn_response_stream_chunk import (
10+ from llama_stack_client .types import ToolResponseMessage , UserMessage
11+ from llama_stack_client .types .alpha import ToolResponseParam
12+ from llama_stack_client .types .alpha .agent_create_params import AgentConfig
13+ from llama_stack_client .types .alpha .agents .agent_turn_response_stream_chunk import (
1314 AgentTurnResponseStreamChunk ,
1415)
15- from llama_stack_client .types .agents .turn import CompletionMessage , Turn
16- from llama_stack_client .types .agents .turn_create_params import Document , Toolgroup
16+ from llama_stack_client .types .alpha . agents .turn import CompletionMessage , Turn
17+ from llama_stack_client .types .alpha . agents .turn_create_params import Document , Toolgroup
1718from llama_stack_client .types .shared .tool_call import ToolCall
1819from llama_stack_client .types .shared_params .agent_config import ToolConfig
1920from llama_stack_client .types .shared_params .response_format import ResponseFormat
@@ -203,7 +204,7 @@ def __init__(
203204 self .initialize ()
204205
205206 def initialize (self ) -> None :
206- agentic_system_create_response = self .client .agents .create (
207+ agentic_system_create_response = self .client .alpha . agents .create (
207208 agent_config = self .agent_config ,
208209 extra_headers = self .extra_headers ,
209210 )
@@ -214,7 +215,7 @@ def initialize(self) -> None:
214215 self .builtin_tools [tool .identifier ] = tg .get ("args" , {}) if isinstance (tg , dict ) else {}
215216
216217 def create_session (self , session_name : str ) -> str :
217- agentic_system_create_session_response = self .client .agents .session .create (
218+ agentic_system_create_session_response = self .client .alpha . agents .session .create (
218219 agent_id = self .agent_id ,
219220 session_name = session_name ,
220221 extra_headers = self .extra_headers ,
@@ -322,7 +323,7 @@ def _create_turn_streaming(
322323 n_iter = 0
323324
324325 # 1. create an agent turn
325- turn_response = self .client .agents .turn .create (
326+ turn_response = self .client .alpha . agents .turn .create (
326327 agent_id = self .agent_id ,
327328 # use specified session_id or last session created
328329 session_id = session_id or self .session_id [- 1 ],
@@ -361,7 +362,7 @@ def _create_turn_streaming(
361362 tool_responses = self ._run_tool_calls (tool_calls )
362363
363364 # pass it to next iteration
364- turn_response = self .client .agents .turn .resume (
365+ turn_response = self .client .alpha . agents .turn .resume (
365366 agent_id = self .agent_id ,
366367 session_id = session_id or self .session_id [- 1 ],
367368 turn_id = turn_id ,
@@ -468,7 +469,7 @@ async def initialize(self) -> None:
468469 if self ._agent_id :
469470 return
470471
471- agentic_system_create_response = await self .client .agents .create (
472+ agentic_system_create_response = await self .client .alpha . agents .create (
472473 agent_config = self .agent_config ,
473474 )
474475 self ._agent_id = agentic_system_create_response .agent_id
@@ -478,7 +479,7 @@ async def initialize(self) -> None:
478479
479480 async def create_session (self , session_name : str ) -> str :
480481 await self .initialize ()
481- agentic_system_create_session_response = await self .client .agents .session .create (
482+ agentic_system_create_session_response = await self .client .alpha . agents .session .create (
482483 agent_id = self .agent_id ,
483484 session_name = session_name ,
484485 extra_headers = self .extra_headers ,
@@ -558,7 +559,7 @@ async def _create_turn_streaming(
558559 n_iter = 0
559560
560561 # 1. create an agent turn
561- turn_response = await self .client .agents .turn .create (
562+ turn_response = await self .client .alpha . agents .turn .create (
562563 agent_id = self .agent_id ,
563564 # use specified session_id or last session created
564565 session_id = session_id or self .session_id [- 1 ],
@@ -596,7 +597,7 @@ async def _create_turn_streaming(
596597 tool_responses = await self ._run_tool_calls (tool_calls )
597598
598599 # pass it to next iteration
599- turn_response = await self .client .agents .turn .resume (
600+ turn_response = await self .client .alpha . agents .turn .resume (
600601 agent_id = self .agent_id ,
601602 session_id = session_id or self .session_id [- 1 ],
602603 turn_id = turn_id ,
0 commit comments