viasocket 0.1.2__tar.gz → 0.2.0__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.
@@ -1,16 +1,18 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: viasocket
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: viaSocket for Python agents: the 2,300+ apps each of your users connected (Slack, Google Sheets, HubSpot, Notion...) as tools for LangChain, CrewAI and LlamaIndex.
5
5
  Project-URL: Homepage, https://github.com/Walkover-Web-Solution/viasocket-apps/tree/main/python#readme
6
6
  Project-URL: Source, https://github.com/Walkover-Web-Solution/viasocket-apps
7
7
  Author: Walkover Web Solution
8
8
  License-Expression: MIT
9
9
  License-File: LICENSE
10
- Keywords: ai-agent,crewai,google-sheets,integrations,langchain,llamaindex,slack,tools,viasocket
10
+ Keywords: ai-agent,crewai,google-adk,google-sheets,integrations,langchain,llamaindex,slack,tools,viasocket
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Requires-Python: >=3.10
14
+ Provides-Extra: adk
15
+ Requires-Dist: google-adk>=1.10; extra == 'adk'
14
16
  Provides-Extra: crewai
15
17
  Requires-Dist: crewai>=0.80; extra == 'crewai'
16
18
  Provides-Extra: langchain
@@ -24,13 +26,13 @@ Description-Content-Type: text/markdown
24
26
  Your own agent, acting in the apps each of your users connected through viaSocket: every action of
25
27
  an app is a tool, run on that user's own connection. Slack's Send Message, Google Sheets' Add New
26
28
  Row, HubSpot's Create Deal — any of 2,300+ apps, with no connector code and no OAuth on your side.
27
- Works with LangChain, CrewAI and LlamaIndex.
29
+ Works with LangChain, CrewAI, LlamaIndex and Google ADK.
28
30
 
29
31
  It is the Python side of the [`viasocket-apps`](https://www.npmjs.com/package/viasocket-apps) npm
30
32
  package, and builds the same tools from the same catalog. No dependencies of its own; Python 3.10+.
31
33
 
32
34
  ```sh
33
- pip install "viasocket[langchain]" # pick your framework: [langchain], [crewai] or [llamaindex]
35
+ pip install "viasocket[langchain]" # pick your framework: [langchain], [crewai], [llamaindex] or [adk]
34
36
  ```
35
37
 
36
38
  The part in brackets installs that framework with the package. Plain `pip install viasocket` is enough when the
@@ -109,6 +111,22 @@ agent = FunctionAgent(
109
111
  )
110
112
  ```
111
113
 
114
+ ## Google ADK
115
+
116
+ ```python
117
+ from google.adk.agents import Agent
118
+ from viasocket.adk import viasocket_tools
119
+
120
+ root_agent = Agent(
121
+ model="gemini-flash-latest",
122
+ name="ops_agent",
123
+ instruction="Keep the team updated in Slack.",
124
+ tools=viasocket_tools(viasocket, user="user_123", apps=["slack"], actions={"slack": ["send-message"]}),
125
+ )
126
+ ```
127
+
128
+ Each tool hands the model the action's JSON Schema as its declaration and runs the call off the event loop.
129
+
112
130
  ## How the tools behave
113
131
 
114
132
  - **The user connects the app first**, in your product, through viaSocket's connect popup (see the
@@ -3,13 +3,13 @@
3
3
  Your own agent, acting in the apps each of your users connected through viaSocket: every action of
4
4
  an app is a tool, run on that user's own connection. Slack's Send Message, Google Sheets' Add New
5
5
  Row, HubSpot's Create Deal — any of 2,300+ apps, with no connector code and no OAuth on your side.
6
- Works with LangChain, CrewAI and LlamaIndex.
6
+ Works with LangChain, CrewAI, LlamaIndex and Google ADK.
7
7
 
8
8
  It is the Python side of the [`viasocket-apps`](https://www.npmjs.com/package/viasocket-apps) npm
9
9
  package, and builds the same tools from the same catalog. No dependencies of its own; Python 3.10+.
10
10
 
11
11
  ```sh
12
- pip install "viasocket[langchain]" # pick your framework: [langchain], [crewai] or [llamaindex]
12
+ pip install "viasocket[langchain]" # pick your framework: [langchain], [crewai], [llamaindex] or [adk]
13
13
  ```
14
14
 
15
15
  The part in brackets installs that framework with the package. Plain `pip install viasocket` is enough when the
@@ -88,6 +88,22 @@ agent = FunctionAgent(
88
88
  )
89
89
  ```
90
90
 
91
+ ## Google ADK
92
+
93
+ ```python
94
+ from google.adk.agents import Agent
95
+ from viasocket.adk import viasocket_tools
96
+
97
+ root_agent = Agent(
98
+ model="gemini-flash-latest",
99
+ name="ops_agent",
100
+ instruction="Keep the team updated in Slack.",
101
+ tools=viasocket_tools(viasocket, user="user_123", apps=["slack"], actions={"slack": ["send-message"]}),
102
+ )
103
+ ```
104
+
105
+ Each tool hands the model the action's JSON Schema as its declaration and runs the call off the event loop.
106
+
91
107
  ## How the tools behave
92
108
 
93
109
  - **The user connects the app first**, in your product, through viaSocket's connect popup (see the
@@ -11,7 +11,7 @@ license = "MIT"
11
11
  authors = [{ name = "Walkover Web Solution" }]
12
12
  requires-python = ">=3.10"
13
13
  dependencies = []
14
- keywords = ["viasocket", "integrations", "ai-agent", "langchain", "crewai", "llamaindex", "tools", "slack", "google-sheets"]
14
+ keywords = ["viasocket", "integrations", "ai-agent", "langchain", "crewai", "llamaindex", "google-adk", "tools", "slack", "google-sheets"]
15
15
  classifiers = [
16
16
  "Programming Language :: Python :: 3",
17
17
  "Operating System :: OS Independent",
@@ -21,6 +21,7 @@ classifiers = [
21
21
  langchain = ["langchain-core>=0.3"]
22
22
  crewai = ["crewai>=0.80"]
23
23
  llamaindex = ["llama-index-core>=0.12"]
24
+ adk = ["google-adk>=1.10"]
24
25
 
25
26
  [project.urls]
26
27
  Homepage = "https://github.com/Walkover-Web-Solution/viasocket-apps/tree/main/python#readme"
@@ -12,4 +12,4 @@ from ._agent_tools import AgentTool, action_input_schema, agent_tools
12
12
  from ._client import ViaSocket, ViaSocketError, sign_embed_token
13
13
 
14
14
  __all__ = ["ViaSocket", "ViaSocketError", "sign_embed_token", "AgentTool", "agent_tools", "action_input_schema"]
15
- __version__ = "0.1.2"
15
+ __version__ = "0.2.0"
@@ -0,0 +1,42 @@
1
+ """
2
+ viasocket.adk — the apps a user connected, as Google ADK tools.
3
+
4
+ from viasocket import ViaSocket
5
+ from viasocket.adk import viasocket_tools
6
+
7
+ tools = viasocket_tools(viasocket, user="user_123", apps=["slack"], actions={"slack": ["send-message"]})
8
+ root_agent = Agent(model="gemini-flash-latest", name="ops_agent", instruction="...", tools=tools)
9
+
10
+ Needs `google-adk` 1.10 or later: `pip install "viasocket[adk]"`.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import asyncio
16
+ from typing import Any, Dict, List, Optional
17
+
18
+ from google.adk.tools import BaseTool
19
+ from google.genai import types
20
+
21
+ from ._agent_tools import AgentTool, agent_tools
22
+ from ._client import ViaSocket
23
+
24
+
25
+ class ViaSocketTool(BaseTool):
26
+ """One viaSocket action. The model sees its JSON Schema as is; the call runs off the event loop."""
27
+
28
+ def __init__(self, tool: AgentTool):
29
+ super().__init__(name=tool.name, description=tool.description)
30
+ self._tool = tool
31
+
32
+ def _get_declaration(self) -> types.FunctionDeclaration:
33
+ return types.FunctionDeclaration(name=self.name, description=self.description, parameters_json_schema=self._tool.parameters)
34
+
35
+ async def run_async(self, *, args: Dict[str, Any], tool_context: Any) -> str:
36
+ # The client is blocking (urllib); a thread keeps the agent's event loop free.
37
+ return await asyncio.to_thread(self._tool.invoke, args or {})
38
+
39
+
40
+ def viasocket_tools(viasocket: ViaSocket, user: str, apps: List[str], actions: Optional[Dict[str, List[str]]] = None) -> List[ViaSocketTool]:
41
+ """One ADK tool per chosen action; each runs on the user's own connection to the app."""
42
+ return [ViaSocketTool(t) for t in agent_tools(viasocket, user, apps, actions)]
@@ -153,6 +153,21 @@ def test_llamaindex_tools():
153
153
  assert run_body(calls)["inputData"] == INPUT
154
154
 
155
155
 
156
+ def test_adk_tools():
157
+ pytest.importorskip("google.adk")
158
+ import asyncio
159
+
160
+ from viasocket.adk import viasocket_tools
161
+
162
+ viasocket, calls = make_client([ENABLED_SLACK])
163
+ send, _ = viasocket_tools(viasocket, "user_123", ["slack"])
164
+ declaration = send._get_declaration()
165
+ assert declaration.name == "slack_send-message"
166
+ assert declaration.parameters_json_schema["required"] == ["text"]
167
+ assert asyncio.run(send.run_async(args=INPUT, tool_context=None)) == '{"ok": true}'
168
+ assert run_body(calls)["inputData"] == INPUT
169
+
170
+
156
171
  def test_crewai_tools():
157
172
  pytest.importorskip("crewai")
158
173
  from viasocket.crewai import viasocket_tools
File without changes
File without changes