Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7054,6 +7054,34 @@
"title": "Idle Timeout S",
"description": "Seconds to keep the session open for follow-up messages after each answer. Null ends the session as soon as the agent answers."
},
"delete_after_min": {
"anyOf": [
{
"type": "integer",
"minimum": 1.0
},
{
"type": "null"
}
],
"title": "Delete After Min",
"description": "Minutes after the session finishes before it is automatically deleted. Defaults to 30 days. Null keeps the session forever.",
"default": 43200
},
"delete_screenshot_after_min": {
"anyOf": [
{
"type": "integer",
"minimum": 1.0
},
{
"type": "null"
}
],
"title": "Delete Screenshot After Min",
"description": "Minutes after the session finishes before its screenshots are deleted. Defaults to 30 days. Null keeps screenshots for the session's lifetime.",
"default": 43200
},
"queue": {
"type": "boolean",
"title": "Queue",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "hai-agents"
version = "1.0.6"
version = "1.0.7"
description = "Python SDK for H Company's Computer-Use Agents: autonomous agents powered by Holo."
requires-python = ">=3.10"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions src/hai_agents/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform

headers: typing.Dict[str, str] = {
"User-Agent": "hai_agents/1.0.6",
"User-Agent": "hai_agents/1.0.7",
"X-HCompany-Client-Name": "hai_agents",
"X-HCompany-Client-Version": "1.0.6",
"X-HCompany-Client-Version": "1.0.7",
"X-HCompany-Client-Type": "sdk",
"X-HCompany-Language": "Python",
"X-HCompany-Runtime": f"python/{platform.python_version()}",
Expand Down
3 changes: 2 additions & 1 deletion src/hai_agents/polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ async def _async_execute_tool_call(
result = f"Tool {name!r} is not registered with this client."
else:
try:
result = local_tool.fn(**(call.get("args") or {}))
args = call.get("args") or {}
result = await asyncio.get_running_loop().run_in_executor(None, lambda: local_tool.fn(**args))
if inspect.isawaitable(result):
result = await result
except Exception as exc:
Expand Down
20 changes: 20 additions & 0 deletions src/hai_agents/sessions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def create_session(
max_steps: typing.Optional[int] = OMIT,
max_time_s: typing.Optional[float] = OMIT,
idle_timeout_s: typing.Optional[int] = OMIT,
delete_after_min: typing.Optional[int] = OMIT,
delete_screenshot_after_min: typing.Optional[int] = OMIT,
queue: typing.Optional[bool] = OMIT,
group_id: typing.Optional[str] = OMIT,
parent_session_id: typing.Optional[str] = OMIT,
Expand Down Expand Up @@ -171,6 +173,12 @@ def create_session(
idle_timeout_s : typing.Optional[int]
Seconds to keep the session open for follow-up messages after each answer. Null ends the session as soon as the agent answers.

delete_after_min : typing.Optional[int]
Minutes after the session finishes before it is automatically deleted. Defaults to 30 days. Null keeps the session forever.

delete_screenshot_after_min : typing.Optional[int]
Minutes after the session finishes before its screenshots are deleted. Defaults to 30 days. Null keeps screenshots for the session's lifetime.

queue : typing.Optional[bool]
When the organization is at its concurrent-session limit, accept this session into a queue (status 'queued') instead of rejecting it with 429. Queued sessions start automatically, oldest first, as running sessions finish. Set to false to get an immediate 429 when no slot is available.

Expand Down Expand Up @@ -209,6 +217,8 @@ def create_session(
max_steps=max_steps,
max_time_s=max_time_s,
idle_timeout_s=idle_timeout_s,
delete_after_min=delete_after_min,
delete_screenshot_after_min=delete_screenshot_after_min,
queue=queue,
group_id=group_id,
parent_session_id=parent_session_id,
Expand Down Expand Up @@ -920,6 +930,8 @@ async def create_session(
max_steps: typing.Optional[int] = OMIT,
max_time_s: typing.Optional[float] = OMIT,
idle_timeout_s: typing.Optional[int] = OMIT,
delete_after_min: typing.Optional[int] = OMIT,
delete_screenshot_after_min: typing.Optional[int] = OMIT,
queue: typing.Optional[bool] = OMIT,
group_id: typing.Optional[str] = OMIT,
parent_session_id: typing.Optional[str] = OMIT,
Expand Down Expand Up @@ -948,6 +960,12 @@ async def create_session(
idle_timeout_s : typing.Optional[int]
Seconds to keep the session open for follow-up messages after each answer. Null ends the session as soon as the agent answers.

delete_after_min : typing.Optional[int]
Minutes after the session finishes before it is automatically deleted. Defaults to 30 days. Null keeps the session forever.

delete_screenshot_after_min : typing.Optional[int]
Minutes after the session finishes before its screenshots are deleted. Defaults to 30 days. Null keeps screenshots for the session's lifetime.

queue : typing.Optional[bool]
When the organization is at its concurrent-session limit, accept this session into a queue (status 'queued') instead of rejecting it with 429. Queued sessions start automatically, oldest first, as running sessions finish. Set to false to get an immediate 429 when no slot is available.

Expand Down Expand Up @@ -994,6 +1012,8 @@ async def main() -> None:
max_steps=max_steps,
max_time_s=max_time_s,
idle_timeout_s=idle_timeout_s,
delete_after_min=delete_after_min,
delete_screenshot_after_min=delete_screenshot_after_min,
queue=queue,
group_id=group_id,
parent_session_id=parent_session_id,
Expand Down
20 changes: 20 additions & 0 deletions src/hai_agents/sessions/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def create_session(
max_steps: typing.Optional[int] = OMIT,
max_time_s: typing.Optional[float] = OMIT,
idle_timeout_s: typing.Optional[int] = OMIT,
delete_after_min: typing.Optional[int] = OMIT,
delete_screenshot_after_min: typing.Optional[int] = OMIT,
queue: typing.Optional[bool] = OMIT,
group_id: typing.Optional[str] = OMIT,
parent_session_id: typing.Optional[str] = OMIT,
Expand Down Expand Up @@ -195,6 +197,12 @@ def create_session(
idle_timeout_s : typing.Optional[int]
Seconds to keep the session open for follow-up messages after each answer. Null ends the session as soon as the agent answers.

delete_after_min : typing.Optional[int]
Minutes after the session finishes before it is automatically deleted. Defaults to 30 days. Null keeps the session forever.

delete_screenshot_after_min : typing.Optional[int]
Minutes after the session finishes before its screenshots are deleted. Defaults to 30 days. Null keeps screenshots for the session's lifetime.

queue : typing.Optional[bool]
When the organization is at its concurrent-session limit, accept this session into a queue (status 'queued') instead of rejecting it with 429. Queued sessions start automatically, oldest first, as running sessions finish. Set to false to get an immediate 429 when no slot is available.

Expand Down Expand Up @@ -228,6 +236,8 @@ def create_session(
"max_steps": max_steps,
"max_time_s": max_time_s,
"idle_timeout_s": idle_timeout_s,
"delete_after_min": delete_after_min,
"delete_screenshot_after_min": delete_screenshot_after_min,
"queue": queue,
"group_id": group_id,
"parent_session_id": parent_session_id,
Expand Down Expand Up @@ -1284,6 +1294,8 @@ async def create_session(
max_steps: typing.Optional[int] = OMIT,
max_time_s: typing.Optional[float] = OMIT,
idle_timeout_s: typing.Optional[int] = OMIT,
delete_after_min: typing.Optional[int] = OMIT,
delete_screenshot_after_min: typing.Optional[int] = OMIT,
queue: typing.Optional[bool] = OMIT,
group_id: typing.Optional[str] = OMIT,
parent_session_id: typing.Optional[str] = OMIT,
Expand Down Expand Up @@ -1312,6 +1324,12 @@ async def create_session(
idle_timeout_s : typing.Optional[int]
Seconds to keep the session open for follow-up messages after each answer. Null ends the session as soon as the agent answers.

delete_after_min : typing.Optional[int]
Minutes after the session finishes before it is automatically deleted. Defaults to 30 days. Null keeps the session forever.

delete_screenshot_after_min : typing.Optional[int]
Minutes after the session finishes before its screenshots are deleted. Defaults to 30 days. Null keeps screenshots for the session's lifetime.

queue : typing.Optional[bool]
When the organization is at its concurrent-session limit, accept this session into a queue (status 'queued') instead of rejecting it with 429. Queued sessions start automatically, oldest first, as running sessions finish. Set to false to get an immediate 429 when no slot is available.

Expand Down Expand Up @@ -1345,6 +1363,8 @@ async def create_session(
"max_steps": max_steps,
"max_time_s": max_time_s,
"idle_timeout_s": idle_timeout_s,
"delete_after_min": delete_after_min,
"delete_screenshot_after_min": delete_screenshot_after_min,
"queue": queue,
"group_id": group_id,
"parent_session_id": parent_session_id,
Expand Down
10 changes: 10 additions & 0 deletions src/hai_agents/types/session_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class SessionRequest(UniversalBaseModel):
Seconds to keep the session open for follow-up messages after each answer. Null ends the session as soon as the agent answers.
"""

delete_after_min: typing.Optional[int] = pydantic.Field(default=None)
"""
Minutes after the session finishes before it is automatically deleted. Defaults to 30 days. Null keeps the session forever.
"""

delete_screenshot_after_min: typing.Optional[int] = pydantic.Field(default=None)
"""
Minutes after the session finishes before its screenshots are deleted. Defaults to 30 days. Null keeps screenshots for the session's lifetime.
"""

queue: typing.Optional[bool] = pydantic.Field(default=None)
"""
When the organization is at its concurrent-session limit, accept this session into a queue (status 'queued') instead of rejecting it with 429. Queued sessions start automatically, oldest first, as running sessions finish. Set to false to get an immediate 429 when no slot is available.
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.