agently 4.0.6.2__py3-none-any.whl → 4.0.6.3__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.
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
-
15
+ import json
16
16
  import inspect
17
17
 
18
18
  from typing import (
@@ -206,6 +206,7 @@ class AgentlyToolManager(ToolManager):
206
206
  ):
207
207
  async def _call_mcp_tool(**kwargs):
208
208
  from fastmcp import Client
209
+ from mcp.types import TextContent, ImageContent, AudioContent, ResourceLink, EmbeddedResource
209
210
 
210
211
  async with Client(transport) as client: # type: ignore
211
212
  mcp_result = await client.call_tool(
@@ -216,7 +217,19 @@ class AgentlyToolManager(ToolManager):
216
217
  if mcp_result.is_error:
217
218
  return {"error": mcp_result.content[0].text} # type: ignore
218
219
  else:
219
- return mcp_result.structured_content
220
+ if mcp_result.structured_content:
221
+ return mcp_result.structured_content
222
+ try:
223
+ result = mcp_result.content[0]
224
+ if isinstance(result, TextContent):
225
+ try:
226
+ return json.loads(result.text)
227
+ except json.decoder.JSONDecodeError:
228
+ return result.text
229
+ elif isinstance(result, (ImageContent, AudioContent, ResourceLink, EmbeddedResource)):
230
+ return result.model_dump()
231
+ except:
232
+ return None
220
233
 
221
234
  return _call_mcp_tool
222
235
 
agently/utils/Storage.py CHANGED
@@ -29,6 +29,7 @@ from .LazyImport import LazyImport
29
29
 
30
30
  LazyImport.import_package("sqlmodel")
31
31
  LazyImport.import_package("sqlalchemy")
32
+ LazyImport.import_package("aiosqlite")
32
33
 
33
34
  from sqlmodel import SQLModel, select, inspect, create_engine, Session # type: ignore
34
35
  from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker # type: ignore
agently/utils/__init__.py CHANGED
@@ -17,7 +17,8 @@ from .Messenger import create_messenger
17
17
  from .RuntimeData import RuntimeData, RuntimeDataNamespace
18
18
  from .SerializableRuntimeData import SerializableRuntimeData, SerializableRuntimeDataNamespace
19
19
  from .Settings import Settings, SettingsNamespace
20
- from .Storage import Storage, AsyncStorage
20
+
21
+ # from .Storage import Storage, AsyncStorage
21
22
  from .FunctionShifter import FunctionShifter
22
23
  from .DataFormatter import DataFormatter
23
24
  from .DataPathBuilder import DataPathBuilder
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agently
3
- Version: 4.0.6.2
3
+ Version: 4.0.6.3
4
4
  Summary:
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -14,7 +14,6 @@ Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Programming Language :: Python :: 3.14
17
- Requires-Dist: aiosqlite (>=0.21.0,<0.22.0)
18
17
  Requires-Dist: greenlet (>=3.2.3,<4.0.0)
19
18
  Requires-Dist: httpx (>=0.28.1,<0.29.0)
20
19
  Requires-Dist: httpx-sse (>=0.4.1,<0.5.0)
@@ -14,7 +14,7 @@ agently/builtins/hookers/SystemMessageHooker.py,sha256=nU5rOzcuXKdaTXWix3jhZ-4Qo
14
14
  agently/builtins/plugins/ModelRequester/OpenAICompatible.py,sha256=dfVDoqTZAZrjBZUusH72-uUGh2Co_p4CkOrMDyeaTaQ,25059
15
15
  agently/builtins/plugins/PromptGenerator/AgentlyPromptGenerator.py,sha256=hUj3bkWLZvLmYwJoFpEfGjbF0VL-gKiHHoKoHFJgzvs,28906
16
16
  agently/builtins/plugins/ResponseParser/AgentlyResponseParser.py,sha256=FEhfsiHB4Bx7HfghnObklLj08j8IVwGh0WEVD6U-G3U,17445
17
- agently/builtins/plugins/ToolManager/AgentlyToolManager.py,sha256=23fyWAPw9wLIH2bkrbeKzThzA0z4Lvy8b9Qvp8SrGJE,8381
17
+ agently/builtins/plugins/ToolManager/AgentlyToolManager.py,sha256=oaqte5LAryZQMD6vuEbKhe6kOLUyZTRZswC1MDFiYxw,9138
18
18
  agently/builtins/plugins/__init__.py,sha256=wj4_U9TTekc2CmjppbXKUREDFRXFX1y0ySOW-CxQuok,801
19
19
  agently/builtins/tools/Browse.py,sha256=gIePs-gtsqOI_ZTReGqEcoKvhs4FkBzTxow--QS5_ek,3469
20
20
  agently/builtins/tools/Search.py,sha256=tUynNiW_ZMAGaB2ua3HRcY_trIbLEoASFE-p2QMQ0Zg,7362
@@ -66,11 +66,11 @@ agently/utils/Messenger.py,sha256=dLasJvDt1HxJttt6X9dutwGPvyAtL7yp6BZ3TDxuFDI,72
66
66
  agently/utils/RuntimeData.py,sha256=SewZ8D1fljuDwfVZTAqZ0XTNEcU2cuAr7QlVqk0vzrE,21925
67
67
  agently/utils/SerializableRuntimeData.py,sha256=bVVwin50VnOs30W881ClFepSXAK8GCOUZnVd-SiolRw,3314
68
68
  agently/utils/Settings.py,sha256=_s300H2doCMKcvMAmFwW3cLQqmd0N8BVmb226tAfVec,5294
69
- agently/utils/Storage.py,sha256=VxNUIyndhfbQ0TlarIViDCzTeCZUiB_G1JOZizXntMI,9399
69
+ agently/utils/Storage.py,sha256=E7QyNJ9T0yOUafPgdP90La698hgLMSGjhJ7qCEHzxxw,9438
70
70
  agently/utils/StreamingJSONCompleter.py,sha256=aZ9zuGUTQlP-QKbXHUZCf6EtVuG49MKn8xdhw0VhDEA,4292
71
71
  agently/utils/StreamingJSONParser.py,sha256=sPPJOtj5OYvsrukRErcoxRl4yuV1zDuf7pQ_pvw_Zow,21116
72
- agently/utils/__init__.py,sha256=NXiBzE-pOYxukqCVBmCmGUwlVuqe2w5inwxzg3IUkaw,1277
73
- agently-4.0.6.2.dist-info/METADATA,sha256=4OHwu6tyR9ljS8QU3v0pBwPEVSzaYrnXh2HgvXmrlY0,7156
74
- agently-4.0.6.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
75
- agently-4.0.6.2.dist-info/licenses/LICENSE,sha256=Y5ZgAdYgMFigPT8dhN18dTLRtBshOSfWhTDRO1t0Cq4,11360
76
- agently-4.0.6.2.dist-info/RECORD,,
72
+ agently/utils/__init__.py,sha256=7MDln5OVkqFEdhhuG8VTdr2q02UWwCj-udndwzWV_iQ,1280
73
+ agently-4.0.6.3.dist-info/METADATA,sha256=hyRZHnHclxS8KBKftrZPkcz6c5_TdIk9ev98OFRwgLU,7112
74
+ agently-4.0.6.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
75
+ agently-4.0.6.3.dist-info/licenses/LICENSE,sha256=Y5ZgAdYgMFigPT8dhN18dTLRtBshOSfWhTDRO1t0Cq4,11360
76
+ agently-4.0.6.3.dist-info/RECORD,,