acontext 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
acontext/async_client.py CHANGED
@@ -15,7 +15,6 @@ from .uploads import FileUpload as FileUpload
15
15
  from .resources.async_disks import AsyncDisksAPI as AsyncDisksAPI
16
16
  from .resources.async_sandboxes import AsyncSandboxesAPI as AsyncSandboxesAPI
17
17
  from .resources.async_sessions import AsyncSessionsAPI as AsyncSessionsAPI
18
- from .resources.async_tools import AsyncToolsAPI as AsyncToolsAPI
19
18
  from .resources.async_skills import AsyncSkillsAPI as AsyncSkillsAPI
20
19
  from .resources.async_users import AsyncUsersAPI as AsyncUsersAPI
21
20
 
@@ -107,7 +106,6 @@ class AcontextAsyncClient:
107
106
  self.sessions = AsyncSessionsAPI(self)
108
107
  self.disks = AsyncDisksAPI(self)
109
108
  self.artifacts = self.disks.artifacts
110
- self.tools = AsyncToolsAPI(self)
111
109
  self.skills = AsyncSkillsAPI(self)
112
110
  self.users = AsyncUsersAPI(self)
113
111
  self.sandboxes = AsyncSandboxesAPI(self)
acontext/client.py CHANGED
@@ -15,7 +15,6 @@ from .uploads import FileUpload as FileUpload
15
15
  from .resources.disks import DisksAPI as DisksAPI
16
16
  from .resources.sandboxes import SandboxesAPI as SandboxesAPI
17
17
  from .resources.sessions import SessionsAPI as SessionsAPI
18
- from .resources.tools import ToolsAPI as ToolsAPI
19
18
  from .resources.skills import SkillsAPI as SkillsAPI
20
19
  from .resources.users import UsersAPI as UsersAPI
21
20
 
@@ -107,7 +106,6 @@ class AcontextClient:
107
106
  self.sessions = SessionsAPI(self)
108
107
  self.disks = DisksAPI(self)
109
108
  self.artifacts = self.disks.artifacts
110
- self.tools = ToolsAPI(self)
111
109
  self.skills = SkillsAPI(self)
112
110
  self.users = UsersAPI(self)
113
111
  self.sandboxes = SandboxesAPI(self)
@@ -3,13 +3,11 @@
3
3
  from .async_disks import AsyncDisksAPI, AsyncDiskArtifactsAPI
4
4
  from .async_sandboxes import AsyncSandboxesAPI
5
5
  from .async_sessions import AsyncSessionsAPI
6
- from .async_tools import AsyncToolsAPI
7
6
  from .async_skills import AsyncSkillsAPI
8
7
  from .async_users import AsyncUsersAPI
9
8
  from .disks import DisksAPI, DiskArtifactsAPI
10
9
  from .sandboxes import SandboxesAPI
11
10
  from .sessions import SessionsAPI
12
- from .tools import ToolsAPI
13
11
  from .skills import SkillsAPI
14
12
  from .users import UsersAPI
15
13
 
@@ -18,14 +16,12 @@ __all__ = [
18
16
  "DiskArtifactsAPI",
19
17
  "SandboxesAPI",
20
18
  "SessionsAPI",
21
- "ToolsAPI",
22
19
  "SkillsAPI",
23
20
  "UsersAPI",
24
21
  "AsyncDisksAPI",
25
22
  "AsyncDiskArtifactsAPI",
26
23
  "AsyncSandboxesAPI",
27
24
  "AsyncSessionsAPI",
28
- "AsyncToolsAPI",
29
25
  "AsyncSkillsAPI",
30
26
  "AsyncUsersAPI",
31
27
  ]
@@ -9,7 +9,7 @@ from ..types.sandbox import (
9
9
  SandboxCommandOutput,
10
10
  SandboxRuntimeInfo,
11
11
  )
12
- from ..types.tool import FlagResponse
12
+ from ..types.common import FlagResponse
13
13
 
14
14
 
15
15
  class AsyncSandboxesAPI:
@@ -40,6 +40,7 @@ class AsyncSessionsAPI:
40
40
  limit: int | None = None,
41
41
  cursor: str | None = None,
42
42
  time_desc: bool | None = None,
43
+ filter_by_configs: Mapping[str, Any] | None = None,
43
44
  ) -> ListSessionsOutput:
44
45
  """List all sessions in the project.
45
46
 
@@ -48,13 +49,25 @@ class AsyncSessionsAPI:
48
49
  limit: Maximum number of sessions to return. Defaults to None.
49
50
  cursor: Cursor for pagination. Defaults to None.
50
51
  time_desc: Order by created_at descending if True, ascending if False. Defaults to None.
52
+ filter_by_configs: Filter by session configs using JSONB containment.
53
+ Only sessions where configs contains all key-value pairs in this
54
+ dict will be returned. Supports nested objects.
55
+ Note: Matching is case-sensitive and type-sensitive.
56
+ Sessions with NULL configs are excluded from filtered results.
57
+ Defaults to None.
51
58
 
52
59
  Returns:
53
60
  ListSessionsOutput containing the list of sessions and pagination information.
61
+
62
+ Example:
63
+ >>> sessions = await client.sessions.list(filter_by_configs={"agent": "bot1"})
54
64
  """
55
65
  params: dict[str, Any] = {}
56
66
  if user:
57
67
  params["user"] = user
68
+ # Handle filter_by_configs - JSON encode, skip empty dict
69
+ if filter_by_configs is not None and len(filter_by_configs) > 0:
70
+ params["filter_by_configs"] = json.dumps(filter_by_configs)
58
71
  params.update(
59
72
  build_params(
60
73
  limit=limit,
@@ -71,6 +84,7 @@ class AsyncSessionsAPI:
71
84
  user: str | None = None,
72
85
  disable_task_tracking: bool | None = None,
73
86
  configs: Mapping[str, Any] | None = None,
87
+ use_uuid: str | None = None,
74
88
  ) -> Session:
75
89
  """Create a new session.
76
90
 
@@ -78,9 +92,14 @@ class AsyncSessionsAPI:
78
92
  user: Optional user identifier string. Defaults to None.
79
93
  disable_task_tracking: Whether to disable task tracking for this session. Defaults to None (server default: False).
80
94
  configs: Optional session configuration dictionary. Defaults to None.
95
+ use_uuid: Optional UUID string to use as the session ID. If not provided, a UUID will be auto-generated.
96
+ If a session with this UUID already exists, a 409 Conflict error will be raised.
81
97
 
82
98
  Returns:
83
99
  The created Session object.
100
+
101
+ Raises:
102
+ AcontextAPIError: If use_uuid is invalid or a session with this UUID already exists.
84
103
  """
85
104
  payload: dict[str, Any] = {}
86
105
  if user:
@@ -89,6 +108,8 @@ class AsyncSessionsAPI:
89
108
  payload["disable_task_tracking"] = disable_task_tracking
90
109
  if configs is not None:
91
110
  payload["configs"] = configs
111
+ if use_uuid is not None:
112
+ payload["use_uuid"] = use_uuid
92
113
  data = await self._requester.request("POST", "/session", json_data=payload)
93
114
  return Session.model_validate(data)
94
115
 
@@ -9,7 +9,7 @@ from ..types.sandbox import (
9
9
  SandboxCommandOutput,
10
10
  SandboxRuntimeInfo,
11
11
  )
12
- from ..types.tool import FlagResponse
12
+ from ..types.common import FlagResponse
13
13
 
14
14
 
15
15
  class SandboxesAPI:
@@ -40,6 +40,7 @@ class SessionsAPI:
40
40
  limit: int | None = None,
41
41
  cursor: str | None = None,
42
42
  time_desc: bool | None = None,
43
+ filter_by_configs: Mapping[str, Any] | None = None,
43
44
  ) -> ListSessionsOutput:
44
45
  """List all sessions in the project.
45
46
 
@@ -48,13 +49,25 @@ class SessionsAPI:
48
49
  limit: Maximum number of sessions to return. Defaults to None.
49
50
  cursor: Cursor for pagination. Defaults to None.
50
51
  time_desc: Order by created_at descending if True, ascending if False. Defaults to None.
52
+ filter_by_configs: Filter by session configs using JSONB containment.
53
+ Only sessions where configs contains all key-value pairs in this
54
+ dict will be returned. Supports nested objects.
55
+ Note: Matching is case-sensitive and type-sensitive.
56
+ Sessions with NULL configs are excluded from filtered results.
57
+ Defaults to None.
51
58
 
52
59
  Returns:
53
60
  ListSessionsOutput containing the list of sessions and pagination information.
61
+
62
+ Example:
63
+ >>> sessions = client.sessions.list(filter_by_configs={"agent": "bot1"})
54
64
  """
55
65
  params: dict[str, Any] = {}
56
66
  if user:
57
67
  params["user"] = user
68
+ # Handle filter_by_configs - JSON encode, skip empty dict
69
+ if filter_by_configs is not None and len(filter_by_configs) > 0:
70
+ params["filter_by_configs"] = json.dumps(filter_by_configs)
58
71
  params.update(
59
72
  build_params(
60
73
  limit=limit,
@@ -71,6 +84,7 @@ class SessionsAPI:
71
84
  user: str | None = None,
72
85
  disable_task_tracking: bool | None = None,
73
86
  configs: Mapping[str, Any] | None = None,
87
+ use_uuid: str | None = None,
74
88
  ) -> Session:
75
89
  """Create a new session.
76
90
 
@@ -78,9 +92,14 @@ class SessionsAPI:
78
92
  user: Optional user identifier string. Defaults to None.
79
93
  disable_task_tracking: Whether to disable task tracking for this session. Defaults to None (server default: False).
80
94
  configs: Optional session configuration dictionary. Defaults to None.
95
+ use_uuid: Optional UUID string to use as the session ID. If not provided, a UUID will be auto-generated.
96
+ If a session with this UUID already exists, a 409 Conflict error will be raised.
81
97
 
82
98
  Returns:
83
99
  The created Session object.
100
+
101
+ Raises:
102
+ AcontextAPIError: If use_uuid is invalid or a session with this UUID already exists.
84
103
  """
85
104
  payload: dict[str, Any] = {}
86
105
  if user:
@@ -89,6 +108,8 @@ class SessionsAPI:
89
108
  payload["disable_task_tracking"] = disable_task_tracking
90
109
  if configs is not None:
91
110
  payload["configs"] = configs
111
+ if use_uuid is not None:
112
+ payload["use_uuid"] = use_uuid
92
113
  data = self._requester.request("POST", "/session", json_data=payload)
93
114
  return Session.model_validate(data)
94
115
 
@@ -1,6 +1,6 @@
1
1
  """Type definitions for API responses."""
2
2
 
3
- from .common import FileContent
3
+ from .common import FileContent, FlagResponse
4
4
  from .disk import (
5
5
  Artifact,
6
6
  Disk,
@@ -22,11 +22,6 @@ from .session import (
22
22
  TaskData,
23
23
  TokenCounts,
24
24
  )
25
- from .tool import (
26
- FlagResponse,
27
- ToolReferenceData,
28
- ToolRenameItem,
29
- )
30
25
  from .skill import (
31
26
  FileInfo,
32
27
  GetSkillFileResp,
@@ -50,10 +45,12 @@ from .user import (
50
45
  )
51
46
 
52
47
  __all__ = [
48
+ # Common types
49
+ "FileContent",
50
+ "FlagResponse",
53
51
  # Disk types
54
52
  "Artifact",
55
53
  "Disk",
56
- "FileContent",
57
54
  "GetArtifactResp",
58
55
  "ListArtifactsResp",
59
56
  "ListDisksOutput",
@@ -70,10 +67,6 @@ __all__ = [
70
67
  "Task",
71
68
  "TaskData",
72
69
  "TokenCounts",
73
- # Tool types
74
- "FlagResponse",
75
- "ToolReferenceData",
76
- "ToolRenameItem",
77
70
  # Skill types
78
71
  "FileInfo",
79
72
  "Skill",
acontext/types/common.py CHANGED
@@ -9,3 +9,10 @@ class FileContent(BaseModel):
9
9
  type: str = Field(..., description="File content type: 'text', 'json', 'csv', or 'code'")
10
10
  raw: str = Field(..., description="Raw text content of the file")
11
11
 
12
+
13
+ class FlagResponse(BaseModel):
14
+ """Response model for flag operations like kill sandbox."""
15
+
16
+ status: int = Field(..., description="Status code of the operation")
17
+ errmsg: str = Field(..., description="Error message if any")
18
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: acontext
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Python SDK for the Acontext API
5
5
  Keywords: acontext,sdk,client,api
6
6
  Requires-Dist: httpx>=0.28.1
@@ -8,34 +8,31 @@ acontext/agent/prompts.py,sha256=awhYYClNAROnTAfzKKD8G5gHfTFs-1KqMUEWCEnlMMQ,495
8
8
  acontext/agent/sandbox.py,sha256=ziGGs2yqJaik_9o7S3f9G-CzcndmRs9fC3WDUi_UGbI,19016
9
9
  acontext/agent/skill.py,sha256=uB7teH7OAk4Cy6pOLRCJFBi5KZbyMMgZSLEt77TLB20,12880
10
10
  acontext/agent/text_editor.py,sha256=mrUtMfAtgpOOwYnh2xQpWRc0lCoE9u2_WMTVRuFiWRQ,13390
11
- acontext/async_client.py,sha256=WjqW7ruMtlYTBlk6PQ1-1yhjFSBBxGqI3oxrfEqqIpQ,8471
12
- acontext/client.py,sha256=XggELxXU9-8BcAcHOoiqQZypfPmkhe7SyJ3plHq-A9M,8217
11
+ acontext/async_client.py,sha256=QpWPMkX9TeV41un8Y975Bu7M8EWlstETVOIoiQdDaMs,8364
12
+ acontext/client.py,sha256=pD9FWVio9GM2qNexZ2Mp-S_iGyr7dkX6D4ge4Km9cB0,8131
13
13
  acontext/client_types.py,sha256=oR6lSDMjEERx0mIVOpKaTXbEu_lfoxe3fDpzA-ALE-8,1063
14
14
  acontext/errors.py,sha256=W9i7_t46q9kbci3XAyZiyQhS154d4R9rSon3na-gjgs,1296
15
15
  acontext/messages.py,sha256=oNRZStfhcPFt6DPOfs_-Q7R1Xui6dOMr3wmpmC8pzvE,2310
16
16
  acontext/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- acontext/resources/__init__.py,sha256=i2_12EUfxo2z-dgMu8dyAsEiT9nf2P00voN2_vMZ2K8,843
17
+ acontext/resources/__init__.py,sha256=NN5rlry2o_GdqxbiKq0oeVLi6NE6i1k0MwA0Nw0MOO8,739
18
18
  acontext/resources/async_disks.py,sha256=rc8hSdVsZ1UbrK2kwxmEMZyP0aEMsvjyZ70cYddpiF8,12051
19
- acontext/resources/async_sandboxes.py,sha256=qkpEhmUUUrq_C1mVSVyUzBvxzBdq6BvL9e76FXyk19M,2850
20
- acontext/resources/async_sessions.py,sha256=wBUUIDUvMqe_mdR3l_3HuPfEWUcq65SOJLc5mKTu0nI,14691
19
+ acontext/resources/async_sandboxes.py,sha256=GC-HhkgNl70P4W-eD9lSRE-aPYoOPqRes_9hvGvQf9g,2852
20
+ acontext/resources/async_sessions.py,sha256=UhnAFh13wJrvXBqFeK1bTXsdT5YAj-q3LDQ96_IhJvA,15921
21
21
  acontext/resources/async_skills.py,sha256=eRn3NjBhR6_6GmEyZO_nKc0OnHgR_TeIHxqGX_73lwo,5999
22
- acontext/resources/async_tools.py,sha256=RbGaF2kX65Mun-q-Fp5H1J8waWTLIdCOfbdY19jpn1o,1091
23
22
  acontext/resources/async_users.py,sha256=CjW_Xz-UnNf449Hr1j3YeGgtIVZi2ePY5-r7Uj3wMIc,2005
24
23
  acontext/resources/disks.py,sha256=YyAzm6A00T4A3dI8YTEAOxwm6bnCnp8gWIoZ4lLGN5w,11859
25
- acontext/resources/sandboxes.py,sha256=2E9Ls15t3FQ9LBZOnk0--IjQhxwZGTPkbpS5zcnOJSo,2779
26
- acontext/resources/sessions.py,sha256=yaFwiWsShM4HVguwsM-Mp9HHJohl84R-LOFp8uGJUyU,14454
24
+ acontext/resources/sandboxes.py,sha256=BWaSK2MrkVvKgVeHJZyIbvaiEqXREIa7X5LJxOoxUts,2781
25
+ acontext/resources/sessions.py,sha256=wdrTi8c_6PsgA9X4izLOuU4xV7MDONV-wExWWUb_LJo,15678
27
26
  acontext/resources/skills.py,sha256=CZFgJhRDtGlbDcTBKNxFkG4DlqoaJb0c_ymfV12QKdM,5930
28
- acontext/resources/tools.py,sha256=II_185B0HYKSP43hizE6C1zs7kjkkPLKihuEG8s-DRY,1046
29
27
  acontext/resources/users.py,sha256=vZfBHd2ARmd9d5d8n5rLaMUT5z2bMO82k7OcqMaFqxk,1946
30
- acontext/types/__init__.py,sha256=rZHoT0gWIQ576J2mGqhyqWu4Uh8jn0HINdhNJwbjZ8U,1725
31
- acontext/types/common.py,sha256=5kLwzszlIofz8qZ9-Wj_zcBBiF22mAWgH9uWPkcgWCE,327
28
+ acontext/types/__init__.py,sha256=Qwz8d8Z060bSRWaR5QavgVoQviBHqQ9UqvDme_nbDpM,1611
29
+ acontext/types/common.py,sha256=CbJdF8c9jbSCtDhVTxCLOzXaSe836C_AUrmMEFA8aHA,563
32
30
  acontext/types/disk.py,sha256=jdQqQ8HF3cwl_Y1dh98TOXZKfcdN_gSzaSrCE8PKT-0,2250
33
31
  acontext/types/sandbox.py,sha256=vbgpwjbVjjY3uwXxSbOP8IfC65lhkJ_4BYA19dqj5FE,2248
34
32
  acontext/types/session.py,sha256=WqhEtrg1jwknIiQ9TipUeLONS4bY_J_C7Xd_TrYlsWg,11003
35
33
  acontext/types/skill.py,sha256=v7OAvtkwTeZAkLG7NQMcwFoSJ4g-HDWjPZ4EoMyU3mk,2779
36
- acontext/types/tool.py,sha256=UlX6JIGRKd96vPayOkyi6pGwFi6w9GwWwAxr4BcqVts,670
37
34
  acontext/types/user.py,sha256=dBzHCqULSJ3Sqw7T8nA0U8Sctz76Pd0hm1qsHvtEIBQ,1264
38
35
  acontext/uploads.py,sha256=6twnqQOY_eerNuEjeSKsE_3S0IfJUiczXtAy4aXqDl8,1379
39
- acontext-0.1.6.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
40
- acontext-0.1.6.dist-info/METADATA,sha256=xUgSw00x4t4EHQR7WLgfwlnjEgXJjD1LH2mk4t_KKSo,888
41
- acontext-0.1.6.dist-info/RECORD,,
36
+ acontext-0.1.8.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
37
+ acontext-0.1.8.dist-info/METADATA,sha256=oWNmr7kXtegIBZRwOwYR2bkb_gL0Ms0vp55fO0EPtqQ,888
38
+ acontext-0.1.8.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.27
2
+ Generator: uv 0.9.28
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,34 +0,0 @@
1
- """Async tool endpoints."""
2
-
3
- from ..client_types import AsyncRequesterProtocol
4
- from ..types.tool import FlagResponse, ToolReferenceData
5
-
6
-
7
- class AsyncToolsAPI:
8
- def __init__(self, requester: AsyncRequesterProtocol) -> None:
9
- self._requester = requester
10
-
11
- async def rename_tool_name(
12
- self, *, rename: list[dict[str, str]]
13
- ) -> FlagResponse:
14
- """Rename tool names within a project.
15
-
16
- Args:
17
- rename: List of dictionaries with old_name and new_name keys.
18
-
19
- Returns:
20
- FlagResponse containing status and errmsg fields.
21
- """
22
- payload = {"rename": rename}
23
- data = await self._requester.request("PUT", "/tool/name", json_data=payload)
24
- return FlagResponse.model_validate(data)
25
-
26
- async def get_tool_name(self) -> list[ToolReferenceData]:
27
- """Get all tool names within a project.
28
-
29
- Returns:
30
- List of ToolReferenceData objects.
31
- """
32
- data = await self._requester.request("GET", "/tool/name")
33
- return [ToolReferenceData.model_validate(item) for item in data]
34
-
@@ -1,34 +0,0 @@
1
- """Tool endpoints."""
2
-
3
- from ..client_types import RequesterProtocol
4
- from ..types.tool import FlagResponse, ToolReferenceData
5
-
6
-
7
- class ToolsAPI:
8
- def __init__(self, requester: RequesterProtocol) -> None:
9
- self._requester = requester
10
-
11
- def rename_tool_name(
12
- self, *, rename: list[dict[str, str]]
13
- ) -> FlagResponse:
14
- """Rename tool names within a project.
15
-
16
- Args:
17
- rename: List of dictionaries with old_name and new_name keys.
18
-
19
- Returns:
20
- FlagResponse containing status and errmsg fields.
21
- """
22
- payload = {"rename": rename}
23
- data = self._requester.request("PUT", "/tool/name", json_data=payload)
24
- return FlagResponse.model_validate(data)
25
-
26
- def get_tool_name(self) -> list[ToolReferenceData]:
27
- """Get all tool names within a project.
28
-
29
- Returns:
30
- List of ToolReferenceData objects.
31
- """
32
- data = self._requester.request("GET", "/tool/name")
33
- return [ToolReferenceData.model_validate(item) for item in data]
34
-
acontext/types/tool.py DELETED
@@ -1,25 +0,0 @@
1
- """Type definitions for tool resources."""
2
-
3
- from pydantic import BaseModel, Field
4
-
5
-
6
- class FlagResponse(BaseModel):
7
- """Flag response with status and error message."""
8
-
9
- status: int = Field(..., description="Status code")
10
- errmsg: str = Field(..., description="Error message")
11
-
12
-
13
- class ToolReferenceData(BaseModel):
14
- """Tool reference data."""
15
-
16
- name: str = Field(..., description="Tool name")
17
- sop_count: int = Field(..., description="Number of SOPs using this tool")
18
-
19
-
20
- class ToolRenameItem(BaseModel):
21
- """Tool rename item."""
22
-
23
- old_name: str = Field(..., description="Old tool name")
24
- new_name: str = Field(..., description="New tool name")
25
-