agentic-fabriq-sdk 0.1.21__py3-none-any.whl → 0.1.23__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.

Potentially problematic release.


This version of agentic-fabriq-sdk might be problematic. Click here for more details.

af_cli/commands/tools.py CHANGED
@@ -197,7 +197,7 @@ def add(
197
197
  tool: str = typer.Argument(..., help="Tool name (google_drive, google_slides, slack, notion, github, etc.)"),
198
198
  connection_id: str = typer.Option(..., "--connection-id", help="Unique connection ID"),
199
199
  display_name: str = typer.Option(None, "--display-name", help="Human-readable name"),
200
- method: str = typer.Option(..., "--method", help="Connection method: 'api_credentials' or 'oauth'"),
200
+ method: str = typer.Option(..., "--method", help="Connection method: 'api_credentials', 'oauth3' (Google platform OAuth), or 'oauth'"),
201
201
 
202
202
  # API credentials method fields (can be either a token OR client_id/secret)
203
203
  token: str = typer.Option(None, "--token", help="API token (for simple token-based auth like Notion, Slack bot)"),
@@ -212,7 +212,10 @@ def add(
212
212
  # Notion (api_credentials method - single token)
213
213
  afctl tools add notion --connection-id notion-work --method api_credentials --token "secret_abc123"
214
214
 
215
- # Google (api_credentials method - OAuth app)
215
+ # Google (oauth3 method - uses platform OAuth, no credentials needed)
216
+ afctl tools add google_drive --connection-id google-work --method oauth3
217
+
218
+ # Google (api_credentials method - your own OAuth app)
216
219
  afctl tools add google_drive --connection-id google-work --method api_credentials \\
217
220
  --client-id "123.apps.googleusercontent.com" \\
218
221
  --client-secret "GOCSPX-abc123"
@@ -247,10 +250,17 @@ def add(
247
250
  raise typer.Exit(1)
248
251
 
249
252
  # Validate method
250
- if method not in ["api_credentials", "oauth"]:
251
- error("Method must be 'api_credentials' or 'oauth'")
253
+ if method not in ["api_credentials", "oauth3", "oauth"]:
254
+ error("Method must be 'api_credentials', 'oauth3', or 'oauth'")
252
255
  raise typer.Exit(1)
253
256
 
257
+ # Validate oauth3 method is only for Google tools
258
+ if method == "oauth3":
259
+ if not (tool.startswith("google_") or tool == "gmail"):
260
+ error("oauth3 method is only available for Google Workspace tools")
261
+ info("For other tools, use 'api_credentials' method")
262
+ raise typer.Exit(1)
263
+
254
264
  # Validate api_credentials method requirements
255
265
  if method == "api_credentials":
256
266
  # Must have either token OR (client_id + client_secret)
@@ -282,8 +292,14 @@ def add(
282
292
  client.post("/api/v1/user-connections", data=connection_data)
283
293
  success(f"✅ Connection entry created: {connection_id}")
284
294
 
285
- # Step 2: Store credentials based on what was provided
286
- if method == "api_credentials":
295
+ # Step 2: Store credentials based on method
296
+ if method == "oauth3":
297
+ # OAuth3 uses platform credentials - no need to store user credentials
298
+ success("✅ Connection configured with platform OAuth")
299
+ info("")
300
+ info(f"Next: Run 'afctl tools connect {connection_id}' to authenticate with your Google account")
301
+
302
+ elif method == "api_credentials":
287
303
  # Determine the API base tool name (Google tools all use "google")
288
304
  api_tool_name = "google" if (tool.startswith("google_") or tool == "gmail") else tool
289
305
 
@@ -393,8 +409,11 @@ def connect(
393
409
  # For Google tools, pass the specific tool_type parameter
394
410
  tool_type_param = f"&tool_type={tool}" if tool != api_tool_name else ""
395
411
 
412
+ # For oauth3 method, pass the method parameter to use platform credentials
413
+ method_param = f"&method={method}" if method == "oauth3" else ""
414
+
396
415
  result = client.post(
397
- f"/api/v1/tools/{api_tool_name}/connect/initiate?connection_id={connection_id}{tool_type_param}",
416
+ f"/api/v1/tools/{api_tool_name}/connect/initiate?connection_id={connection_id}{tool_type_param}{method_param}",
398
417
  data={}
399
418
  )
400
419
 
@@ -51,7 +51,7 @@ async def get_application_client(
51
51
 
52
52
  Example:
53
53
  >>> client = await get_application_client("my-slack-bot")
54
- >>> result = await client.invoke_tool("slack-uuid", "post_message", {...})
54
+ >>> result = await client.invoke_connection("my-slack", method="post_message", parameters={...})
55
55
  """
56
56
  # 1. Load application config
57
57
  try:
af_sdk/fabriq_client.py CHANGED
@@ -78,85 +78,6 @@ class FabriqClient:
78
78
  r = await self._http.get("/tools", params=params, headers=self._extra_headers)
79
79
  return r.json()
80
80
 
81
- async def invoke_tool(
82
- self,
83
- tool_identifier: str,
84
- *,
85
- method: str,
86
- parameters: Optional[Dict[str, Any]] = None,
87
- context: Optional[Dict[str, Any]] = None,
88
- connection_id: Optional[str] = None,
89
- ) -> Dict[str, Any]:
90
- """Invoke a tool by name or UUID.
91
-
92
- Args:
93
- tool_identifier: Tool name (e.g., 'slack') or UUID
94
- method: Method name to invoke
95
- parameters: Method parameters
96
- context: Additional context
97
- connection_id: Specific connection ID to use (for multi-connection tools)
98
-
99
- Returns:
100
- Tool invocation result
101
-
102
- Examples:
103
- result = await client.invoke_tool("slack", method="get_channels")
104
- result = await client.invoke_tool("slack", method="post_message",
105
- parameters={"channel": "test", "text": "Hello!"})
106
- result = await client.invoke_tool("slack", method="get_channels",
107
- connection_id="slacker")
108
- """
109
- # Try to resolve tool name to UUID if not already a UUID
110
- tool_id = tool_identifier
111
- try:
112
- from uuid import UUID
113
- UUID(tool_identifier)
114
- # It's already a UUID, use it directly
115
- except ValueError:
116
- # Not a UUID, try to look up by name
117
- try:
118
- tools_response = await self.list_tools()
119
- except Exception as e:
120
- raise ValueError(f"Failed to list tools for name resolution: {e}. Please use UUID directly.")
121
-
122
- # Handle different response formats
123
- if isinstance(tools_response, dict) and "tools" in tools_response:
124
- tools = tools_response["tools"]
125
- elif isinstance(tools_response, dict) and "items" in tools_response:
126
- tools = tools_response["items"]
127
- elif hasattr(tools_response, '__iter__') and not isinstance(tools_response, (str, dict)):
128
- tools = list(tools_response)
129
- else:
130
- tools = []
131
-
132
- # Find tool by name (case-insensitive)
133
- matching_tools = [t for t in tools if isinstance(t, dict) and t.get("name", "").lower() == tool_identifier.lower()]
134
-
135
- if not matching_tools:
136
- available = [t.get('name') for t in tools if isinstance(t, dict) and t.get('name')]
137
- raise ValueError(f"Tool '{tool_identifier}' not found. Available tools: {available}")
138
-
139
- if len(matching_tools) > 1:
140
- raise ValueError(f"Multiple tools found with name '{tool_identifier}'. Please use UUID instead.")
141
-
142
- tool_id = matching_tools[0].get("id")
143
- if not tool_id:
144
- raise ValueError(f"Tool '{tool_identifier}' found but has no ID")
145
-
146
- body = {"method": method}
147
- if parameters is not None:
148
- body["parameters"] = parameters
149
-
150
- # Add connection_id to context if provided
151
- if context is not None or connection_id is not None:
152
- ctx = (context or {}).copy()
153
- if connection_id is not None:
154
- ctx["connection_id"] = connection_id
155
- body["context"] = ctx
156
-
157
- r = await self._http.post(f"/tools/{tool_id}/invoke", json=body, headers=self._extra_headers)
158
- return r.json()
159
-
160
81
  async def invoke_connection(
161
82
  self,
162
83
  connection_id: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentic-fabriq-sdk
3
- Version: 0.1.21
3
+ Version: 0.1.23
4
4
  Summary: Agentic Fabriq SDK: high-level client, CLI tool, DX helpers, and auth for AI agents
5
5
  License: Apache-2.0
6
6
  Keywords: fabriq,agentic-fabriq,sdk,ai,agents,agentic,fabric,cli
@@ -88,12 +88,12 @@ async def main():
88
88
  tools = await af.list_tools()
89
89
  agents = await af.list_agents()
90
90
 
91
- # Invoke tools by name (easier!)
92
- result = await af.invoke_tool("slack", method="get_channels")
91
+ # Invoke tools using connection ID
92
+ result = await af.invoke_connection("my-slack", method="get_channels")
93
93
 
94
94
  # Or post a message
95
- await af.invoke_tool(
96
- "slack",
95
+ await af.invoke_connection(
96
+ "my-slack",
97
97
  method="post_message",
98
98
  parameters={"channel": "test", "text": "Hello from SDK!"}
99
99
  )
@@ -5,7 +5,7 @@ af_cli/commands/auth.py,sha256=gz7DLiTTV0nv2DnKaa7_9nLHevCWslG54rRKRA1alx0,11967
5
5
  af_cli/commands/config.py,sha256=_k4ixGZfa7Yl_yUL-W1jeMQzykFcPcbw20Yr1v6_ShM,2748
6
6
  af_cli/commands/mcp_servers.py,sha256=1hEb4tX80dYb-j_2Z3gDud_v1FcMxl83syJ2N2eLWzI,2390
7
7
  af_cli/commands/secrets.py,sha256=z_rHfn8-KEonTC5dioBgH7sc1ppMOltFVFz-58Nqwa0,3436
8
- af_cli/commands/tools.py,sha256=2D8b6WwgKflk6JOoRxi-1j9k08mwLNeKlaUU8eOqPxs,24525
8
+ af_cli/commands/tools.py,sha256=2ulB-UMvjNujHOpu2GowLivEFvUq41ftDj04QUUd8H0,25665
9
9
  af_cli/core/__init__.py,sha256=cQ0H7rGfaMISQPhoNe4Xfu_EKU2TqRVt2OMI7tPea5U,51
10
10
  af_cli/core/client.py,sha256=AYNWdCMNtDx7LOGXwoS7_rruss479T0lD6PZ1hG5dMA,5082
11
11
  af_cli/core/config.py,sha256=fwLUF0blNII2RKdFlJ3Hat51vwwNyxpIkU_HvViz8To,8538
@@ -15,7 +15,7 @@ af_cli/core/token_storage.py,sha256=WhOQLx5_9pn2lAlFX01Y5DmWO7B9BJYfEkASCsBQwaI,
15
15
  af_cli/main.py,sha256=zFbbUhgmpGRp9VBGOyzSIK4NlguGsBI_SqZchyOu5Xc,5100
16
16
  af_sdk/__init__.py,sha256=uKLl3Sqlg_TgmGZtI0Tt14JNXIhdHSb6dplw6acBDvU,1569
17
17
  af_sdk/auth/__init__.py,sha256=laIiIwgxy0mEgRoXEakoEs7BuUYnyrlzHJbdf8Sqa5E,1137
18
- af_sdk/auth/applications.py,sha256=tJ4UMvCJF73i55_4uqsBM04GxDHk5X0SQRWdHVJDcNM,7452
18
+ af_sdk/auth/applications.py,sha256=Tc5j47S5WWGFPOhsjEI40SZuCd5ynzzAohy1NS0DyAM,7474
19
19
  af_sdk/auth/dpop.py,sha256=s0uiyxxuzsVQNtSexji1htJoxrALwlf1P9507xa-M3Y,1285
20
20
  af_sdk/auth/oauth.py,sha256=WRTrrBzs9ieiNnWfxagP6Ag4oI9k0soYjEkjfS2y5Lg,8120
21
21
  af_sdk/auth/token_cache.py,sha256=X36E6K0lWqMAqlJXC3i343y8oy-uFm1q-FEdVKXdL1Y,11300
@@ -27,7 +27,7 @@ af_sdk/dx/decorators.py,sha256=o_EmvE_8pp2vTgMJMgfTy5SXG_24yabuKdoytah02Hk,1294
27
27
  af_sdk/dx/runtime.py,sha256=5oowtdWtTr12odBz6pXKexSVKf2smfQDw71-jBDKr8A,2471
28
28
  af_sdk/events.py,sha256=onz1wWwATpm71HFfcEJLhvXBDSmE0M9RC92lMS-Sd3k,22609
29
29
  af_sdk/exceptions.py,sha256=ZVjjBeq17CGK69N2OTkVTjPXqXSI_gA7cZk9rCvARcI,4381
30
- af_sdk/fabriq_client.py,sha256=28N7EdrwbF7KQLlAZd71J_fMm3tpBOykOjOJYgVfLtc,11068
30
+ af_sdk/fabriq_client.py,sha256=lDrMl1tx0mRzBjQte_loVosOadWOgREy_2iVVv0x2ko,7576
31
31
  af_sdk/models/__init__.py,sha256=nSjgNEyYILZ6WIQF-oG5IT0CWV7JGuE0xNLw8sHPshM,707
32
32
  af_sdk/models/audit.py,sha256=_wRahNV7M7ftc2AHFf7J3WzIJ5cUyZhFn_lZX9NITp8,1476
33
33
  af_sdk/models/types.py,sha256=DPrl7XuFSYRrc8el8OX-ZNcZrIZwl8rTR9cH01uZFaU,5106
@@ -35,7 +35,7 @@ af_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  af_sdk/transport/__init__.py,sha256=HsOc6MmlxIS-PSYC_-6E36-dZYyT_auZeoXvGzVAqeg,104
36
36
  af_sdk/transport/http.py,sha256=QB3eqQbwug95QHf5PG_714NKtlTjV9PzVTo8izJCylc,13203
37
37
  af_sdk/vault.py,sha256=QVNGigIw8ND5sVXt05gvUY222b5-i9EbzLWNsDGdOU4,17926
38
- agentic_fabriq_sdk-0.1.21.dist-info/METADATA,sha256=AuB5Bzkt-Wr_qpH3UC38whJ0LYI0axMQ_e00IXqCc2A,3658
39
- agentic_fabriq_sdk-0.1.21.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
40
- agentic_fabriq_sdk-0.1.21.dist-info/entry_points.txt,sha256=XUO2EaJhUtUS5pwVIkhemC-nEeFbKgXXLW97gQCCGm8,41
41
- agentic_fabriq_sdk-0.1.21.dist-info/RECORD,,
38
+ agentic_fabriq_sdk-0.1.23.dist-info/METADATA,sha256=2pgcbX9ATNcVI6f6i_OziKFUTpK_ypzwyFlC0fct2-c,3678
39
+ agentic_fabriq_sdk-0.1.23.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
40
+ agentic_fabriq_sdk-0.1.23.dist-info/entry_points.txt,sha256=XUO2EaJhUtUS5pwVIkhemC-nEeFbKgXXLW97gQCCGm8,41
41
+ agentic_fabriq_sdk-0.1.23.dist-info/RECORD,,