signalwire-agents 0.1.23__py3-none-any.whl → 0.1.25__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.25.dist-info}/METADATA +47 -2
  58. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.25.dist-info}/RECORD +62 -22
  59. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.25.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.25.dist-info}/WHEEL +0 -0
  63. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.25.dist-info}/licenses/LICENSE +0 -0
  64. {signalwire_agents-0.1.23.dist-info → signalwire_agents-0.1.25.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,210 @@
1
+ # DataSphere Skill
2
+
3
+ The datasphere skill provides knowledge search capabilities using SignalWire DataSphere's RAG (Retrieval-Augmented Generation) stack. It allows agents to search through uploaded documents and knowledge bases to find relevant information.
4
+
5
+ ## Features
6
+
7
+ - SignalWire DataSphere integration for knowledge search
8
+ - Vector-based similarity search with configurable distance thresholds
9
+ - Multi-language support and synonym expansion
10
+ - Tag-based filtering for targeted searches
11
+ - Custom no-results messages with query placeholders
12
+ - **Multiple instance support** - search different knowledge bases with different configurations
13
+
14
+ ## Requirements
15
+
16
+ - **Packages**: `requests`
17
+ - **SignalWire Account**: DataSphere-enabled space with uploaded documents
18
+
19
+ ## Parameters
20
+
21
+ ### Required Parameters
22
+
23
+ - `space_name` (string): SignalWire space name
24
+ - `project_id` (string): SignalWire project ID
25
+ - `token` (string): SignalWire authentication token
26
+ - `document_id` (string): DataSphere document ID to search
27
+
28
+ ### Optional Parameters
29
+
30
+ - `count` (integer, default: 1): Number of search results to return
31
+ - `distance` (float, default: 3.0): Distance threshold for search matching (lower = more similar)
32
+ - `tags` (list): List of tags to filter search results
33
+ - `language` (string): Language code to limit search (e.g., "en", "es")
34
+ - `pos_to_expand` (list): Parts of speech for synonym expansion (e.g., ["NOUN", "VERB"])
35
+ - `max_synonyms` (integer): Maximum number of synonyms to use for each word
36
+ - `tool_name` (string, default: "search_knowledge"): Custom name for the search tool (enables multiple instances)
37
+ - `no_results_message` (string): Custom message when no results are found
38
+ - Default: "I couldn't find any relevant information for '{query}' in the knowledge base. Try rephrasing your question or asking about a different topic."
39
+ - Use `{query}` as placeholder for the search query
40
+
41
+ ### Advanced Parameters
42
+
43
+ - `swaig_fields` (dict): Additional SWAIG function configuration
44
+ - `secure` (boolean): Override security settings
45
+ - `fillers` (dict): Language-specific filler phrases during search
46
+ - Any other SWAIG function parameters
47
+
48
+ ## Tools Created
49
+
50
+ - **Default**: `search_knowledge` - Search the knowledge base for information
51
+ - **Custom**: Uses the `tool_name` parameter value
52
+
53
+ ## Usage Examples
54
+
55
+ ### Basic Usage
56
+
57
+ ```python
58
+ # Minimal configuration
59
+ agent.add_skill("datasphere", {
60
+ "space_name": "my-space",
61
+ "project_id": "my-project-id",
62
+ "token": "my-token",
63
+ "document_id": "my-document-id"
64
+ })
65
+ ```
66
+
67
+ ### Advanced Configuration
68
+
69
+ ```python
70
+ # Comprehensive search with filtering
71
+ agent.add_skill("datasphere", {
72
+ "space_name": "my-space",
73
+ "project_id": "my-project-id",
74
+ "token": "my-token",
75
+ "document_id": "my-document-id",
76
+ "count": 3,
77
+ "distance": 5.0,
78
+ "tags": ["FAQ", "Support"],
79
+ "language": "en",
80
+ "pos_to_expand": ["NOUN", "VERB"],
81
+ "max_synonyms": 3,
82
+ "no_results_message": "I couldn't find information about '{query}' in our support documentation."
83
+ })
84
+ ```
85
+
86
+ ### Multiple Instances
87
+
88
+ ```python
89
+ # Product documentation search
90
+ agent.add_skill("datasphere", {
91
+ "space_name": "my-space",
92
+ "project_id": "my-project-id",
93
+ "token": "my-token",
94
+ "document_id": "product-docs-id",
95
+ "tool_name": "search_product_docs",
96
+ "tags": ["Products", "Features"],
97
+ "count": 2
98
+ })
99
+
100
+ # Support knowledge base search
101
+ agent.add_skill("datasphere", {
102
+ "space_name": "my-space",
103
+ "project_id": "my-project-id",
104
+ "token": "my-token",
105
+ "document_id": "support-kb-id",
106
+ "tool_name": "search_support",
107
+ "tags": ["Support", "Troubleshooting"],
108
+ "count": 3,
109
+ "distance": 4.0
110
+ })
111
+
112
+ # Policy and procedure search
113
+ agent.add_skill("datasphere", {
114
+ "space_name": "my-space",
115
+ "project_id": "my-project-id",
116
+ "token": "my-token",
117
+ "document_id": "policies-id",
118
+ "tool_name": "search_policies",
119
+ "tags": ["Policy", "Compliance"],
120
+ "count": 1,
121
+ "distance": 2.0
122
+ })
123
+ ```
124
+
125
+ ### With Custom Fillers
126
+
127
+ ```python
128
+ agent.add_skill("datasphere", {
129
+ "space_name": "my-space",
130
+ "project_id": "my-project-id",
131
+ "token": "my-token",
132
+ "document_id": "my-document-id",
133
+ "swaig_fields": {
134
+ "fillers": {
135
+ "en-US": [
136
+ "Searching our knowledge base...",
137
+ "Looking through our documentation...",
138
+ "Checking our information database..."
139
+ ],
140
+ "es-ES": [
141
+ "Buscando en nuestra base de conocimientos...",
142
+ "Revisando nuestra documentación..."
143
+ ]
144
+ }
145
+ }
146
+ })
147
+ ```
148
+
149
+ ## How It Works
150
+
151
+ 1. **Vector Search**: Uses semantic similarity to find relevant content chunks
152
+ 2. **Distance Filtering**: Only returns results within the specified distance threshold
153
+ 3. **Tag Filtering**: Optionally filters results by document tags
154
+ 4. **Language Processing**: Supports synonym expansion and language-specific search
155
+ 5. **Format Results**: Presents found content with metadata and relevance scores
156
+
157
+ ## Multiple Instance Support
158
+
159
+ The datasphere skill supports multiple instances, allowing you to:
160
+
161
+ - Search different knowledge bases/documents with one agent
162
+ - Use different search parameters per knowledge domain
163
+ - Create specialized search tools (`search_products`, `search_support`, etc.)
164
+ - Apply different tag filtering per instance
165
+ - Customize distance thresholds based on content type
166
+
167
+ Each instance is uniquely identified by its `search_engine_id` (derived from space/project/document) and `tool_name` combination.
168
+
169
+ ## Parameters Explained
170
+
171
+ ### Distance Threshold
172
+ - **Lower values** (1.0-2.0): Very strict matching, only highly similar content
173
+ - **Medium values** (3.0-4.0): Balanced matching, good for most use cases
174
+ - **Higher values** (5.0+): More permissive matching, broader results
175
+
176
+ ### Count vs Distance
177
+ - Use higher `count` with lower `distance` for precise, multiple results
178
+ - Use lower `count` with higher `distance` for broader, fewer results
179
+
180
+ ### Tags Usage
181
+ - Pre-tag your documents in DataSphere with categories
182
+ - Use tags to create domain-specific searches (e.g., ["FAQ"], ["Legal"], ["Technical"])
183
+
184
+ ### Language Support
185
+ - Specify language codes for multilingual knowledge bases
186
+ - Helps improve search accuracy for non-English content
187
+
188
+ ## Error Handling
189
+
190
+ - **No Results**: Returns custom `no_results_message` with query placeholder
191
+ - **API Issues**: Returns friendly error message for authentication/connectivity issues
192
+ - **Invalid Documents**: Gracefully handles missing or inaccessible documents
193
+ - **Timeout Protection**: Built-in 30-second timeout for API requests
194
+
195
+ ## Best Practices
196
+
197
+ 1. **Document Organization**: Use meaningful tags when uploading to DataSphere
198
+ 2. **Distance Tuning**: Start with default 3.0, adjust based on result quality
199
+ 3. **Multiple Instances**: Separate different knowledge domains for better results
200
+ 4. **Language Consistency**: Specify language when dealing with multilingual content
201
+ 5. **Result Count**: Balance between comprehensive answers (higher count) and response speed (lower count)
202
+
203
+ ## Setting Up DataSphere
204
+
205
+ 1. Access your SignalWire space
206
+ 2. Enable DataSphere in your space settings
207
+ 3. Upload documents through the DataSphere interface
208
+ 4. Note the document IDs for use in skill configuration
209
+ 5. Apply appropriate tags during document upload
210
+ 6. Get your project ID and token from SignalWire console
@@ -0,0 +1,258 @@
1
+ # DataSphere Serverless Skill
2
+
3
+ The datasphere_serverless skill provides knowledge search capabilities using SignalWire DataSphere's RAG (Retrieval-Augmented Generation) stack with serverless execution via DataMap. This skill offers the same functionality as the standard datasphere skill but executes on SignalWire servers rather than your agent server.
4
+
5
+ ## Features
6
+
7
+ - **Serverless Execution**: Runs on SignalWire infrastructure via DataMap
8
+ - **SignalWire DataSphere Integration**: Vector-based knowledge search
9
+ - **Identical API**: Same parameters and functionality as the standard datasphere skill
10
+ - **Multi-language Support**: Synonym expansion and language-specific search
11
+ - **Tag-based Filtering**: Targeted searches using document tags
12
+ - **Custom No-results Messages**: Configurable response templates
13
+ - **Multiple Instance Support**: Search different knowledge bases with different configurations
14
+ - **No Webhook Infrastructure**: No need to expose HTTP endpoints
15
+
16
+ ## Requirements
17
+
18
+ - **Packages**: None (DataMap handles API calls serverlessly)
19
+ - **SignalWire Account**: DataSphere-enabled space with uploaded documents
20
+
21
+ ## Parameters
22
+
23
+ ### Required Parameters
24
+
25
+ - `space_name` (string): SignalWire space name
26
+ - `project_id` (string): SignalWire project ID
27
+ - `token` (string): SignalWire authentication token
28
+ - `document_id` (string): DataSphere document ID to search
29
+
30
+ ### Optional Parameters
31
+
32
+ - `count` (integer, default: 1): Number of search results to return
33
+ - `distance` (float, default: 3.0): Distance threshold for search matching (lower = more similar)
34
+ - `tags` (list): List of tags to filter search results
35
+ - `language` (string): Language code to limit search (e.g., "en", "es")
36
+ - `pos_to_expand` (list): Parts of speech for synonym expansion (e.g., ["NOUN", "VERB"])
37
+ - `max_synonyms` (integer): Maximum number of synonyms to use for each word
38
+ - `tool_name` (string, default: "search_knowledge"): Custom name for the search tool (enables multiple instances)
39
+ - `no_results_message` (string): Custom message when no results are found
40
+ - Default: "I couldn't find any relevant information for '{query}' in the knowledge base. Try rephrasing your question or asking about a different topic."
41
+ - Use `{query}` as placeholder for the search query
42
+
43
+ ### Advanced Parameters
44
+
45
+ - `swaig_fields` (dict): Additional SWAIG function configuration
46
+ - `secure` (boolean): Override security settings
47
+ - `fillers` (dict): Language-specific filler phrases during search
48
+ - Any other SWAIG function parameters
49
+
50
+ ## Tools Created
51
+
52
+ - **Default**: `search_knowledge` - Search the knowledge base for information
53
+ - **Custom**: Uses the `tool_name` parameter value
54
+
55
+ ## Usage Examples
56
+
57
+ ### Basic Usage
58
+
59
+ ```python
60
+ # Minimal configuration - same as standard datasphere skill
61
+ agent.add_skill("datasphere_serverless", {
62
+ "space_name": "my-space",
63
+ "project_id": "my-project-id",
64
+ "token": "my-token",
65
+ "document_id": "my-document-id"
66
+ })
67
+ ```
68
+
69
+ ### Advanced Configuration
70
+
71
+ ```python
72
+ # Comprehensive search with filtering - identical to standard skill
73
+ agent.add_skill("datasphere_serverless", {
74
+ "space_name": "my-space",
75
+ "project_id": "my-project-id",
76
+ "token": "my-token",
77
+ "document_id": "my-document-id",
78
+ "count": 3,
79
+ "distance": 5.0,
80
+ "tags": ["FAQ", "Support"],
81
+ "language": "en",
82
+ "pos_to_expand": ["NOUN", "VERB"],
83
+ "max_synonyms": 3,
84
+ "no_results_message": "I couldn't find information about '{query}' in our support documentation."
85
+ })
86
+ ```
87
+
88
+ ### Multiple Instances
89
+
90
+ ```python
91
+ # Product documentation search
92
+ agent.add_skill("datasphere_serverless", {
93
+ "space_name": "my-space",
94
+ "project_id": "my-project-id",
95
+ "token": "my-token",
96
+ "document_id": "product-docs-id",
97
+ "tool_name": "search_product_docs",
98
+ "tags": ["Products", "Features"],
99
+ "count": 2
100
+ })
101
+
102
+ # Support knowledge base search
103
+ agent.add_skill("datasphere_serverless", {
104
+ "space_name": "my-space",
105
+ "project_id": "my-project-id",
106
+ "token": "my-token",
107
+ "document_id": "support-kb-id",
108
+ "tool_name": "search_support",
109
+ "tags": ["Support", "Troubleshooting"],
110
+ "count": 3,
111
+ "distance": 4.0
112
+ })
113
+ ```
114
+
115
+ ## DataMap Implementation Details
116
+
117
+ This skill demonstrates advanced DataMap usage patterns:
118
+
119
+ ### 1. **Serverless API Integration**
120
+ - API calls execute on SignalWire servers, not your agent server
121
+ - No webhook endpoints required
122
+ - Built-in authentication and error handling
123
+
124
+ ### 2. **Dynamic Request Building**
125
+ ```python
126
+ webhook_body = {
127
+ "document_id": self.document_id,
128
+ "query_string": "${args.query}", # Dynamic from user input
129
+ "distance": self.distance, # Static from configuration
130
+ "count": self.count # Static from configuration
131
+ }
132
+
133
+ # Optional parameters added conditionally
134
+ if self.tags is not None:
135
+ webhook_body["tags"] = self.tags
136
+ ```
137
+
138
+ ### 3. **Response Processing with Foreach**
139
+ ```python
140
+ .foreach({
141
+ "input_key": "results", # API response key containing array
142
+ "output_key": "formatted_results", # Name for built string
143
+ "max": self.count, # Limit processing
144
+ "append": "=== RESULT ${this.index} ===\n${this.content}\n========\n\n"
145
+ })
146
+ ```
147
+
148
+ The `foreach` mechanism:
149
+ - Iterates over the `results` array from DataSphere API response
150
+ - For each result, expands `${this.content}` with the result's content field
151
+ - Builds a concatenated string stored as `formatted_results`
152
+ - Limits processing to `max` items
153
+
154
+ ### 4. **Variable Expansion in Output**
155
+ ```python
156
+ .output(SwaigFunctionResult('I found ${results.length} result(s) for "${args.query}":\n\n${formatted_results}'))
157
+ ```
158
+
159
+ References:
160
+ - `${results.length}`: Number of results from API
161
+ - `${args.query}`: User's search query
162
+ - `${formatted_results}`: String built by foreach
163
+
164
+ ### 5. **Error Handling**
165
+ ```python
166
+ .error_keys(['error', 'message'])
167
+ .fallback_output(SwaigFunctionResult(self.no_results_message.replace('{query}', '${args.query}')))
168
+ ```
169
+
170
+ ## Comparison: Standard vs Serverless
171
+
172
+ | Feature | Standard DataSphere | DataSphere Serverless |
173
+ |---------|-------------------|---------------------|
174
+ | **Execution** | Agent server | SignalWire servers |
175
+ | **Parameters** | Identical | Identical |
176
+ | **Functionality** | Full Python logic | DataMap templates |
177
+ | **Performance** | Agent server load | No agent server load |
178
+ | **Deployment** | Webhook infrastructure | No infrastructure needed |
179
+ | **Response Formatting** | Custom Python code | DataMap foreach/templates |
180
+ | **Error Handling** | Granular Python exceptions | DataMap error keys |
181
+ | **Use Case** | Complex custom logic | Standard API integration |
182
+
183
+ ## When to Use Serverless vs Standard
184
+
185
+ ### **Use DataSphere Serverless When:**
186
+ - You want simple deployment without webhook infrastructure
187
+ - Performance on agent server is a concern
188
+ - Standard response formatting is sufficient
189
+ - You prefer serverless execution model
190
+
191
+ ### **Use Standard DataSphere When:**
192
+ - You need complex custom response formatting
193
+ - You want granular error handling with different messages per error type
194
+ - You need runtime decision-making logic
195
+ - You want full control over the search process
196
+
197
+ ## Benefits of DataMap Implementation
198
+
199
+ 1. **Simplified Deployment**: No HTTP endpoints to expose or manage
200
+ 2. **Better Performance**: Executes on SignalWire infrastructure
201
+ 3. **Reduced Complexity**: Declarative configuration vs imperative code
202
+ 4. **Automatic Scaling**: SignalWire handles execution scaling
203
+ 5. **Built-in Reliability**: Server-side execution with built-in retry logic
204
+
205
+ ## How It Works
206
+
207
+ 1. **Configuration**: Skill parameters are validated and stored during setup
208
+ 2. **Tool Registration**: DataMap configuration is built with static values from setup
209
+ 3. **Execution**: When called, DataMap executes on SignalWire servers:
210
+ - Makes POST request to DataSphere API with user's query
211
+ - Processes response array using foreach mechanism
212
+ - Formats results using template expansion
213
+ - Returns formatted response to agent
214
+ 4. **Response**: Agent receives formatted results without any local processing
215
+
216
+ ## Multiple Instance Support
217
+
218
+ Like the standard datasphere skill, this supports multiple instances:
219
+
220
+ - Each instance creates a tool with a unique name (`tool_name` parameter)
221
+ - Different configurations per instance (different documents, tags, etc.)
222
+ - Instance tracking via `get_instance_key()` method
223
+ - Same agent can search multiple knowledge bases
224
+
225
+ ## Error Handling
226
+
227
+ - **API Errors**: Handled by `error_keys` configuration
228
+ - **No Results**: Uses `fallback_output` with custom message
229
+ - **Invalid Parameters**: Validated during skill setup
230
+ - **Timeout/Network**: Handled by SignalWire infrastructure
231
+
232
+ ## Troubleshooting
233
+
234
+ ### Common Issues
235
+
236
+ 1. **"Missing required parameters"**
237
+ - Ensure all required parameters are provided
238
+ - Check parameter names match exactly
239
+
240
+ 2. **"No results found"**
241
+ - Verify document_id exists and is accessible
242
+ - Check distance threshold isn't too restrictive
243
+ - Ensure tags match document tags if specified
244
+
245
+ 3. **"Authentication failed"**
246
+ - Verify project_id and token are correct
247
+ - Ensure token has DataSphere permissions
248
+
249
+ ### Debugging
250
+
251
+ Enable debug logging to see DataMap execution:
252
+
253
+ ```python
254
+ import logging
255
+ logging.basicConfig(level=logging.DEBUG)
256
+ ```
257
+
258
+ DataMap execution details are logged by the SignalWire server infrastructure.
@@ -0,0 +1,132 @@
1
+ # DateTime Skill
2
+
3
+ The datetime skill provides current date and time information with timezone support. It allows agents to tell users the current time and date in any timezone around the world.
4
+
5
+ ## Features
6
+
7
+ - Current time retrieval with timezone support
8
+ - Current date retrieval with timezone support
9
+ - Automatic timezone conversion using pytz
10
+ - Human-readable time and date formatting
11
+ - UTC default with custom timezone options
12
+
13
+ ## Requirements
14
+
15
+ - **Packages**: `pytz`
16
+ - **No external APIs required**
17
+
18
+ ## Parameters
19
+
20
+ ### Optional Parameters
21
+
22
+ - `swaig_fields` (dict): Additional SWAIG function configuration
23
+ - `secure` (boolean): Override security settings for the time/date functions
24
+ - `fillers` (dict): Language-specific filler phrases while retrieving time/date
25
+ - Any other SWAIG function parameters
26
+
27
+ **Note**: This skill does not require any configuration parameters beyond the optional swaig_fields. It works out-of-the-box with no setup.
28
+
29
+ ## Tools Created
30
+
31
+ - `get_current_time` - Get the current time, optionally in a specific timezone
32
+ - `get_current_date` - Get the current date, optionally in a specific timezone
33
+
34
+ ## Usage Examples
35
+
36
+ ### Basic Usage
37
+
38
+ ```python
39
+ # No configuration needed - works immediately
40
+ agent.add_skill("datetime")
41
+ ```
42
+
43
+ ### With Custom Fillers
44
+
45
+ ```python
46
+ agent.add_skill("datetime", {
47
+ "swaig_fields": {
48
+ "fillers": {
49
+ "en-US": [
50
+ "Let me check the time...",
51
+ "Looking up the current date...",
52
+ "Getting the time for you..."
53
+ ],
54
+ "es-ES": [
55
+ "Déjame verificar la hora...",
56
+ "Consultando la fecha actual..."
57
+ ]
58
+ }
59
+ }
60
+ })
61
+ ```
62
+
63
+ ### Disabling Security (if needed)
64
+
65
+ ```python
66
+ agent.add_skill("datetime", {
67
+ "swaig_fields": {
68
+ "secure": False # Allow unauthenticated time/date requests
69
+ }
70
+ })
71
+ ```
72
+
73
+ ## How It Works
74
+
75
+ ### Time Function
76
+ - **Input**: Optional timezone parameter (e.g., "America/New_York", "Europe/London")
77
+ - **Default**: UTC timezone if no timezone specified
78
+ - **Output**: Time in 12-hour format with AM/PM and timezone abbreviation
79
+ - **Example**: "The current time is 02:30:45 PM EST"
80
+
81
+ ### Date Function
82
+ - **Input**: Optional timezone parameter for date calculation
83
+ - **Default**: UTC timezone if no timezone specified
84
+ - **Output**: Full date in readable format
85
+ - **Example**: "Today's date is Friday, December 15, 2023"
86
+
87
+ ### Timezone Support
88
+ - Uses the `pytz` library for accurate timezone handling
89
+ - Supports all standard timezone names (e.g., "America/New_York", "Asia/Tokyo")
90
+ - Handles daylight saving time automatically
91
+ - Falls back to UTC for invalid timezone names
92
+
93
+ ## Function Parameters
94
+
95
+ Both tools accept the same optional parameter:
96
+
97
+ - `timezone` (string, optional): Timezone name for the time/date
98
+ - Examples: "America/New_York", "Europe/London", "Asia/Tokyo", "UTC"
99
+ - Default: "UTC" if not specified
100
+ - Invalid timezones will cause an error message to be returned
101
+
102
+ ## Error Handling
103
+
104
+ - **Invalid Timezone**: Returns error message with the invalid timezone name
105
+ - **System Issues**: Returns friendly error message for any datetime calculation problems
106
+ - **Graceful Fallback**: Continues to work even if timezone data is corrupted
107
+
108
+ ## Common Timezone Examples
109
+
110
+ - **US Timezones**: "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles"
111
+ - **European Timezones**: "Europe/London", "Europe/Paris", "Europe/Berlin", "Europe/Rome"
112
+ - **Asian Timezones**: "Asia/Tokyo", "Asia/Shanghai", "Asia/Kolkata", "Asia/Dubai"
113
+ - **Other Regions**: "Australia/Sydney", "Africa/Cairo", "America/Sao_Paulo"
114
+
115
+ ## Best Practices
116
+
117
+ 1. **Default Behavior**: The skill works immediately without configuration
118
+ 2. **User Queries**: Handle questions like "What time is it?", "What's today's date?", "What time is it in Tokyo?"
119
+ 3. **Timezone Validation**: The skill gracefully handles invalid timezone names
120
+ 4. **Localization**: Use fillers in different languages for multilingual agents
121
+ 5. **Performance**: Very fast since no external API calls are required
122
+
123
+ ## Agent Integration
124
+
125
+ When added to an agent, this skill automatically:
126
+
127
+ - Adds speech recognition hints for time/date related words
128
+ - Provides prompt guidance about time/date capabilities
129
+ - Enables the agent to respond to time and date questions
130
+ - Works with any timezone the user requests
131
+
132
+ The skill is designed to be maintenance-free and always available, making it ideal for customer service and general-purpose agents that need to provide time and date information.