signalwire-agents 1.0.18__py3-none-any.whl → 1.0.18.dev8__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.
- signalwire_agents/__init__.py +1 -1
- signalwire_agents/agent_server.py +1 -1
- signalwire_agents/core/function_result.py +155 -1
- {signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/METADATA +1 -1
- {signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/RECORD +12 -12
- {signalwire_agents-1.0.18.data → signalwire_agents-1.0.18.dev8.data}/data/share/man/man1/sw-agent-init.1 +0 -0
- {signalwire_agents-1.0.18.data → signalwire_agents-1.0.18.dev8.data}/data/share/man/man1/sw-search.1 +0 -0
- {signalwire_agents-1.0.18.data → signalwire_agents-1.0.18.dev8.data}/data/share/man/man1/swaig-test.1 +0 -0
- {signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/WHEEL +0 -0
- {signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/entry_points.txt +0 -0
- {signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/licenses/LICENSE +0 -0
- {signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/top_level.txt +0 -0
signalwire_agents/__init__.py
CHANGED
|
@@ -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__ = "1.0.18"
|
|
21
|
+
__version__ = "1.0.18.dev8"
|
|
22
22
|
|
|
23
23
|
# Import core classes for easier access
|
|
24
24
|
from .core.agent_base import AgentBase
|
|
@@ -1170,10 +1170,164 @@ class SwaigFunctionResult:
|
|
|
1170
1170
|
]
|
|
1171
1171
|
}
|
|
1172
1172
|
}
|
|
1173
|
-
|
|
1173
|
+
|
|
1174
1174
|
# Use execute_swml to add the action
|
|
1175
1175
|
return self.execute_swml(swml_doc)
|
|
1176
1176
|
|
|
1177
|
+
def execute_rpc(self, method: str, params: Optional[Dict[str, Any]] = None,
|
|
1178
|
+
call_id: Optional[str] = None, node_id: Optional[str] = None) -> 'SwaigFunctionResult':
|
|
1179
|
+
"""
|
|
1180
|
+
Execute an RPC method on a call using SWML.
|
|
1181
|
+
|
|
1182
|
+
This is a generic helper for executing RPC commands. For common operations,
|
|
1183
|
+
consider using the specific helpers: rpc_dial(), rpc_ai_message(), rpc_ai_unhold().
|
|
1184
|
+
|
|
1185
|
+
Args:
|
|
1186
|
+
method: The RPC method to execute (e.g., "dial", "ai_message", "ai_unhold")
|
|
1187
|
+
params: Parameters for the RPC method (optional)
|
|
1188
|
+
call_id: Target call ID for the RPC (optional)
|
|
1189
|
+
node_id: Target node ID for the RPC (optional)
|
|
1190
|
+
|
|
1191
|
+
Returns:
|
|
1192
|
+
self for method chaining
|
|
1193
|
+
|
|
1194
|
+
Example:
|
|
1195
|
+
result = (
|
|
1196
|
+
SwaigFunctionResult("Executing RPC")
|
|
1197
|
+
.execute_rpc(
|
|
1198
|
+
method="ai_message",
|
|
1199
|
+
call_id="some-call-id",
|
|
1200
|
+
params={"role": "system", "message_text": "Hello"}
|
|
1201
|
+
)
|
|
1202
|
+
)
|
|
1203
|
+
"""
|
|
1204
|
+
# Build the execute_rpc parameters
|
|
1205
|
+
rpc_params: Dict[str, Any] = {"method": method}
|
|
1206
|
+
|
|
1207
|
+
if call_id:
|
|
1208
|
+
rpc_params["call_id"] = call_id
|
|
1209
|
+
if node_id:
|
|
1210
|
+
rpc_params["node_id"] = node_id
|
|
1211
|
+
if params:
|
|
1212
|
+
rpc_params["params"] = params
|
|
1213
|
+
|
|
1214
|
+
# Generate SWML document
|
|
1215
|
+
swml_doc = {
|
|
1216
|
+
"version": "1.0.0",
|
|
1217
|
+
"sections": {
|
|
1218
|
+
"main": [
|
|
1219
|
+
{"execute_rpc": rpc_params}
|
|
1220
|
+
]
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
# Use execute_swml to add the action
|
|
1225
|
+
return self.execute_swml(swml_doc)
|
|
1226
|
+
|
|
1227
|
+
def rpc_dial(self, to_number: str, from_number: str, dest_swml: str,
|
|
1228
|
+
device_type: str = "phone") -> 'SwaigFunctionResult':
|
|
1229
|
+
"""
|
|
1230
|
+
Dial out to a number with a destination SWML URL using execute_rpc.
|
|
1231
|
+
|
|
1232
|
+
This is commonly used in call screening scenarios where you place a caller
|
|
1233
|
+
on hold and dial out to a human, with the dest_swml specifying what agent
|
|
1234
|
+
handles the outbound leg.
|
|
1235
|
+
|
|
1236
|
+
Args:
|
|
1237
|
+
to_number: Phone number to dial (E.164 format)
|
|
1238
|
+
from_number: Caller ID to use (E.164 format)
|
|
1239
|
+
dest_swml: URL to the SWML that handles the outbound call
|
|
1240
|
+
device_type: Device type, typically "phone" (default: "phone")
|
|
1241
|
+
|
|
1242
|
+
Returns:
|
|
1243
|
+
self for method chaining
|
|
1244
|
+
|
|
1245
|
+
Example:
|
|
1246
|
+
result = (
|
|
1247
|
+
SwaigFunctionResult("Please hold while I connect you.")
|
|
1248
|
+
.hold(timeout=120)
|
|
1249
|
+
.rpc_dial(
|
|
1250
|
+
to_number="+15551234567",
|
|
1251
|
+
from_number="+15559876543",
|
|
1252
|
+
dest_swml="https://example.com/call-agent?caller=John"
|
|
1253
|
+
)
|
|
1254
|
+
)
|
|
1255
|
+
"""
|
|
1256
|
+
return self.execute_rpc(
|
|
1257
|
+
method="dial",
|
|
1258
|
+
params={
|
|
1259
|
+
"devices": {
|
|
1260
|
+
"type": device_type,
|
|
1261
|
+
"params": {
|
|
1262
|
+
"to_number": to_number,
|
|
1263
|
+
"from_number": from_number
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
"dest_swml": dest_swml
|
|
1267
|
+
}
|
|
1268
|
+
)
|
|
1269
|
+
|
|
1270
|
+
def rpc_ai_message(self, call_id: str, message_text: str,
|
|
1271
|
+
role: str = "system") -> 'SwaigFunctionResult':
|
|
1272
|
+
"""
|
|
1273
|
+
Inject a message into an AI agent on another call using execute_rpc.
|
|
1274
|
+
|
|
1275
|
+
This is useful for cross-call communication, such as notifying a held
|
|
1276
|
+
caller's AI agent about a status change or instructing it to relay
|
|
1277
|
+
a message.
|
|
1278
|
+
|
|
1279
|
+
Args:
|
|
1280
|
+
call_id: The call ID of the target call
|
|
1281
|
+
message_text: The message text to inject into the AI conversation
|
|
1282
|
+
role: The role for the message, typically "system" (default: "system")
|
|
1283
|
+
|
|
1284
|
+
Returns:
|
|
1285
|
+
self for method chaining
|
|
1286
|
+
|
|
1287
|
+
Example:
|
|
1288
|
+
result = (
|
|
1289
|
+
SwaigFunctionResult("I'll let them know.")
|
|
1290
|
+
.rpc_ai_message(
|
|
1291
|
+
call_id=original_call_id,
|
|
1292
|
+
message_text="The person you were trying to reach is unavailable. Please take a message."
|
|
1293
|
+
)
|
|
1294
|
+
)
|
|
1295
|
+
"""
|
|
1296
|
+
return self.execute_rpc(
|
|
1297
|
+
method="ai_message",
|
|
1298
|
+
call_id=call_id,
|
|
1299
|
+
params={
|
|
1300
|
+
"role": role,
|
|
1301
|
+
"message_text": message_text
|
|
1302
|
+
}
|
|
1303
|
+
)
|
|
1304
|
+
|
|
1305
|
+
def rpc_ai_unhold(self, call_id: str) -> 'SwaigFunctionResult':
|
|
1306
|
+
"""
|
|
1307
|
+
Unhold another call using execute_rpc.
|
|
1308
|
+
|
|
1309
|
+
This releases a call from hold state, typically used after injecting
|
|
1310
|
+
a message to the held caller's AI agent.
|
|
1311
|
+
|
|
1312
|
+
Args:
|
|
1313
|
+
call_id: The call ID of the call to unhold
|
|
1314
|
+
|
|
1315
|
+
Returns:
|
|
1316
|
+
self for method chaining
|
|
1317
|
+
|
|
1318
|
+
Example:
|
|
1319
|
+
result = (
|
|
1320
|
+
SwaigFunctionResult("Understood, I'll let them know.")
|
|
1321
|
+
.rpc_ai_message(call_id, "No one is available. Please take a message.")
|
|
1322
|
+
.rpc_ai_unhold(call_id)
|
|
1323
|
+
)
|
|
1324
|
+
"""
|
|
1325
|
+
return self.execute_rpc(
|
|
1326
|
+
method="ai_unhold",
|
|
1327
|
+
call_id=call_id,
|
|
1328
|
+
params={}
|
|
1329
|
+
)
|
|
1330
|
+
|
|
1177
1331
|
@staticmethod
|
|
1178
1332
|
def create_payment_prompt(for_situation: str, actions: List[Dict[str, str]],
|
|
1179
1333
|
card_type: Optional[str] = None,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
signalwire_agents/__init__.py,sha256=
|
|
2
|
-
signalwire_agents/agent_server.py,sha256=
|
|
1
|
+
signalwire_agents/__init__.py,sha256=npeS4j80LTMW61xutzEwYole8zeZr7OLoIXHvWVwv6c,5036
|
|
2
|
+
signalwire_agents/agent_server.py,sha256=5amS5HRy1L07pht8n0msLuYm9jw33sAe9Jt6OBnzeXY,32352
|
|
3
3
|
signalwire_agents/schema.json,sha256=YQv4-KiegE00XvxoLMKAml6aCGitnt3kBq31ECxTHK8,385886
|
|
4
4
|
signalwire_agents/agents/bedrock.py,sha256=J582gooNtxtep4xdVOfyDzRtHp_XrurPMS93xf2Xod0,10836
|
|
5
5
|
signalwire_agents/cli/__init__.py,sha256=XbxAQFaCIdGXIXJiriVBWoFPOJsC401u21588nO4TG8,388
|
|
@@ -31,7 +31,7 @@ signalwire_agents/core/auth_handler.py,sha256=jXrof9WZ1W9qqlQT9WElcmSRafL2kG7207
|
|
|
31
31
|
signalwire_agents/core/config_loader.py,sha256=rStVRRUaeMGrMc44ocr0diMQQARZhbKqwMqQ6kqUNos,8722
|
|
32
32
|
signalwire_agents/core/contexts.py,sha256=g9FgOGMfGCUWlm57YZcv7CvOf-Ub9FdKZIOMu14ADfE,24428
|
|
33
33
|
signalwire_agents/core/data_map.py,sha256=0qp3VcrRS0RtZPApoAaGgM-udLBb1ysnyMJuWd6sSew,17134
|
|
34
|
-
signalwire_agents/core/function_result.py,sha256=
|
|
34
|
+
signalwire_agents/core/function_result.py,sha256=z3FqB9c9aOK95TElGOrT8rY-3Px9UqWenbRFG0Mc5jY,53440
|
|
35
35
|
signalwire_agents/core/logging_config.py,sha256=x4d_RAjBjVpJOFA2vXnPP2dNr13BZHz091J5rGpC77Y,13142
|
|
36
36
|
signalwire_agents/core/pom_builder.py,sha256=ywuiIfP8BeLBPo_G4X1teZlG6zTCMkW71CZnmyoDTAQ,6636
|
|
37
37
|
signalwire_agents/core/security_config.py,sha256=iAnAzKEJQiXL6mMpDaYm3Sjkxwm4x2N9HD6DeWSI8yI,12536
|
|
@@ -136,12 +136,12 @@ signalwire_agents/utils/token_generators.py,sha256=4Mr7baQ_xR_hfJ72YxQRAT_GFa663
|
|
|
136
136
|
signalwire_agents/utils/validators.py,sha256=4Mr7baQ_xR_hfJ72YxQRAT_GFa663YjFX_PumJ35Xds,191
|
|
137
137
|
signalwire_agents/web/__init__.py,sha256=XE_pSTY9Aalzr7J7wqFth1Zr3cccQHPPcF5HWNrOpz8,383
|
|
138
138
|
signalwire_agents/web/web_service.py,sha256=a2PSHJgX1tlZr0Iz1A1UouZjXEePJAZL632evvLVM38,21071
|
|
139
|
-
signalwire_agents-1.0.18.data/data/share/man/man1/sw-agent-init.1,sha256=J4k5Oi74BnWCPCvsaw00vuyyqDPuIECjJIPu5OynvJc,8381
|
|
140
|
-
signalwire_agents-1.0.18.data/data/share/man/man1/sw-search.1,sha256=9jJ6V6t6DgmXByz8Lw9exjf683Cw3sJGro8-eB0M9EY,10413
|
|
141
|
-
signalwire_agents-1.0.18.data/data/share/man/man1/swaig-test.1,sha256=Ri0EITo8YMFowkcYltwPSwU4VJdRzo7XTWloi5WddCg,7815
|
|
142
|
-
signalwire_agents-1.0.18.dist-info/licenses/LICENSE,sha256=NYvAsB-rTcSvG9cqHt9EUHAWLiA9YzM4Qfz-mPdvDR0,1067
|
|
143
|
-
signalwire_agents-1.0.18.dist-info/METADATA,sha256=
|
|
144
|
-
signalwire_agents-1.0.18.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
145
|
-
signalwire_agents-1.0.18.dist-info/entry_points.txt,sha256=fMiBH-GLeXGaWWn58Mcj7KM_m3SdomQMUQu-1LTqscw,315
|
|
146
|
-
signalwire_agents-1.0.18.dist-info/top_level.txt,sha256=kDGS6ZYv84K9P5Kyg9_S8P_pbUXoHkso0On_DB5bbWc,18
|
|
147
|
-
signalwire_agents-1.0.18.dist-info/RECORD,,
|
|
139
|
+
signalwire_agents-1.0.18.dev8.data/data/share/man/man1/sw-agent-init.1,sha256=J4k5Oi74BnWCPCvsaw00vuyyqDPuIECjJIPu5OynvJc,8381
|
|
140
|
+
signalwire_agents-1.0.18.dev8.data/data/share/man/man1/sw-search.1,sha256=9jJ6V6t6DgmXByz8Lw9exjf683Cw3sJGro8-eB0M9EY,10413
|
|
141
|
+
signalwire_agents-1.0.18.dev8.data/data/share/man/man1/swaig-test.1,sha256=Ri0EITo8YMFowkcYltwPSwU4VJdRzo7XTWloi5WddCg,7815
|
|
142
|
+
signalwire_agents-1.0.18.dev8.dist-info/licenses/LICENSE,sha256=NYvAsB-rTcSvG9cqHt9EUHAWLiA9YzM4Qfz-mPdvDR0,1067
|
|
143
|
+
signalwire_agents-1.0.18.dev8.dist-info/METADATA,sha256=38PNqIfDS1niAIzvHmPgP29UgLfufTJh1NDa-LxXd6s,41745
|
|
144
|
+
signalwire_agents-1.0.18.dev8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
145
|
+
signalwire_agents-1.0.18.dev8.dist-info/entry_points.txt,sha256=fMiBH-GLeXGaWWn58Mcj7KM_m3SdomQMUQu-1LTqscw,315
|
|
146
|
+
signalwire_agents-1.0.18.dev8.dist-info/top_level.txt,sha256=kDGS6ZYv84K9P5Kyg9_S8P_pbUXoHkso0On_DB5bbWc,18
|
|
147
|
+
signalwire_agents-1.0.18.dev8.dist-info/RECORD,,
|
|
File without changes
|
{signalwire_agents-1.0.18.data → signalwire_agents-1.0.18.dev8.data}/data/share/man/man1/sw-search.1
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{signalwire_agents-1.0.18.dist-info → signalwire_agents-1.0.18.dev8.dist-info}/top_level.txt
RENAMED
|
File without changes
|