attp-client 0.0.11__tar.gz → 0.0.13__tar.gz

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.
Files changed (37) hide show
  1. {attp_client-0.0.11 → attp_client-0.0.13}/PKG-INFO +1 -1
  2. {attp_client-0.0.11 → attp_client-0.0.13}/pyproject.toml +1 -1
  3. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/client.py +9 -6
  4. attp_client-0.0.13/src/attp_client/utils/trigger_callable.py +10 -0
  5. {attp_client-0.0.11 → attp_client-0.0.13}/README.md +0 -0
  6. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/__init__.py +0 -0
  7. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/catalog.py +0 -0
  8. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/consts.py +0 -0
  9. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/errors/attp_exception.py +0 -0
  10. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/errors/correlated_rpc_exception.py +0 -0
  11. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/errors/dead_session.py +0 -0
  12. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/errors/not_found.py +0 -0
  13. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/errors/serialization_error.py +0 -0
  14. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/errors/unauthenticated_error.py +0 -0
  15. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/inference.py +0 -0
  16. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/catalogs/catalog.py +0 -0
  17. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/catalogs/tools/envelope.py +0 -0
  18. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/error.py +0 -0
  19. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/handshake/auth.py +0 -0
  20. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/handshake/hello.py +0 -0
  21. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/handshake/ready.py +0 -0
  22. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/inference/enums/message_data_type.py +0 -0
  23. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/inference/enums/message_emergency_type.py +0 -0
  24. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/inference/enums/message_type.py +0 -0
  25. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/inference/message.py +0 -0
  26. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/inference/tool.py +0 -0
  27. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/interfaces/route_mappings.py +0 -0
  28. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/misc/fixed_basemodel.py +0 -0
  29. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/misc/serializable.py +0 -0
  30. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/router.py +0 -0
  31. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/session.py +0 -0
  32. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/tools.py +0 -0
  33. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/types/route_mapping.py +0 -0
  34. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/utils/context_awaiter.py +0 -0
  35. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/utils/envelopizer.py +0 -0
  36. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/utils/route_mapper.py +0 -0
  37. {attp_client-0.0.11 → attp_client-0.0.13}/src/attp_client/utils/serializer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: attp-client
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: A python-sdk client for interacting with AgentHub's ATTP protocol (Agent Tool Transport Protocol)
5
5
  License: MIT
6
6
  Author: Ascender Team
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "attp-client"
3
- version = "0.0.11"
3
+ version = "0.0.13"
4
4
  description = "A python-sdk client for interacting with AgentHub's ATTP protocol (Agent Tool Transport Protocol)"
5
5
  authors = [
6
6
  {name = "Ascender Team"}
@@ -21,6 +21,8 @@ from attp_client.utils import envelopizer
21
21
 
22
22
  from attp_core.rs_api import AttpCommand
23
23
 
24
+ from attp_client.utils.trigger_callable import trigger_callable
25
+
24
26
  class ATTPClient:
25
27
 
26
28
  is_connected: bool
@@ -48,7 +50,7 @@ class ATTPClient:
48
50
  self.max_retries = max_retries
49
51
  self.limits = limits or Limits(max_payload_size=50000)
50
52
  self.client = AttpClientSession(self.connection_url, limits=self.limits)
51
- self.logger = logger
53
+ self.logger = logger or getLogger("Ascender Framework")
52
54
 
53
55
  self.route_increment_index = 2
54
56
 
@@ -73,25 +75,26 @@ class ATTPClient:
73
75
  )
74
76
  asyncio.create_task(self.session.start_listener())
75
77
  # Send an authentication frame as soon as connection estabilishes with agenthub
78
+ self.add_event_handler("tools:call", "message", self._tool_callback)
79
+
76
80
  await self.session.authenticate(self.routes)
77
81
  asyncio.create_task(self.session.listen(self.responder))
78
82
 
79
83
  self.router = AttpRouter(self.responder, self.session)
80
84
  self.inference = AttpInferenceAPI(self.router)
81
85
 
82
- self.add_event_handler("tools:call", "message", self._tool_callback)
83
-
84
-
85
-
86
86
  self.disposable = self.responder.pipe(
87
87
  ops.subscribe_on(AsyncIOScheduler(asyncio.get_event_loop())),
88
88
  ).subscribe(
89
- on_next=lambda item: self.logger.debug(f"Received message on route {item.route_id} with correlation ID {item.correlation_id}"),
89
+ on_next=lambda item: trigger_callable(self._handle_incoming, (item,)),
90
90
  on_error=lambda e: self.logger.error(f"Error in responder stream: {e}"),
91
91
  )
92
92
 
93
93
  async def close(self):
94
94
  if self.session:
95
+ if self.disposable:
96
+ self.disposable.dispose()
97
+
95
98
  await self.session.close()
96
99
  self.session = None
97
100
  self.is_connected = False
@@ -0,0 +1,10 @@
1
+ import asyncio
2
+ from typing import Any, Callable, Mapping
3
+
4
+
5
+ def trigger_callable(
6
+ callable: Callable[..., Any],
7
+ args: tuple[Any] | None = None,
8
+ kwargs: Mapping[str, Any] | None = None
9
+ ):
10
+ asyncio.create_task(callable(*(args or tuple()), **(kwargs or {})))
File without changes