signalwire-agents 0.1.0__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 +17 -0
- signalwire_agents/agent_server.py +336 -0
- signalwire_agents/core/__init__.py +20 -0
- signalwire_agents/core/agent_base.py +2449 -0
- signalwire_agents/core/function_result.py +104 -0
- signalwire_agents/core/pom_builder.py +195 -0
- signalwire_agents/core/security/__init__.py +0 -0
- signalwire_agents/core/security/session_manager.py +170 -0
- signalwire_agents/core/state/__init__.py +8 -0
- signalwire_agents/core/state/file_state_manager.py +210 -0
- signalwire_agents/core/state/state_manager.py +92 -0
- signalwire_agents/core/swaig_function.py +163 -0
- signalwire_agents/core/swml_builder.py +205 -0
- signalwire_agents/core/swml_handler.py +218 -0
- signalwire_agents/core/swml_renderer.py +359 -0
- signalwire_agents/core/swml_service.py +1009 -0
- signalwire_agents/prefabs/__init__.py +15 -0
- signalwire_agents/prefabs/concierge.py +276 -0
- signalwire_agents/prefabs/faq_bot.py +314 -0
- signalwire_agents/prefabs/info_gatherer.py +253 -0
- signalwire_agents/prefabs/survey.py +387 -0
- signalwire_agents/schema.json +5611 -0
- signalwire_agents/utils/__init__.py +0 -0
- signalwire_agents/utils/pom_utils.py +0 -0
- signalwire_agents/utils/schema_utils.py +348 -0
- signalwire_agents/utils/token_generators.py +0 -0
- signalwire_agents/utils/validators.py +0 -0
- signalwire_agents-0.1.0.data/data/schema.json +5611 -0
- signalwire_agents-0.1.0.dist-info/METADATA +154 -0
- signalwire_agents-0.1.0.dist-info/RECORD +32 -0
- signalwire_agents-0.1.0.dist-info/WHEEL +5 -0
- signalwire_agents-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,154 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: signalwire_agents
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: SignalWire AI Agents SDK
|
5
|
+
Author-email: SignalWire Team <info@signalwire.com>
|
6
|
+
Project-URL: Homepage, https://github.com/signalwire/signalwire-ai-agents
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
8
|
+
Classifier: Intended Audience :: Developers
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
11
|
+
Classifier: Programming Language :: Python :: 3.7
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
16
|
+
Requires-Python: >=3.7
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
Requires-Dist: fastapi==0.115.12
|
19
|
+
Requires-Dist: pydantic==2.11.4
|
20
|
+
Requires-Dist: PyYAML==6.0.2
|
21
|
+
Requires-Dist: Requests==2.32.3
|
22
|
+
Requires-Dist: setuptools==66.1.1
|
23
|
+
Requires-Dist: signalwire_pom==2.7.1
|
24
|
+
Requires-Dist: structlog==25.3.0
|
25
|
+
Requires-Dist: uvicorn==0.34.2
|
26
|
+
|
27
|
+
# SignalWire AI Agent SDK
|
28
|
+
|
29
|
+
A Python SDK for creating, hosting, and securing SignalWire AI agents as microservices with minimal boilerplate.
|
30
|
+
|
31
|
+
## Features
|
32
|
+
|
33
|
+
- **Self-Contained Agents**: Each agent is both a web app and an AI persona
|
34
|
+
- **Prompt Object Model**: Structured prompt composition using POM
|
35
|
+
- **SWAIG Integration**: Easily define and handle AI tools/functions
|
36
|
+
- **Security Built-In**: Session management, per-call tokens, and basic auth
|
37
|
+
- **State Management**: Persistent conversation state with lifecycle hooks
|
38
|
+
- **Prefab Archetypes**: Ready-to-use agent types for common scenarios
|
39
|
+
- **Multi-Agent Support**: Host multiple agents on a single server
|
40
|
+
|
41
|
+
## Installation
|
42
|
+
|
43
|
+
```bash
|
44
|
+
pip install signalwire-agents
|
45
|
+
```
|
46
|
+
|
47
|
+
## Quick Start
|
48
|
+
|
49
|
+
```python
|
50
|
+
from signalwire_agents import AgentBase
|
51
|
+
from signalwire_agents.core.function_result import SwaigFunctionResult
|
52
|
+
|
53
|
+
class SimpleAgent(AgentBase):
|
54
|
+
def __init__(self):
|
55
|
+
super().__init__(name="simple", route="/simple")
|
56
|
+
self.set_personality("You are a helpful assistant.")
|
57
|
+
self.set_goal("Help users with basic questions.")
|
58
|
+
self.add_instruction("Be concise and clear.")
|
59
|
+
|
60
|
+
@AgentBase.tool(name="get_time", parameters={})
|
61
|
+
def get_time(self):
|
62
|
+
from datetime import datetime
|
63
|
+
now = datetime.now().strftime("%H:%M:%S")
|
64
|
+
return SwaigFunctionResult(f"The current time is {now}")
|
65
|
+
|
66
|
+
# Run the agent
|
67
|
+
if __name__ == "__main__":
|
68
|
+
agent = SimpleAgent()
|
69
|
+
agent.serve(host="0.0.0.0", port=8000)
|
70
|
+
```
|
71
|
+
|
72
|
+
## Using State Management
|
73
|
+
|
74
|
+
```python
|
75
|
+
from signalwire_agents import AgentBase
|
76
|
+
from signalwire_agents.core.state import FileStateManager
|
77
|
+
|
78
|
+
class StatefulAgent(AgentBase):
|
79
|
+
def __init__(self):
|
80
|
+
# Configure state management
|
81
|
+
state_manager = FileStateManager(storage_dir="./state_data")
|
82
|
+
|
83
|
+
super().__init__(
|
84
|
+
name="stateful",
|
85
|
+
route="/stateful",
|
86
|
+
enable_state_tracking=True, # Enable state tracking
|
87
|
+
state_manager=state_manager # Use custom state manager
|
88
|
+
)
|
89
|
+
|
90
|
+
# These methods are automatically registered when enable_state_tracking=True
|
91
|
+
def startup_hook(self, args, raw_data):
|
92
|
+
"""Called when a conversation starts"""
|
93
|
+
call_id = raw_data.get("call_id")
|
94
|
+
state = self.get_state(call_id) or {}
|
95
|
+
state["started_at"] = "2023-01-01T12:00:00Z"
|
96
|
+
self.update_state(call_id, state)
|
97
|
+
return "Call initialized"
|
98
|
+
|
99
|
+
def hangup_hook(self, args, raw_data):
|
100
|
+
"""Called when a conversation ends"""
|
101
|
+
call_id = raw_data.get("call_id")
|
102
|
+
state = self.get_state(call_id)
|
103
|
+
return "Call completed"
|
104
|
+
```
|
105
|
+
|
106
|
+
## Using Prefab Agents
|
107
|
+
|
108
|
+
```python
|
109
|
+
from signalwire_agents.prefabs import InfoGathererAgent
|
110
|
+
|
111
|
+
agent = InfoGathererAgent(
|
112
|
+
fields=[
|
113
|
+
{"name": "full_name", "prompt": "What is your full name?"},
|
114
|
+
{"name": "reason", "prompt": "How can I help you today?"}
|
115
|
+
],
|
116
|
+
confirmation_template="Thanks {full_name}, I'll help you with {reason}."
|
117
|
+
)
|
118
|
+
|
119
|
+
agent.serve(host="0.0.0.0", port=8000, route="/support")
|
120
|
+
```
|
121
|
+
|
122
|
+
## Configuration
|
123
|
+
|
124
|
+
### Environment Variables
|
125
|
+
|
126
|
+
The SDK supports the following environment variables:
|
127
|
+
|
128
|
+
- `SWML_BASIC_AUTH_USER`: Username for basic auth (default: auto-generated)
|
129
|
+
- `SWML_BASIC_AUTH_PASSWORD`: Password for basic auth (default: auto-generated)
|
130
|
+
- `SWML_PROXY_URL_BASE`: Base URL to use when behind a reverse proxy, used for constructing webhook URLs
|
131
|
+
- `SWML_SSL_ENABLED`: Enable HTTPS/SSL support (values: "true", "1", "yes")
|
132
|
+
- `SWML_SSL_CERT_PATH`: Path to SSL certificate file
|
133
|
+
- `SWML_SSL_KEY_PATH`: Path to SSL private key file
|
134
|
+
- `SWML_DOMAIN`: Domain name for SSL certificate and external URLs
|
135
|
+
|
136
|
+
When the auth environment variables are set, they will be used for all agents instead of generating random credentials. The proxy URL base is useful when your service is behind a reverse proxy or when you need external services to access your webhooks.
|
137
|
+
|
138
|
+
To enable HTTPS directly (without a reverse proxy), set `SWML_SSL_ENABLED` to "true", provide valid paths to your certificate and key files, and specify your domain name.
|
139
|
+
|
140
|
+
## Documentation
|
141
|
+
|
142
|
+
See the [full documentation](https://docs.signalwire.com/ai-agents) for details on:
|
143
|
+
|
144
|
+
- Creating custom agents
|
145
|
+
- Using prefab agents
|
146
|
+
- SWAIG function definitions
|
147
|
+
- State management and persistence
|
148
|
+
- Security model
|
149
|
+
- Deployment options
|
150
|
+
- Multi-agent hosting
|
151
|
+
|
152
|
+
## License
|
153
|
+
|
154
|
+
MIT
|
@@ -0,0 +1,32 @@
|
|
1
|
+
signalwire_agents/__init__.py,sha256=CKOaLzrbPQWgPrMMdojp1fs7waFnxp_fxzhm79vDDt4,609
|
2
|
+
signalwire_agents/agent_server.py,sha256=FWRdNPqlrY6WXY5QqZD4ud4s0U57bDeKiKllo8cp40o,11837
|
3
|
+
signalwire_agents/schema.json,sha256=M8Mn6pQda2P9jhbmkALrLr1wt-fRuhYRqdmEi9Rbhqk,178075
|
4
|
+
signalwire_agents/core/__init__.py,sha256=KEfW2D3hTM13xB0zAH86zaFcMDw0OMKkuz2N3Eg1EuQ,615
|
5
|
+
signalwire_agents/core/agent_base.py,sha256=l8D-0Ufa5kXE3MD6waeITOiW4651xYe4PF4LS47LCnU,94067
|
6
|
+
signalwire_agents/core/function_result.py,sha256=myyoinywTcHrRDcBwl0Of5oJdH9g6fRVQK8Ke8G_22I,2963
|
7
|
+
signalwire_agents/core/pom_builder.py,sha256=f322xT3WTmc427YVbTPwi14qoZReCLKZ0YpjMKyM2x0,6445
|
8
|
+
signalwire_agents/core/swaig_function.py,sha256=MGKYhF9jJYLaBmSq2YtSKMDUtkrFeFwWbdP_0Hd3tts,6125
|
9
|
+
signalwire_agents/core/swml_builder.py,sha256=3MYTx_Wq6Bvy7hn5ubXBSKkX42n3VDF1o1YQe8_w8ss,6403
|
10
|
+
signalwire_agents/core/swml_handler.py,sha256=_O9JWufTvO219eEKUgcMGTuib0fY_6Qhs0yemgpBpLU,6811
|
11
|
+
signalwire_agents/core/swml_renderer.py,sha256=GKj1LYRw9paCaJbrwVDYiT4gPum7keMixHhZjxyYdAk,13700
|
12
|
+
signalwire_agents/core/swml_service.py,sha256=DkzIxe3Dc1BPDdL63dxN6qFqXqW8s6b00dLurDIag74,39470
|
13
|
+
signalwire_agents/core/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
+
signalwire_agents/core/security/session_manager.py,sha256=2gcODBtk1Z_g0NVGr09V7GkCfuCmoEl4DVbW-1kAOos,5038
|
15
|
+
signalwire_agents/core/state/__init__.py,sha256=8Da6qFziYNmYuaIM8imEwAC3DGRJvX0u5hJIIPFmC7c,188
|
16
|
+
signalwire_agents/core/state/file_state_manager.py,sha256=rGD_rZy7rdIQm99kQVHLEUo_jiflaNCdQRJ2MllHnZ4,7116
|
17
|
+
signalwire_agents/core/state/state_manager.py,sha256=AFHhICiYlI1czOIKbNyi-vauI8RW8oTpp3ZZGUZnMeA,2320
|
18
|
+
signalwire_agents/prefabs/__init__.py,sha256=Zhhn0gRXrkDaS9ml54y5YItxJAqD1zhdDuN_-9C-jRo,430
|
19
|
+
signalwire_agents/prefabs/concierge.py,sha256=ELPYR1ZO_tH6_QF0xt3PaS0oFAKhQ3UPLvvbC7O_b0Q,10290
|
20
|
+
signalwire_agents/prefabs/faq_bot.py,sha256=k_Xd3CddIkPtXuw6X6DH0r-rDuT-5mB6CUM0ShKKkfk,11083
|
21
|
+
signalwire_agents/prefabs/info_gatherer.py,sha256=vfg55qlfx28Mcg3YW2o8SrYD7k0yrevg_VSGqZBAO70,9173
|
22
|
+
signalwire_agents/prefabs/survey.py,sha256=W3uKDlDtg34cuxuZg6Z0UqZrniQp2V2h3VxSB-Dj8K8,14857
|
23
|
+
signalwire_agents/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
signalwire_agents/utils/pom_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
+
signalwire_agents/utils/schema_utils.py,sha256=ouvxLkulGIgacYj4ip18IlswxGYMBmBEug27Evz8dgs,13282
|
26
|
+
signalwire_agents/utils/token_generators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
|
+
signalwire_agents/utils/validators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
|
+
signalwire_agents-0.1.0.data/data/schema.json,sha256=M8Mn6pQda2P9jhbmkALrLr1wt-fRuhYRqdmEi9Rbhqk,178075
|
29
|
+
signalwire_agents-0.1.0.dist-info/METADATA,sha256=R4-f572VAowe2qTR6Ek_zIkeYEHmdMJzSpQK1TJrw6g,5366
|
30
|
+
signalwire_agents-0.1.0.dist-info/WHEEL,sha256=QZxptf4Y1BKFRCEDxD4h2V0mBFQOVFLFEpvxHmIs52A,91
|
31
|
+
signalwire_agents-0.1.0.dist-info/top_level.txt,sha256=kDGS6ZYv84K9P5Kyg9_S8P_pbUXoHkso0On_DB5bbWc,18
|
32
|
+
signalwire_agents-0.1.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
signalwire_agents
|