Skip to content

Commit 3700441

Browse files
committed
Merge 'feat/epa_0414' into 'master'
feat: add agent tool event See merge request: !1145
2 parents 42a4dc9 + 1d866f6 commit 3700441

9 files changed

Lines changed: 125 additions & 0 deletions

File tree

volcenginesdkarkruntime/resources/responses/responses.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def create(
125125
extra_body: Body | None = None,
126126
timeout: float | httpx.Timeout | None | None = None,
127127
reasoning: Optional[Reasoning] | None = None,
128+
session: Optional[dict] | None = None,
128129
) -> Response | Stream[ResponseStreamEvent]:
129130
extra_headers = _add_beta_headers(extra_headers, tools)
130131
resp = self._post(
@@ -148,6 +149,7 @@ def create(
148149
"max_tool_calls": max_tool_calls,
149150
"expire_at": expire_at,
150151
"reasoning": reasoning,
152+
"session": session,
151153
},
152154
options=make_request_options(
153155
extra_headers=extra_headers,
@@ -248,6 +250,7 @@ async def create(
248250
extra_body: Body | None = None,
249251
timeout: float | httpx.Timeout | None | None = None,
250252
reasoning: Optional[Reasoning] | None = None,
253+
session: Optional[dict] | None = None,
251254
) -> Response | AsyncStream[ResponseStreamEvent]:
252255
extra_headers = _add_beta_headers(extra_headers, tools)
253256
await self._prepare_responses_input(input=input)
@@ -273,6 +276,7 @@ async def create(
273276
"max_tool_calls": max_tool_calls,
274277
"expire_at": expire_at,
275278
"reasoning": reasoning,
279+
"session": session,
276280
},
277281
options=make_request_options(
278282
extra_headers=extra_headers,

volcenginesdkarkruntime/types/responses/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from __future__ import annotations
1313

1414
from .tool import Tool as Tool
15+
from .session import Session as Session
16+
from .item_agent_tool_call import ItemAgentToolCall as ItemAgentToolCall
1517
from .response import Response as Response
1618
from .tool_param import ToolParam as ToolParam
1719
from .function_tool import FunctionTool as FunctionTool
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) [2025] [OpenAI]
2+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
6+
#
7+
# Original file was released under Apache License Version 2.0, with the full license text
8+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
9+
#
10+
# This modified file is released under the same license.
11+
12+
from __future__ import annotations
13+
14+
from typing import Optional
15+
16+
from typing_extensions import Literal
17+
18+
from ..._models import BaseModel
19+
20+
__all__ = ["ItemAgentToolCall"]
21+
22+
23+
class ItemAgentToolCall(BaseModel):
24+
id: Optional[str] = None
25+
26+
type: Literal["agent_tool_call"]
27+
28+
name: str
29+
30+
status: Literal["in_progress", "completed", "incomplete", "searching", "failed"]

volcenginesdkarkruntime/types/responses/response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from .response_output_item import ResponseOutputItem
2323
from .response_text_config import ResponseTextConfig
2424
from .response_usage import ResponseUsage
25+
from .session import Session
2526
from .tool import Tool
2627
from .tool_choice_function import ToolChoiceFunction
2728
from .tool_choice_knowledge_search import ToolChoiceKnowledgeSearch
@@ -116,3 +117,5 @@ class Response(BaseModel):
116117

117118
reasoning: Optional[Reasoning] = None
118119
"""Configuration options for reasoning models"""
120+
121+
session: Optional[Session] = None
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) [2025] [OpenAI]
2+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
6+
#
7+
# Original file was released under Apache License Version 2.0, with the full license text
8+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
9+
#
10+
# This modified file is released under the same license.
11+
12+
from __future__ import annotations
13+
14+
from typing_extensions import Literal
15+
16+
from ..._models import BaseModel
17+
18+
__all__ = ["ResponseAgentToolCallCompletedEvent"]
19+
20+
21+
class ResponseAgentToolCallCompletedEvent(BaseModel):
22+
type: Literal["response.agent_tool_call.completed"]
23+
24+
item_id: str
25+
26+
sequence_number: int
27+
28+
name: str
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) [2025] [OpenAI]
2+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
6+
#
7+
# Original file was released under Apache License Version 2.0, with the full license text
8+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
9+
#
10+
# This modified file is released under the same license.
11+
12+
from __future__ import annotations
13+
14+
from typing_extensions import Literal
15+
16+
from ..._models import BaseModel
17+
18+
__all__ = ["ResponseAgentToolCallInProgressEvent"]
19+
20+
21+
class ResponseAgentToolCallInProgressEvent(BaseModel):
22+
type: Literal["response.agent_tool_call.in_progress"]
23+
24+
item_id: str
25+
26+
sequence_number: int
27+
28+
name: str

volcenginesdkarkruntime/types/responses/response_output_item.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from typing_extensions import Annotated, TypeAlias
1515

1616
from ..._utils import PropertyInfo
17+
from .item_agent_tool_call import ItemAgentToolCall
1718
from .item_doubao_app_call import ItemDoubaoAppCall
1819
from .item_function_image_process import ItemFunctionImageProcess
1920
from .response_function_tool_call import ResponseFunctionToolCall
@@ -37,6 +38,7 @@
3738
McpCall,
3839
ResponseKnowledgeSearchItem,
3940
ItemDoubaoAppCall,
41+
ItemAgentToolCall,
4042
],
4143
PropertyInfo(discriminator="type"),
4244
]

volcenginesdkarkruntime/types/responses/response_stream_event.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
from typing_extensions import Annotated, TypeAlias
1515

1616
from ..._utils import PropertyInfo
17+
from .response_agent_tool_call_completed_event import (
18+
ResponseAgentToolCallCompletedEvent,
19+
)
20+
from .response_agent_tool_call_in_progress_event import (
21+
ResponseAgentToolCallInProgressEvent,
22+
)
1723
from .response_completed_event import ResponseCompletedEvent
1824
from .response_content_part_added_event import ResponseContentPartAddedEvent
1925
from .response_content_part_done_event import ResponseContentPartDoneEvent
@@ -185,6 +191,8 @@
185191
ResponseDoubaoAppCallReasoningSearchCompletedEvent,
186192
ResponseDoubaoAppCallBlockAddedEvent,
187193
ResponseDoubaoAppCallBlockDoneEvent,
194+
ResponseAgentToolCallInProgressEvent,
195+
ResponseAgentToolCallCompletedEvent,
188196
],
189197
PropertyInfo(discriminator="type"),
190198
]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) [2025] [OpenAI]
2+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
6+
#
7+
# Original file was released under Apache License Version 2.0, with the full license text
8+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
9+
#
10+
# This modified file is released under the same license.
11+
12+
from __future__ import annotations
13+
14+
from ..._models import BaseModel
15+
16+
__all__ = ["Session"]
17+
18+
19+
class Session(BaseModel):
20+
id: str

0 commit comments

Comments
 (0)