signalwire-agents 0.1.41__py3-none-any.whl → 0.1.43__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.
@@ -18,7 +18,7 @@ A package for building AI agents using SignalWire's AI and SWML capabilities.
18
18
  from .core.logging_config import configure_logging
19
19
  configure_logging()
20
20
 
21
- __version__ = "0.1.41"
21
+ __version__ = "0.1.43"
22
22
 
23
23
  # Import core classes for easier access
24
24
  from .core.agent_base import AgentBase
@@ -231,7 +231,19 @@ def format_result(result: Any) -> str:
231
231
  from signalwire_agents.core.function_result import SwaigFunctionResult
232
232
 
233
233
  if isinstance(result, SwaigFunctionResult):
234
- return f"SwaigFunctionResult: {result.response}"
234
+ output = [f"SwaigFunctionResult: {result.response}"]
235
+
236
+ # Show actions if present
237
+ if hasattr(result, 'action') and result.action:
238
+ output.append("\nActions:")
239
+ for action in result.action:
240
+ output.append(json.dumps(action, indent=2))
241
+
242
+ # Show post_process flag if set
243
+ if hasattr(result, 'post_process') and result.post_process:
244
+ output.append(f"\nPost-process: {result.post_process}")
245
+
246
+ return "\n".join(output)
235
247
  elif isinstance(result, dict):
236
248
  if 'response' in result:
237
249
  return f"Response: {result['response']}"
@@ -1003,6 +1003,19 @@ class AgentBase(
1003
1003
  ephemeral_agent._global_data = copy.deepcopy(self._global_data)
1004
1004
  ephemeral_agent._function_includes = copy.deepcopy(self._function_includes)
1005
1005
 
1006
+ # Deep copy LLM parameters
1007
+ ephemeral_agent._prompt_llm_params = copy.deepcopy(self._prompt_llm_params)
1008
+ ephemeral_agent._post_prompt_llm_params = copy.deepcopy(self._post_prompt_llm_params)
1009
+
1010
+ # Copy internal fillers if they exist
1011
+ if hasattr(self, '_internal_fillers'):
1012
+ ephemeral_agent._internal_fillers = copy.deepcopy(self._internal_fillers)
1013
+
1014
+ # Copy contexts builder state if it exists
1015
+ if hasattr(self, '_contexts_builder'):
1016
+ ephemeral_agent._contexts_builder = copy.deepcopy(self._contexts_builder)
1017
+ ephemeral_agent._contexts_defined = self._contexts_defined
1018
+
1006
1019
  # Deep copy the POM object if it exists to prevent sharing prompt sections
1007
1020
  if hasattr(self, 'pom') and self.pom:
1008
1021
  ephemeral_agent.pom = copy.deepcopy(self.pom)
@@ -1020,9 +1033,12 @@ class AgentBase(
1020
1033
 
1021
1034
  # Create new prompt manager for the ephemeral agent
1022
1035
  ephemeral_agent._prompt_manager = PromptManager(ephemeral_agent)
1023
- # Copy the prompt sections data
1036
+ # Copy ALL PromptManager state
1024
1037
  if hasattr(self._prompt_manager, '_sections'):
1025
1038
  ephemeral_agent._prompt_manager._sections = copy.deepcopy(self._prompt_manager._sections)
1039
+ ephemeral_agent._prompt_manager._prompt_text = copy.deepcopy(self._prompt_manager._prompt_text)
1040
+ ephemeral_agent._prompt_manager._post_prompt_text = copy.deepcopy(self._prompt_manager._post_prompt_text)
1041
+ ephemeral_agent._prompt_manager._contexts = copy.deepcopy(self._prompt_manager._contexts)
1026
1042
 
1027
1043
  # Create new tool registry for the ephemeral agent
1028
1044
  ephemeral_agent._tool_registry = ToolRegistry(ephemeral_agent)
@@ -260,6 +260,87 @@ class SwaigFunctionResult:
260
260
  """
261
261
  return self.add_action("set_global_data", data)
262
262
 
263
+ def swml_user_event(self, event_data: Dict[str, Any]) -> 'SwaigFunctionResult':
264
+ """
265
+ Send a user event through SWML to update the client UI.
266
+
267
+ This is a convenience method for sending user events to connected clients,
268
+ commonly used for real-time UI updates in interactive applications.
269
+
270
+ Args:
271
+ event_data: Dictionary containing the event type and any associated data
272
+ Example: {"type": "cards_dealt", "player_hand": [...], "score": 21}
273
+
274
+ Returns:
275
+ Self for method chaining
276
+
277
+ Example:
278
+ result = (
279
+ SwaigFunctionResult("You have blackjack!")
280
+ .swml_user_event({
281
+ "type": "cards_dealt",
282
+ "player_hand": player_cards,
283
+ "dealer_hand": dealer_cards,
284
+ "player_score": 21
285
+ })
286
+ )
287
+ """
288
+ swml_action = {
289
+ "sections": {
290
+ "main": [{
291
+ "user_event": {
292
+ "event": event_data
293
+ }
294
+ }]
295
+ },
296
+ "version": "1.0.0"
297
+ }
298
+
299
+ return self.add_action("SWML", swml_action)
300
+
301
+ def swml_change_step(self, step_name: str) -> 'SwaigFunctionResult':
302
+ """
303
+ Change the conversation step in the AI agent's workflow.
304
+
305
+ This is a convenience method for transitioning between conversation steps,
306
+ allowing dynamic workflow control based on user interactions or game state.
307
+
308
+ Args:
309
+ step_name: Name of the step to transition to (e.g., "betting", "playing", "hand_complete")
310
+
311
+ Returns:
312
+ Self for method chaining
313
+
314
+ Example:
315
+ result = (
316
+ SwaigFunctionResult("Starting a new hand")
317
+ .swml_change_step("betting")
318
+ .swml_user_event({"type": "game_reset", "chips": 1000})
319
+ )
320
+ """
321
+ return self.add_action("change_step", step_name)
322
+
323
+ def swml_change_context(self, context_name: str) -> 'SwaigFunctionResult':
324
+ """
325
+ Change the conversation context in the AI agent's workflow.
326
+
327
+ This is a convenience method for switching between different conversation contexts,
328
+ useful for agents that handle multiple distinct workflows or service modes.
329
+
330
+ Args:
331
+ context_name: Name of the context to transition to (e.g., "support", "sales", "technical")
332
+
333
+ Returns:
334
+ Self for method chaining
335
+
336
+ Example:
337
+ result = (
338
+ SwaigFunctionResult("Transferring you to technical support")
339
+ .swml_change_context("technical_support")
340
+ )
341
+ """
342
+ return self.add_action("change_context", context_name)
343
+
263
344
  def execute_swml(self, swml_content, transfer: bool = False) -> 'SwaigFunctionResult':
264
345
  """
265
346
  Execute SWML content with optional transfer behavior.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: signalwire_agents
3
- Version: 0.1.41
3
+ Version: 0.1.43
4
4
  Summary: SignalWire AI Agents SDK
5
5
  Author-email: SignalWire Team <info@signalwire.com>
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- signalwire_agents/__init__.py,sha256=uDj3uxU03M4CPNIZpM1aMA6YjznCqg7RgauYNGuXC00,4923
1
+ signalwire_agents/__init__.py,sha256=JEGLCo_LLxcqdvVcd64XAfHEJ2pfoanrZ-AS_691Mqc,4923
2
2
  signalwire_agents/agent_server.py,sha256=x9HyWia8D3r6KMqY-Q4DtNVivfJWLTx8B-KzUI8okuA,26880
3
3
  signalwire_agents/schema.json,sha256=6-7ccbt39iM1CO36dOfvupRPfd0gnQ0XoAdyo-EFyjo,238042
4
4
  signalwire_agents/agents/bedrock.py,sha256=J582gooNtxtep4xdVOfyDzRtHp_XrurPMS93xf2Xod0,10836
@@ -17,19 +17,19 @@ signalwire_agents/cli/execution/__init__.py,sha256=GS9EkXJhhFQjn7NSmxM5JX1Iy7pm6
17
17
  signalwire_agents/cli/execution/datamap_exec.py,sha256=UNQ8gn1KW72YDjegY8SzeZWebZiD-DO6dRLkxia438k,20389
18
18
  signalwire_agents/cli/execution/webhook_exec.py,sha256=m4gIX-MaTG8JngI57qyeWGYDQJwkbJANpvkBwJeJ_7o,4710
19
19
  signalwire_agents/cli/output/__init__.py,sha256=aGBWE-xXbqsFi-cyD5MCs8v3chxirSxdDyDZTUWYJO4,234
20
- signalwire_agents/cli/output/output_formatter.py,sha256=tqblCJq29a7AwxrdwvpUuqIyNIiqi5uf0dvjwG57ta4,12210
20
+ signalwire_agents/cli/output/output_formatter.py,sha256=-RpT9TY7YT1DYBg75Ngf5j42hA6QM_lPAzwhFCiZYNE,12685
21
21
  signalwire_agents/cli/output/swml_dump.py,sha256=NP9MCFjZr4BOt3xUNlW8N9Bw8ZGAGAudYlaiUIrwRso,6606
22
22
  signalwire_agents/cli/simulation/__init__.py,sha256=YtfbBKujx8SjZqaOtMdgle8FvxzKeD8_pRzeD25ylsU,236
23
23
  signalwire_agents/cli/simulation/data_generation.py,sha256=pxa9aJ6XkI0O8yAIGvBTUU3eBVkJizNx9xW8mHEosTI,11918
24
24
  signalwire_agents/cli/simulation/data_overrides.py,sha256=3_3pT6j-q2gRufPX2bZ1BrmY7u1IdloLooKAJil33vI,6319
25
25
  signalwire_agents/cli/simulation/mock_env.py,sha256=fvaR_xdLMm8AbpNUbTJOFG9THcti3Zds-0QNDbKMaYk,10249
26
26
  signalwire_agents/core/__init__.py,sha256=xjPq8DmUnWYUG28sd17n430VWPmMH9oZ9W14gYwG96g,806
27
- signalwire_agents/core/agent_base.py,sha256=X0DBGRfjX8QCq5rs-gadFvQV6nkmOv2gIEdqfpkpkv0,47645
27
+ signalwire_agents/core/agent_base.py,sha256=Wy1xAyJgquI4Cabss1lddoNonJzOYeo3VtY9suEFDFA,48634
28
28
  signalwire_agents/core/auth_handler.py,sha256=jXrof9WZ1W9qqlQT9WElcmSRafL2kG7207x5SqWN9MU,8481
29
29
  signalwire_agents/core/config_loader.py,sha256=rStVRRUaeMGrMc44ocr0diMQQARZhbKqwMqQ6kqUNos,8722
30
30
  signalwire_agents/core/contexts.py,sha256=g9FgOGMfGCUWlm57YZcv7CvOf-Ub9FdKZIOMu14ADfE,24428
31
31
  signalwire_agents/core/data_map.py,sha256=0qp3VcrRS0RtZPApoAaGgM-udLBb1ysnyMJuWd6sSew,17134
32
- signalwire_agents/core/function_result.py,sha256=YfThOV2rdzOeZgB2szgKVEADJgxaKVE-1abkBOQyJLA,45167
32
+ signalwire_agents/core/function_result.py,sha256=4CcbxwstlSRUQtbCty2evewvNZP35dWUJunzz2YeYNI,48108
33
33
  signalwire_agents/core/logging_config.py,sha256=x4d_RAjBjVpJOFA2vXnPP2dNr13BZHz091J5rGpC77Y,13142
34
34
  signalwire_agents/core/pom_builder.py,sha256=ywuiIfP8BeLBPo_G4X1teZlG6zTCMkW71CZnmyoDTAQ,6636
35
35
  signalwire_agents/core/security_config.py,sha256=iAnAzKEJQiXL6mMpDaYm3Sjkxwm4x2N9HD6DeWSI8yI,12536
@@ -126,9 +126,9 @@ signalwire_agents/utils/pom_utils.py,sha256=4Mr7baQ_xR_hfJ72YxQRAT_GFa663YjFX_Pu
126
126
  signalwire_agents/utils/schema_utils.py,sha256=i4okv_O9bUApwT_jJf4Yoij3bLCrGrW3DC-vzSy2RuY,16392
127
127
  signalwire_agents/utils/token_generators.py,sha256=4Mr7baQ_xR_hfJ72YxQRAT_GFa663YjFX_PumJ35Xds,191
128
128
  signalwire_agents/utils/validators.py,sha256=4Mr7baQ_xR_hfJ72YxQRAT_GFa663YjFX_PumJ35Xds,191
129
- signalwire_agents-0.1.41.dist-info/licenses/LICENSE,sha256=NYvAsB-rTcSvG9cqHt9EUHAWLiA9YzM4Qfz-mPdvDR0,1067
130
- signalwire_agents-0.1.41.dist-info/METADATA,sha256=gGi67ryWFPXFDIy9H1ODLv47Kw-MaWg6l4VLwTBNN9w,41281
131
- signalwire_agents-0.1.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
132
- signalwire_agents-0.1.41.dist-info/entry_points.txt,sha256=ZDT65zfTO_YyDzi_hwQbCxIhrUfu_t8RpNXMMXlUPWI,144
133
- signalwire_agents-0.1.41.dist-info/top_level.txt,sha256=kDGS6ZYv84K9P5Kyg9_S8P_pbUXoHkso0On_DB5bbWc,18
134
- signalwire_agents-0.1.41.dist-info/RECORD,,
129
+ signalwire_agents-0.1.43.dist-info/licenses/LICENSE,sha256=NYvAsB-rTcSvG9cqHt9EUHAWLiA9YzM4Qfz-mPdvDR0,1067
130
+ signalwire_agents-0.1.43.dist-info/METADATA,sha256=kgPeaomBUFGZXUo9UcFBL9oRYI6taPxbbgJjgKIzxcI,41281
131
+ signalwire_agents-0.1.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
132
+ signalwire_agents-0.1.43.dist-info/entry_points.txt,sha256=ZDT65zfTO_YyDzi_hwQbCxIhrUfu_t8RpNXMMXlUPWI,144
133
+ signalwire_agents-0.1.43.dist-info/top_level.txt,sha256=kDGS6ZYv84K9P5Kyg9_S8P_pbUXoHkso0On_DB5bbWc,18
134
+ signalwire_agents-0.1.43.dist-info/RECORD,,