signalwire-agents 0.1.23__py3-none-any.whl → 0.1.24__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.
Files changed (64) hide show
  1. signalwire_agents/__init__.py +1 -1
  2. signalwire_agents/agent_server.py +2 -1
  3. signalwire_agents/cli/config.py +61 -0
  4. signalwire_agents/cli/core/__init__.py +1 -0
  5. signalwire_agents/cli/core/agent_loader.py +254 -0
  6. signalwire_agents/cli/core/argparse_helpers.py +164 -0
  7. signalwire_agents/cli/core/dynamic_config.py +62 -0
  8. signalwire_agents/cli/execution/__init__.py +1 -0
  9. signalwire_agents/cli/execution/datamap_exec.py +437 -0
  10. signalwire_agents/cli/execution/webhook_exec.py +125 -0
  11. signalwire_agents/cli/output/__init__.py +1 -0
  12. signalwire_agents/cli/output/output_formatter.py +132 -0
  13. signalwire_agents/cli/output/swml_dump.py +177 -0
  14. signalwire_agents/cli/simulation/__init__.py +1 -0
  15. signalwire_agents/cli/simulation/data_generation.py +365 -0
  16. signalwire_agents/cli/simulation/data_overrides.py +187 -0
  17. signalwire_agents/cli/simulation/mock_env.py +271 -0
  18. signalwire_agents/cli/test_swaig.py +522 -2539
  19. signalwire_agents/cli/types.py +72 -0
  20. signalwire_agents/core/agent/__init__.py +1 -3
  21. signalwire_agents/core/agent/config/__init__.py +1 -3
  22. signalwire_agents/core/agent/prompt/manager.py +25 -7
  23. signalwire_agents/core/agent/tools/decorator.py +2 -0
  24. signalwire_agents/core/agent/tools/registry.py +8 -0
  25. signalwire_agents/core/agent_base.py +492 -3053
  26. signalwire_agents/core/function_result.py +31 -42
  27. signalwire_agents/core/mixins/__init__.py +28 -0
  28. signalwire_agents/core/mixins/ai_config_mixin.py +373 -0
  29. signalwire_agents/core/mixins/auth_mixin.py +287 -0
  30. signalwire_agents/core/mixins/prompt_mixin.py +345 -0
  31. signalwire_agents/core/mixins/serverless_mixin.py +368 -0
  32. signalwire_agents/core/mixins/skill_mixin.py +55 -0
  33. signalwire_agents/core/mixins/state_mixin.py +219 -0
  34. signalwire_agents/core/mixins/tool_mixin.py +295 -0
  35. signalwire_agents/core/mixins/web_mixin.py +1130 -0
  36. signalwire_agents/core/skill_manager.py +3 -1
  37. signalwire_agents/core/swaig_function.py +10 -1
  38. signalwire_agents/core/swml_service.py +140 -58
  39. signalwire_agents/skills/README.md +452 -0
  40. signalwire_agents/skills/api_ninjas_trivia/README.md +215 -0
  41. signalwire_agents/skills/datasphere/README.md +210 -0
  42. signalwire_agents/skills/datasphere_serverless/README.md +258 -0
  43. signalwire_agents/skills/datetime/README.md +132 -0
  44. signalwire_agents/skills/joke/README.md +149 -0
  45. signalwire_agents/skills/math/README.md +161 -0
  46. signalwire_agents/skills/native_vector_search/skill.py +33 -13
  47. signalwire_agents/skills/play_background_file/README.md +218 -0
  48. signalwire_agents/skills/spider/README.md +236 -0
  49. signalwire_agents/skills/spider/__init__.py +4 -0
  50. signalwire_agents/skills/spider/skill.py +479 -0
  51. signalwire_agents/skills/swml_transfer/README.md +395 -0
  52. signalwire_agents/skills/swml_transfer/__init__.py +1 -0
  53. signalwire_agents/skills/swml_transfer/skill.py +257 -0
  54. signalwire_agents/skills/weather_api/README.md +178 -0
  55. signalwire_agents/skills/web_search/README.md +163 -0
  56. signalwire_agents/skills/wikipedia_search/README.md +228 -0
  57. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.24.dist-info}/METADATA +47 -2
  58. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.24.dist-info}/RECORD +62 -22
  59. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.24.dist-info}/entry_points.txt +1 -1
  60. signalwire_agents/core/agent/config/ephemeral.py +0 -176
  61. signalwire_agents-0.1.23.data/data/schema.json +0 -5611
  62. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.24.dist-info}/WHEEL +0 -0
  63. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.24.dist-info}/licenses/LICENSE +0 -0
  64. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.24.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Type definitions for the CLI tools
4
+ """
5
+
6
+ from typing import TypedDict, Dict, Any, Optional, List, Union
7
+
8
+
9
+ class CallData(TypedDict, total=False):
10
+ """Call data structure for SWML post_data"""
11
+ id: str
12
+ node_id: str
13
+ state: str
14
+ type: str
15
+ direction: str
16
+ project_id: str
17
+ space_id: str
18
+ from_number: str
19
+ to_number: str
20
+ from_: str
21
+ to: str
22
+ from_name: str
23
+ headers: Dict[str, str]
24
+ timeout: int
25
+ tag: str
26
+
27
+
28
+ class VarsData(TypedDict, total=False):
29
+ """Variables data structure for SWML post_data"""
30
+ userVariables: Dict[str, Any]
31
+ environment: str
32
+ call_data: Dict[str, Any]
33
+
34
+
35
+ class PostData(TypedDict, total=False):
36
+ """Complete post_data structure for SWML requests"""
37
+ call_id: str
38
+ call: CallData
39
+ vars: VarsData
40
+ params: Dict[str, Any]
41
+ project_id: str
42
+ space_id: str
43
+ meta_data: Dict[str, Any]
44
+ post_prompt_data: Dict[str, Any]
45
+ error: Optional[str]
46
+ protocol_error: Optional[bool]
47
+ parse_error: Optional[bool]
48
+
49
+
50
+ class DataMapConfig(TypedDict, total=False):
51
+ """DataMap function configuration"""
52
+ function: str
53
+ data_map: Dict[str, Any]
54
+ description: str
55
+ parameters: Dict[str, Any]
56
+
57
+
58
+ class AgentInfo(TypedDict):
59
+ """Information about a discovered agent"""
60
+ class_name: str
61
+ file_path: str
62
+ is_instance: bool
63
+ instance_name: Optional[str]
64
+
65
+
66
+ class FunctionInfo(TypedDict):
67
+ """Information about a SWAIG function"""
68
+ name: str
69
+ description: str
70
+ parameters: Dict[str, Any]
71
+ type: str # 'local', 'external', 'datamap'
72
+ webhook_url: Optional[str]
@@ -9,6 +9,4 @@ See LICENSE file in the project root for full license information.
9
9
 
10
10
  """Agent refactored components."""
11
11
 
12
- from .config.ephemeral import EphemeralAgentConfig
13
-
14
- __all__ = ['EphemeralAgentConfig']
12
+ __all__ = []
@@ -9,6 +9,4 @@ See LICENSE file in the project root for full license information.
9
9
 
10
10
  """Configuration management modules."""
11
11
 
12
- from .ephemeral import EphemeralAgentConfig
13
-
14
- __all__ = ['EphemeralAgentConfig']
12
+ __all__ = []
@@ -192,12 +192,29 @@ class PromptManager:
192
192
  bullets: Optional list of bullet points to add
193
193
  """
194
194
  if self.agent._use_pom and self.agent.pom:
195
- self.agent.pom.add_to_section(
196
- title=title,
197
- body=body,
198
- bullet=bullet,
199
- bullets=bullets
200
- )
195
+ # Find the section first
196
+ section = self.agent.pom.find_section(title)
197
+
198
+ if section is None:
199
+ # Section doesn't exist, create it
200
+ section = self.agent.pom.add_section(title=title)
201
+
202
+ # Add content to the section
203
+ if body:
204
+ if section.body:
205
+ section.body = f"{section.body}\n\n{body}"
206
+ else:
207
+ section.body = body
208
+
209
+ # Process bullets
210
+ bullets_to_add = []
211
+ if bullet:
212
+ bullets_to_add.append(bullet)
213
+ if bullets:
214
+ bullets_to_add.extend(bullets)
215
+
216
+ if bullets_to_add:
217
+ section.add_bullets(bullets_to_add)
201
218
 
202
219
  def prompt_add_subsection(
203
220
  self,
@@ -248,7 +265,8 @@ class PromptManager:
248
265
  True if section exists, False otherwise
249
266
  """
250
267
  if self.agent._use_pom and self.agent.pom:
251
- return self.agent.pom.has_section(title)
268
+ # Use find_section method from POM
269
+ return self.agent.pom.find_section(title) is not None
252
270
  return False
253
271
 
254
272
  def get_prompt(self) -> Optional[Union[str, List[Dict[str, Any]]]]:
@@ -50,6 +50,7 @@ class ToolDecorator:
50
50
  secure = kwargs.pop("secure", True)
51
51
  fillers = kwargs.pop("fillers", None)
52
52
  webhook_url = kwargs.pop("webhook_url", None)
53
+ required = kwargs.pop("required", None)
53
54
 
54
55
  registry.define_tool(
55
56
  name=name,
@@ -59,6 +60,7 @@ class ToolDecorator:
59
60
  secure=secure,
60
61
  fillers=fillers,
61
62
  webhook_url=webhook_url,
63
+ required=required,
62
64
  **kwargs # Pass through any additional swaig_fields
63
65
  )
64
66
  return func
@@ -41,6 +41,7 @@ class ToolRegistry:
41
41
  secure: bool = True,
42
42
  fillers: Optional[Dict[str, List[str]]] = None,
43
43
  webhook_url: Optional[str] = None,
44
+ required: Optional[List[str]] = None,
44
45
  **swaig_fields
45
46
  ) -> None:
46
47
  """
@@ -54,6 +55,7 @@ class ToolRegistry:
54
55
  secure: Whether to require token validation
55
56
  fillers: Optional dict mapping language codes to arrays of filler phrases
56
57
  webhook_url: Optional external webhook URL to use instead of local handling
58
+ required: Optional list of required parameter names
57
59
  **swaig_fields: Additional SWAIG fields to include in function definition
58
60
 
59
61
  Raises:
@@ -70,6 +72,7 @@ class ToolRegistry:
70
72
  secure=secure,
71
73
  fillers=fillers,
72
74
  webhook_url=webhook_url,
75
+ required=required,
73
76
  **swaig_fields
74
77
  )
75
78
 
@@ -96,6 +99,9 @@ class ToolRegistry:
96
99
  # These don't have handlers since they execute on SignalWire's server
97
100
  self._swaig_functions[function_name] = function_dict
98
101
 
102
+ # Debug logging using the module logger with proper format
103
+ logger.debug(f"Registered SWAIG function in registry: {function_name} (registry_id={id(self)}, agent_id={id(self.agent) if hasattr(self, 'agent') else None}, total_functions={len(self._swaig_functions)})")
104
+
99
105
  logger.debug(f"Registered SWAIG function: {function_name}")
100
106
 
101
107
  def register_class_decorated_tools(self) -> None:
@@ -127,6 +133,7 @@ class ToolRegistry:
127
133
  secure = tool_params_copy.pop("secure", True)
128
134
  fillers = tool_params_copy.pop("fillers", None)
129
135
  webhook_url = tool_params_copy.pop("webhook_url", None)
136
+ required = tool_params_copy.pop("required", None)
130
137
 
131
138
  # Register the tool with any remaining params as swaig_fields
132
139
  self.define_tool(
@@ -137,6 +144,7 @@ class ToolRegistry:
137
144
  secure=secure,
138
145
  fillers=fillers,
139
146
  webhook_url=webhook_url,
147
+ required=required,
140
148
  **tool_params_copy # Pass through any additional swaig_fields
141
149
  )
142
150