agent-handler-sdk 0.1.2__tar.gz → 0.1.3__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.

Potentially problematic release.


This version of agent-handler-sdk might be problematic. Click here for more details.

Files changed (18) hide show
  1. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/PKG-INFO +1 -1
  2. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/__init__.py +2 -0
  3. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/auth.py +9 -5
  4. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/cli.py +13 -21
  5. agent_handler_sdk-0.1.3/agent_handler_sdk/templates/connector/metadata.yaml.tpl +3 -0
  6. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/pyproject.toml +1 -1
  7. agent_handler_sdk-0.1.2/agent_handler_sdk/templates/connector/metadata.yaml.tpl +0 -0
  8. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/connector.py +0 -0
  9. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/exceptions.py +0 -0
  10. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/invocation.py +0 -0
  11. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/registry.py +0 -0
  12. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/templates/connector/README.md.tpl +0 -0
  13. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/templates/connector/handlers.py.tpl +0 -0
  14. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/templates/connector/init.py.tpl +0 -0
  15. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/templates/connector/pyproject.toml.tpl +0 -0
  16. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/templates/connector/test_handlers.py.tpl +0 -0
  17. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/tool.py +0 -0
  18. {agent_handler_sdk-0.1.2 → agent_handler_sdk-0.1.3}/agent_handler_sdk/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: agent-handler-sdk
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Agent Handler SDK for defining and invoking LLM tools
5
5
  Author: David Dalmaso
6
6
  Author-email: david.dalmaso@merge.dev
@@ -1 +1,3 @@
1
1
  # agent_handler_sdk package root
2
+
3
+ __version__ = "0.1.3"
@@ -1,15 +1,19 @@
1
1
  # agent_handler_sdk/auth.py
2
2
 
3
+ from typing import Optional
4
+
5
+
3
6
  class AuthContext:
4
7
  """
5
8
  Auth context for tool execution that provides secure access to secrets.
6
-
9
+
7
10
  This class provides an isolated container for secrets during tool execution.
8
11
  Each tool execution should receive its own instance.
9
12
  """
10
- def __init__(self, secrets=None):
13
+
14
+ def __init__(self, secrets: Optional[dict[str, str]] = None):
11
15
  self._secrets = secrets or {}
12
-
13
- def get(self, key, default=None):
16
+
17
+ def get(self, key: str, default: Optional[str] = None) -> Optional[str]:
14
18
  """Get a secret value by key"""
15
- return self._secrets.get(key, default)
19
+ return self._secrets.get(key, default)
@@ -1,25 +1,15 @@
1
1
  import sys
2
2
  from pathlib import Path
3
- from typing import Dict, Any
3
+ from typing import Any
4
4
  import importlib.resources as pkg_resources
5
-
6
- try:
7
- # Python 3.11+
8
- import tomllib as toml # type: ignore
9
- except ImportError:
10
- # For older versions
11
- import tomli as toml
5
+ from agent_handler_sdk import __version__ as sdk_version
12
6
 
13
7
  # Use str() to convert Traversable to string path
14
8
  TEMPLATE_DIR = Path(str(pkg_resources.files("agent_handler_sdk"))) / "templates" / "connector"
15
- SDK_ROOT = Path(__file__).parent.parent # adjust if your structure is different
16
9
 
17
10
 
18
11
  def get_sdk_version() -> str:
19
- pyproject = SDK_ROOT / "pyproject.toml"
20
- data = toml.loads(pyproject.read_text(encoding="utf-8"))
21
- # if you use Poetry format:
22
- return str(data["tool"]["poetry"]["version"])
12
+ return sdk_version
23
13
 
24
14
 
25
15
  def render_template(filename: str, **context: Any) -> str:
@@ -34,13 +24,13 @@ def render_template(filename: str, **context: Any) -> str:
34
24
 
35
25
  def scaffold_connector() -> int:
36
26
  """
37
- Usage: ahs-scaffold <connector-name> [--target-dir <dir>]
27
+ Usage: ahs-scaffold <slug> [--target-dir <dir>]
38
28
 
39
29
  Creates:
40
- <target-dir>/connectors/<name>/
30
+ <target-dir>/connectors/<slug>/
41
31
  pyproject.toml
42
32
  metadata.yaml
43
- <name>_connector/
33
+ <slug>_connector/
44
34
  __init__.py
45
35
  tools/
46
36
  handlers.py
@@ -52,7 +42,9 @@ def scaffold_connector() -> int:
52
42
  print(scaffold_connector.__doc__)
53
43
  sys.exit(1)
54
44
 
55
- name = args[0]
45
+ slug = args[0]
46
+ # Generate human-readable name by replacing hyphens with spaces and capitalizing words
47
+ human_readable_name = " ".join(word.capitalize() for word in slug.replace("-", " ").split())
56
48
  target = Path(".")
57
49
  if "--target-dir" in args:
58
50
  idx = args.index("--target-dir")
@@ -60,8 +52,8 @@ def scaffold_connector() -> int:
60
52
 
61
53
  version = get_sdk_version()
62
54
 
63
- base = target / "connectors" / name
64
- pkg_dir = base / f"{name}_connector"
55
+ base = target / "connectors" / slug
56
+ pkg_dir = base / f"{slug}_connector"
65
57
  tools_dir = pkg_dir / "tools"
66
58
  tests_dir = base / "tests"
67
59
 
@@ -81,8 +73,8 @@ def scaffold_connector() -> int:
81
73
 
82
74
  # Render each template with both name & version
83
75
  for tpl_name, out_path in files_to_render.items():
84
- content = render_template(tpl_name, name=name, version=version)
76
+ content = render_template(tpl_name, name=slug, version=version, human_readable_name=human_readable_name)
85
77
  out_path.write_text(content, encoding="utf-8")
86
78
 
87
- print(f"Scaffolded connector '{name}' (SDK v{version}) at {base}")
79
+ print(f"Scaffolded connector '{slug}' (SDK v{version}) at {base}")
88
80
  return 0
@@ -0,0 +1,3 @@
1
+ name: {human_readable_name}
2
+ description: Basic {human_readable_name} connector for Agent Handler
3
+ logo_url: https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_aad4de182d7a6a195c9a7a11a375e75c/merge.png
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "agent-handler-sdk"
3
- version = "0.1.2"
3
+ version = "0.1.3"
4
4
  description = "Agent Handler SDK for defining and invoking LLM tools"
5
5
  authors = ["David Dalmaso <david.dalmaso@merge.dev>"]
6
6
  packages = [