glaip-sdk 0.0.3__py3-none-any.whl → 0.0.5__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 (47) hide show
  1. glaip_sdk/__init__.py +5 -5
  2. glaip_sdk/branding.py +146 -0
  3. glaip_sdk/cli/__init__.py +1 -1
  4. glaip_sdk/cli/agent_config.py +82 -0
  5. glaip_sdk/cli/commands/__init__.py +3 -3
  6. glaip_sdk/cli/commands/agents.py +786 -271
  7. glaip_sdk/cli/commands/configure.py +19 -19
  8. glaip_sdk/cli/commands/mcps.py +151 -141
  9. glaip_sdk/cli/commands/models.py +1 -1
  10. glaip_sdk/cli/commands/tools.py +252 -178
  11. glaip_sdk/cli/display.py +244 -0
  12. glaip_sdk/cli/io.py +106 -0
  13. glaip_sdk/cli/main.py +27 -20
  14. glaip_sdk/cli/resolution.py +59 -0
  15. glaip_sdk/cli/utils.py +372 -213
  16. glaip_sdk/cli/validators.py +235 -0
  17. glaip_sdk/client/__init__.py +3 -224
  18. glaip_sdk/client/agents.py +632 -171
  19. glaip_sdk/client/base.py +66 -4
  20. glaip_sdk/client/main.py +226 -0
  21. glaip_sdk/client/mcps.py +143 -18
  22. glaip_sdk/client/tools.py +327 -104
  23. glaip_sdk/config/constants.py +10 -1
  24. glaip_sdk/models.py +43 -3
  25. glaip_sdk/rich_components.py +29 -0
  26. glaip_sdk/utils/__init__.py +18 -171
  27. glaip_sdk/utils/agent_config.py +181 -0
  28. glaip_sdk/utils/client_utils.py +159 -79
  29. glaip_sdk/utils/display.py +100 -0
  30. glaip_sdk/utils/general.py +94 -0
  31. glaip_sdk/utils/import_export.py +140 -0
  32. glaip_sdk/utils/rendering/formatting.py +6 -1
  33. glaip_sdk/utils/rendering/renderer/__init__.py +67 -8
  34. glaip_sdk/utils/rendering/renderer/base.py +340 -247
  35. glaip_sdk/utils/rendering/renderer/debug.py +3 -2
  36. glaip_sdk/utils/rendering/renderer/panels.py +11 -10
  37. glaip_sdk/utils/rendering/steps.py +1 -1
  38. glaip_sdk/utils/resource_refs.py +192 -0
  39. glaip_sdk/utils/rich_utils.py +29 -0
  40. glaip_sdk/utils/serialization.py +285 -0
  41. glaip_sdk/utils/validation.py +273 -0
  42. {glaip_sdk-0.0.3.dist-info → glaip_sdk-0.0.5.dist-info}/METADATA +6 -5
  43. glaip_sdk-0.0.5.dist-info/RECORD +55 -0
  44. glaip_sdk/cli/commands/init.py +0 -177
  45. glaip_sdk-0.0.3.dist-info/RECORD +0 -40
  46. {glaip_sdk-0.0.3.dist-info → glaip_sdk-0.0.5.dist-info}/WHEEL +0 -0
  47. {glaip_sdk-0.0.3.dist-info → glaip_sdk-0.0.5.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,273 @@
1
+ """Validation utilities for resource names, timeouts, and other constraints.
2
+
3
+ This module provides pure validation functions that raise ValueError for invalid
4
+ inputs. CLI layer wraps these with click.ClickException for user-friendly errors.
5
+
6
+ Authors:
7
+ Raymond Christopher (raymond.christopher@gdplabs.id)
8
+ """
9
+
10
+ import re
11
+ from pathlib import Path
12
+ from typing import Any
13
+
14
+ from glaip_sdk.utils.resource_refs import validate_name_format
15
+
16
+ # Constants for validation
17
+ RESERVED_NAMES = ["admin", "root", "system", "api", "test", "demo"]
18
+
19
+
20
+ def validate_agent_name(name: str) -> str:
21
+ """Validate agent name and return cleaned version.
22
+
23
+ Args:
24
+ name: Agent name to validate
25
+
26
+ Returns:
27
+ Cleaned agent name
28
+
29
+ Raises:
30
+ ValueError: If name is invalid
31
+ """
32
+ cleaned_name = validate_name_format(name, "agent")
33
+
34
+ # Check for reserved names
35
+ if cleaned_name.lower() in RESERVED_NAMES:
36
+ raise ValueError(f"'{cleaned_name}' is a reserved name and cannot be used")
37
+
38
+ return cleaned_name
39
+
40
+
41
+ def validate_agent_instruction(instruction: str) -> str:
42
+ """Validate agent instruction and return cleaned version.
43
+
44
+ Args:
45
+ instruction: Agent instruction to validate
46
+
47
+ Returns:
48
+ Cleaned agent instruction
49
+
50
+ Raises:
51
+ ValueError: If instruction is invalid
52
+ """
53
+ if not instruction or not instruction.strip():
54
+ raise ValueError("Agent instruction cannot be empty or whitespace")
55
+
56
+ cleaned_instruction = instruction.strip()
57
+
58
+ if len(cleaned_instruction) > 10000:
59
+ raise ValueError("Agent instruction cannot be longer than 10,000 characters")
60
+
61
+ return cleaned_instruction
62
+
63
+
64
+ def validate_tool_name(name: str) -> str:
65
+ """Validate tool name and return cleaned version.
66
+
67
+ Args:
68
+ name: Tool name to validate
69
+
70
+ Returns:
71
+ Cleaned tool name
72
+
73
+ Raises:
74
+ ValueError: If name is invalid
75
+ """
76
+ cleaned_name = validate_name_format(name, "tool")
77
+
78
+ # Check for reserved names
79
+ if cleaned_name.lower() in RESERVED_NAMES:
80
+ raise ValueError(f"'{cleaned_name}' is a reserved name and cannot be used")
81
+
82
+ return cleaned_name
83
+
84
+
85
+ def validate_mcp_name(name: str) -> str:
86
+ """Validate MCP name and return cleaned version.
87
+
88
+ Args:
89
+ name: MCP name to validate
90
+
91
+ Returns:
92
+ Cleaned MCP name
93
+
94
+ Raises:
95
+ ValueError: If name is invalid
96
+ """
97
+ cleaned_name = validate_name_format(name, "mcp")
98
+
99
+ # Check for reserved names
100
+ if cleaned_name.lower() in RESERVED_NAMES:
101
+ raise ValueError(f"'{cleaned_name}' is a reserved name and cannot be used")
102
+
103
+ return cleaned_name
104
+
105
+
106
+ def validate_timeout(timeout: int) -> int:
107
+ """Validate timeout value.
108
+
109
+ Args:
110
+ timeout: Timeout value in seconds
111
+
112
+ Returns:
113
+ Validated timeout value
114
+
115
+ Raises:
116
+ ValueError: If timeout is invalid
117
+ """
118
+ if timeout < 1:
119
+ raise ValueError("Timeout must be at least 1 second")
120
+
121
+ if timeout > 3600: # 1 hour max
122
+ raise ValueError("Timeout cannot be longer than 1 hour (3600 seconds)")
123
+
124
+ return timeout
125
+
126
+
127
+ def coerce_timeout(value: Any) -> int:
128
+ """Coerce timeout value to integer, handling various input types.
129
+
130
+ Args:
131
+ value: The timeout value to coerce (int, float, str, etc.)
132
+
133
+ Returns:
134
+ Integer timeout value
135
+
136
+ Raises:
137
+ ValueError: If value cannot be coerced to valid timeout
138
+
139
+ Examples:
140
+ coerce_timeout(300) -> 300
141
+ coerce_timeout(300.0) -> 300
142
+ coerce_timeout("300") -> 300
143
+ coerce_timeout(None) -> 300 # Uses DEFAULT_AGENT_RUN_TIMEOUT
144
+ """
145
+ from glaip_sdk.config.constants import DEFAULT_AGENT_RUN_TIMEOUT
146
+
147
+ if value is None:
148
+ return DEFAULT_AGENT_RUN_TIMEOUT
149
+ elif isinstance(value, int):
150
+ return validate_timeout(value)
151
+ elif isinstance(value, float):
152
+ if value.is_integer():
153
+ return validate_timeout(int(value))
154
+ return validate_timeout(int(value)) # Truncate if not integer
155
+ elif isinstance(value, str):
156
+ try:
157
+ fval = float(value)
158
+ return validate_timeout(int(fval))
159
+ except ValueError:
160
+ raise ValueError(f"Invalid timeout value: {value}")
161
+ else:
162
+ try:
163
+ return validate_timeout(int(value))
164
+ except (TypeError, ValueError):
165
+ raise ValueError(f"Invalid timeout value: {value}")
166
+
167
+
168
+ def validate_file_path(file_path: str | Path, must_exist: bool = True) -> Path:
169
+ """Validate file path.
170
+
171
+ Args:
172
+ file_path: File path to validate
173
+ must_exist: Whether file must exist
174
+
175
+ Returns:
176
+ Path object
177
+
178
+ Raises:
179
+ ValueError: If file path is invalid
180
+ """
181
+ path = Path(file_path)
182
+
183
+ if must_exist and not path.exists():
184
+ raise ValueError(f"File does not exist: {file_path}")
185
+
186
+ if must_exist and not path.is_file():
187
+ raise ValueError(f"Path is not a file: {file_path}")
188
+
189
+ return path
190
+
191
+
192
+ def validate_directory_path(dir_path: str | Path, must_exist: bool = True) -> Path:
193
+ """Validate directory path.
194
+
195
+ Args:
196
+ dir_path: Directory path to validate
197
+ must_exist: Whether directory must exist
198
+
199
+ Returns:
200
+ Path object
201
+
202
+ Raises:
203
+ ValueError: If directory path is invalid
204
+ """
205
+ path = Path(dir_path)
206
+
207
+ if must_exist and not path.exists():
208
+ raise ValueError(f"Directory does not exist: {dir_path}")
209
+
210
+ if must_exist and not path.is_dir():
211
+ raise ValueError(f"Path is not a directory: {dir_path}")
212
+
213
+ return path
214
+
215
+
216
+ def validate_url(url: str) -> str:
217
+ """Validate URL format.
218
+
219
+ Args:
220
+ url: URL to validate
221
+
222
+ Returns:
223
+ Validated URL
224
+
225
+ Raises:
226
+ ValueError: If URL is invalid
227
+ """
228
+ url_pattern = re.compile(
229
+ r"^https?://" # http:// or https://
230
+ r"(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?|" # domain...
231
+ r"localhost|" # localhost...
232
+ r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" # ...or ip
233
+ r"(?::\d+)?" # optional port
234
+ r"(?:/?|[/?]\S+)$",
235
+ re.IGNORECASE,
236
+ )
237
+
238
+ if not url_pattern.match(url):
239
+ raise ValueError(f"Invalid URL format: {url}")
240
+
241
+ return url
242
+
243
+
244
+ def validate_api_key(api_key: str) -> str:
245
+ """Validate API key format.
246
+
247
+ Args:
248
+ api_key: API key to validate
249
+
250
+ Returns:
251
+ Validated API key
252
+
253
+ Raises:
254
+ ValueError: If API key is invalid
255
+ """
256
+ if not api_key or not api_key.strip():
257
+ raise ValueError("API key cannot be empty")
258
+
259
+ cleaned_key = api_key.strip()
260
+
261
+ if len(cleaned_key) < 10:
262
+ raise ValueError("API key appears to be too short")
263
+
264
+ if len(cleaned_key) > 200:
265
+ raise ValueError("API key appears to be too long")
266
+
267
+ # Check for potentially invalid characters
268
+ if not re.match(r"^[a-zA-Z0-9_-]+$", cleaned_key):
269
+ raise ValueError(
270
+ "API key contains invalid characters. Only letters, numbers, hyphens, and underscores are allowed."
271
+ )
272
+
273
+ return cleaned_key
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glaip-sdk
3
- Version: 0.0.3
4
- Summary: Python SDK for AI Agent Platform - Simplified CLI Design
3
+ Version: 0.0.5
4
+ Summary: Python SDK for GL AIP (GDP Labs AI Agent Package) - Simplified CLI Design
5
5
  Author-email: Raymond Christopher <raymond.christopher@gdplabs.id>
6
6
  License: MIT
7
7
  Requires-Python: >=3.10
@@ -15,13 +15,14 @@ Requires-Dist: readchar<5.0.0,>=4.2.1
15
15
  Requires-Dist: rich>=13.0.0
16
16
  Provides-Extra: dev
17
17
  Requires-Dist: pre-commit>=4.3.0; extra == 'dev'
18
+ Requires-Dist: pytest-asyncio>=0.23.6; extra == 'dev'
18
19
  Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
19
20
  Requires-Dist: pytest-dotenv>=0.5.2; extra == 'dev'
20
21
  Requires-Dist: pytest-xdist>=3.8.0; extra == 'dev'
21
22
  Requires-Dist: pytest>=7.0.0; extra == 'dev'
22
23
  Description-Content-Type: text/markdown
23
24
 
24
- # AIP SDK — Enterprise AI Agent Platform (Python)
25
+ # GL AIP SDK — Enterprise AI Agent Package (Python)
25
26
 
26
27
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
27
28
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -230,7 +231,7 @@ agent.delete()
230
231
  **CLI:**
231
232
  ```bash
232
233
  # Configure and create your first agent
233
- aip init
234
+ aip configure
234
235
  aip agents create --name "hello" --instruction "You are a helpful assistant"
235
236
  aip agents run <AGENT_ID> --input "Hello! What can you do?"
236
237
  aip agents delete <AGENT_ID>
@@ -431,7 +432,7 @@ tool.delete()
431
432
 
432
433
  ```bash
433
434
  # Configure
434
- aip init
435
+ aip configure
435
436
 
436
437
  # Agents
437
438
  aip agents create --name "helper" --instruction "You are helpful"
@@ -0,0 +1,55 @@
1
+ glaip_sdk/__init__.py,sha256=AmY3ggfFTMzWNiHc6RYkdr-IgDqU6CZvU7PGdoyVULg,370
2
+ glaip_sdk/_version.py,sha256=Rb9YLDvK1DXCVFrjlLDbtucpwKh_PyCnmZ-ia9VX3Cc,1650
3
+ glaip_sdk/branding.py,sha256=TLx2j4q3QJrmsbQsvtbd9Ta99rQkX8HzYIDwy-D8tz4,5301
4
+ glaip_sdk/exceptions.py,sha256=QTVtwxRHMN4e8gGn0icXphZvdugiRvcSrlMYylwGsDc,1993
5
+ glaip_sdk/models.py,sha256=d8VSE1lm8jR0p_ep8cNaPZ6h2FfKudeAtCZlTxrw_wc,8729
6
+ glaip_sdk/rich_components.py,sha256=pmJd-81OQE8bC9UOXtga5rsax4zphKlzCZ1JoWbbQzQ,803
7
+ glaip_sdk/cli/__init__.py,sha256=xCCfuF1Yc7mpCDcfhHZTX0vizvtrDSLeT8MJ3V7m5A0,156
8
+ glaip_sdk/cli/agent_config.py,sha256=VHjebw68wAdhGUzYdPH8qz10oADZPRgUQcPW6F7iHIU,2421
9
+ glaip_sdk/cli/display.py,sha256=wFYReJQ0VTiQYepWd6uFLvHdYkpAj321o8e7P2zSvfY,8058
10
+ glaip_sdk/cli/io.py,sha256=9DxJsuJyl_kDkxXCt661mZIpBxnfT7rvJ6Xq2a1ie5M,3326
11
+ glaip_sdk/cli/main.py,sha256=U13On-zpLZLTDbruWHDhkgo6HYbcxrc5SL9ttiXsnlw,10414
12
+ glaip_sdk/cli/resolution.py,sha256=FlWEg7Frtw2jwdLLfed58mTXsUv73loI677CezDp4KM,1619
13
+ glaip_sdk/cli/utils.py,sha256=dwiZ6P6j75fcE_hDmLmV2IfrIlXsVdFWR4EI_1LMhqU,29653
14
+ glaip_sdk/cli/validators.py,sha256=0VXG91hVlFVGYMfk5gm1XpiRqDKS_3wWfmfjPZmWPYw,5446
15
+ glaip_sdk/cli/commands/__init__.py,sha256=ZAzgT9y68_BbSpuIClPoZureIxEM8gqmG9qL3iFkCyQ,173
16
+ glaip_sdk/cli/commands/agents.py,sha256=xd8zFF8J7Qdes5ywFGhqSpEpe9UhB9oLJfrhT3kbr-I,33989
17
+ glaip_sdk/cli/commands/configure.py,sha256=5Rr_gGc7j53CipCC9shE4uyvpX-06Sif0p2YpbAz33s,7306
18
+ glaip_sdk/cli/commands/mcps.py,sha256=HK3XCnVajjnU02eFHzVtqCEJK5X39ozt9ag-fe32tRM,12476
19
+ glaip_sdk/cli/commands/models.py,sha256=JhVhH-c5V-VkxJu4jXvm2hmaeU7LXuT9KOH9XWcpubg,1417
20
+ glaip_sdk/cli/commands/tools.py,sha256=1Qm-FrWkxF-pjsU0jP9MSW4L1gfzqIYDiZdDy7qhQRg,17475
21
+ glaip_sdk/client/__init__.py,sha256=nYLXfBVTTWwKjP0e63iumPYO4k5FifwWaELQPaPIKIg,188
22
+ glaip_sdk/client/agents.py,sha256=j6MljkfVIDAL5sAa0fcIre_ZjQ_1co9pGhqFphBPT8c,30702
23
+ glaip_sdk/client/base.py,sha256=NcxiM2oGKXktNi4zubljO5OhD3DCEP-X0KfuJ9QY4xg,12098
24
+ glaip_sdk/client/main.py,sha256=LlvYHP7-Hy7Eq1ep1kfk337K-Oue5SdKWJpqYfX9eXY,7993
25
+ glaip_sdk/client/mcps.py,sha256=yxwrAtztElYDEGhp2EHRpeYUxNsOlTLTqtw9jSKJmcI,8936
26
+ glaip_sdk/client/tools.py,sha256=ZvRRbXHvd33XUKqmKAIFSvz_IO-1glTvJNyxOeivK9Q,15962
27
+ glaip_sdk/client/validators.py,sha256=3MtOt11IivEwQAgzmdRGWUBzP223ytECOLU_a77x7IU,7101
28
+ glaip_sdk/config/constants.py,sha256=mOH2conxcj8t-bGhwgP_iFX4NMkNEm-9k5QN2F8yqyY,925
29
+ glaip_sdk/utils/__init__.py,sha256=9Y4eCjXx9_t_29CfnH-ChCf2b0YsYCLSJN9s9_HnzLo,926
30
+ glaip_sdk/utils/agent_config.py,sha256=b7_J5DELyk0b_XEoi7tsxbS3wqzAKbMa-3_C-65pPIY,6791
31
+ glaip_sdk/utils/client_utils.py,sha256=JdmP2OolXy83lzXxKDvswRw3bCorh2c3Gm5uy-sDeXQ,11839
32
+ glaip_sdk/utils/display.py,sha256=BHVD194MS1vEWm5oaLfEx_vxGoUyHGMGcQJDnKLh2AI,3071
33
+ glaip_sdk/utils/general.py,sha256=YolKDCs1wNcefQ9fOk5wd9prSxJZe1-PHsZSH1a8wDQ,2186
34
+ glaip_sdk/utils/import_export.py,sha256=-XX21D0emPyC6EWpBsxySU1-lb3dkY1jJEjx11oLa6I,4503
35
+ glaip_sdk/utils/resource_refs.py,sha256=0YzblJNfRhz9xhpaKE9aE68XEV-6_ssr0fIkiMVOka0,5489
36
+ glaip_sdk/utils/rich_utils.py,sha256=8jPG8HsDTr6nj2vh4_be5ULCGxG1ZSinJqHZT6pdXsY,755
37
+ glaip_sdk/utils/run_renderer.py,sha256=JGQzXymsptgr927-F49H1AOT5bzqErDXZMF2pOxqbfw,1365
38
+ glaip_sdk/utils/serialization.py,sha256=eqbxPOBxuJ88NpES_rGWs1m7QJcs00IwhFOk1GHoZyE,7803
39
+ glaip_sdk/utils/validation.py,sha256=QjBRsYFrP8MLl-xMq68Sk-Gyev-EGLGiY2l5t0ALySc,6990
40
+ glaip_sdk/utils/rendering/__init__.py,sha256=vXjwk5rPhhfPyD8S0DnV4GFFEtPJp4HCCg1Um9SXfs0,70
41
+ glaip_sdk/utils/rendering/formatting.py,sha256=zTF5E7BcswaIHHGFMjy1ylo6kJfpLQmeeAgFYITthcU,7165
42
+ glaip_sdk/utils/rendering/models.py,sha256=ffPMv4XrKY4V2-THL69KONZf1NL7msIa-jVZAVuz2Js,1559
43
+ glaip_sdk/utils/rendering/steps.py,sha256=SPImcV6f-TY_ITLyi4mSTeTu4SJxlMN7fWEKfDLL3Z8,5862
44
+ glaip_sdk/utils/rendering/renderer/__init__.py,sha256=EXwVBmGkSYcype4ocAXo69Z1kXu0gpNXmhH5LW0_B7A,2939
45
+ glaip_sdk/utils/rendering/renderer/base.py,sha256=LjtJmEs_pAw4uux1XgfZRJGA-myPzCCpwmYbBg0io98,34067
46
+ glaip_sdk/utils/rendering/renderer/config.py,sha256=E4ER8TJJbqr1hcWjkwG7XROqLuccQy4EL99CbuLvSXE,783
47
+ glaip_sdk/utils/rendering/renderer/console.py,sha256=ibQU07rmrWw-MMX6n3J2ewxuOEY-Z6RnKEfzMH2-IrA,1744
48
+ glaip_sdk/utils/rendering/renderer/debug.py,sha256=VqpQAmBA3DtHVIqIeWJSgrycmzORUBk1kJ5m6b3tz4s,2884
49
+ glaip_sdk/utils/rendering/renderer/panels.py,sha256=_KJohKOsyOBkqKzlC-hOSwZt1SGsJRhQwizlrRgWMis,3040
50
+ glaip_sdk/utils/rendering/renderer/progress.py,sha256=i4HG_iNwtK4c3Gf2sviLCiOJ-5ydX4t-YE5dgtLOxNI,3438
51
+ glaip_sdk/utils/rendering/renderer/stream.py,sha256=ZKitYkt_7OirNeERu3cc_NybQ8mWUMoEstg9UL1S090,7323
52
+ glaip_sdk-0.0.5.dist-info/METADATA,sha256=GQzSBnzl6crtUAyodylGBwhWEDLQrS2BUvM93CGHSjA,19584
53
+ glaip_sdk-0.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
54
+ glaip_sdk-0.0.5.dist-info/entry_points.txt,sha256=65vNPUggyYnVGhuw7RhNJ8Fp2jygTcX0yxJBcBY3iLU,48
55
+ glaip_sdk-0.0.5.dist-info/RECORD,,
@@ -1,177 +0,0 @@
1
- """CLI initialization command.
2
-
3
- Authors:
4
- Raymond Christopher (raymond.christopher@gdplabs.id)
5
- """
6
-
7
- import getpass
8
- import os
9
- from pathlib import Path
10
-
11
- import click
12
- import yaml
13
- from rich.console import Console
14
- from rich.panel import Panel
15
-
16
- from glaip_sdk import Client
17
-
18
- console = Console()
19
-
20
-
21
- @click.command()
22
- @click.option("--no-scaffold", is_flag=True, help="Skip creating sample agent and tool")
23
- @click.option("--no-demo", is_flag=True, help="Don't launch interactive demo")
24
- def init_command(no_scaffold, no_demo):
25
- """Initialize AIP project configuration."""
26
-
27
- console.print(
28
- Panel(
29
- "[bold cyan]Welcome to AIP![/bold cyan]\nLet's set up your project.",
30
- title="🚀 AIP Initialization",
31
- border_style="cyan",
32
- )
33
- )
34
-
35
- # Get configuration with better formatting
36
- console.print("\n[bold]Step 1:[/bold] API Configuration")
37
- console.print("─" * 50)
38
-
39
- # Use built-in input for better control
40
- console.print(
41
- "\n[cyan]AIP API URL[/cyan] (default: https://your-aip-instance.com):"
42
- )
43
- api_url = input("> ").strip()
44
- if not api_url:
45
- api_url = "https://your-aip-instance.com"
46
-
47
- console.print() # Add spacing
48
- console.print("[cyan]AIP API Key[/cyan]:")
49
- api_key = getpass.getpass("> ")
50
-
51
- # Project configuration removed - not needed for AIP CLI
52
-
53
- # Create config directory
54
- config_dir = Path.home() / ".aip"
55
- try:
56
- config_dir.mkdir(exist_ok=True)
57
- except Exception as e:
58
- console.print(f"⚠️ Warning: Could not create config directory: {e}")
59
- return
60
-
61
- # Save configuration
62
- config = {"api_url": api_url, "api_key": api_key}
63
-
64
- config_file = config_dir / "config.yaml"
65
- try:
66
- with open(config_file, "w") as f:
67
- yaml.dump(config, f, default_flow_style=False)
68
- except Exception as e:
69
- console.print(f"⚠️ Warning: Could not save configuration: {e}")
70
- return
71
-
72
- # Set secure file permissions (0600) - best effort on all platforms
73
- try:
74
- os.chmod(config_file, 0o600)
75
- except Exception:
76
- # Best effort - may fail on Windows or other non-POSIX systems
77
- pass
78
-
79
- console.print(f"\n✅ Configuration saved to: {config_file}")
80
-
81
- # Create sample agent and tool if requested
82
- if not no_scaffold:
83
- console.print("\n[bold]Step 2:[/bold] Sample Resources")
84
- console.print("─" * 50)
85
-
86
- console.print("\n[cyan]Create sample agent & tool?[/cyan] (Y/n):")
87
- create_sample_resources = input("> ").strip().lower()
88
- if create_sample_resources in ["", "y", "yes"]:
89
- try:
90
- # Set environment variables
91
- os.environ["AIP_API_URL"] = api_url
92
- os.environ["AIP_API_KEY"] = api_key
93
-
94
- client = Client()
95
-
96
- # Create sample agent
97
- agent = client.create_agent(
98
- name="hello-world",
99
- instruction="You are a helpful AI assistant that says hello",
100
- )
101
- console.print(f"✅ Created sample agent: {agent.name} (id: {agent.id})")
102
-
103
- # Create sample tool
104
- tool_content = '''def hello_tool(name="World"):
105
- """A simple hello tool."""
106
- return f"Hello, {name}!"
107
- '''
108
- with open("greeting_tool.py", "w") as f:
109
- f.write(tool_content)
110
-
111
- tool = client.create_tool("greeting_tool.py", framework="langchain")
112
- console.print(f"✅ Created sample tool: {tool.name} (id: {tool.id})")
113
-
114
- except Exception as e:
115
- console.print(f"⚠️ Warning: Could not create sample resources: {e}")
116
-
117
- # Launch interactive demo if requested
118
- if not no_demo:
119
- console.print("\n[bold]Step 3:[/bold] Interactive Demo")
120
- console.print("─" * 50)
121
-
122
- console.print("\n[cyan]Start an interactive demo now?[/cyan] (Y/n):")
123
- launch_demo = input("> ").strip().lower()
124
- if launch_demo in ["", "y", "yes"]:
125
- launch_interactive_demo()
126
-
127
- console.print("\n🎉 [bold green]AIP initialization complete![/bold green]")
128
- console.print(f"📁 Configuration: {config_file}")
129
- console.print("💡 Next steps:")
130
- console.print(" • Run 'aip agents list' to see your agents")
131
- console.print(" • Run 'aip tools list' to see your tools")
132
- console.print(" • Run 'aip status' to check connection")
133
-
134
-
135
- def launch_interactive_demo():
136
- """Launch interactive demo with sample agent."""
137
- try:
138
- console.print(
139
- Panel(
140
- "[bold green]Interactive Demo[/bold green]\nType to talk to hello-world. Ctrl+C to exit.",
141
- title="🎮 Demo Mode",
142
- border_style="green",
143
- )
144
- )
145
-
146
- client = Client()
147
- agents = client.find_agents(name="hello-world")
148
- if not agents:
149
- console.print("❌ Sample agent not found")
150
- return
151
-
152
- agent = agents[0] # Use the first (and should be only) agent
153
-
154
- while True:
155
- try:
156
- console.print("\n> ", end="")
157
- user_input = input().strip()
158
- if user_input.lower() in ["exit", "quit", "bye"]:
159
- break
160
-
161
- if not user_input: # Skip empty inputs
162
- continue
163
-
164
- response = agent.run(user_input)
165
- console.print(f"🤖 {response}")
166
-
167
- except KeyboardInterrupt:
168
- break
169
- except Exception as e:
170
- console.print(f"❌ Error: {e}")
171
-
172
- except Exception as e:
173
- console.print(f"⚠️ Could not launch demo: {e}")
174
-
175
-
176
- # Note: The init command should be registered in main.py, not here
177
- # This prevents circular imports
@@ -1,40 +0,0 @@
1
- glaip_sdk/__init__.py,sha256=UGBsYHHSgSc1HGCTsA9bbz2ARJJ1g49cTieXEINHtAk,323
2
- glaip_sdk/_version.py,sha256=Rb9YLDvK1DXCVFrjlLDbtucpwKh_PyCnmZ-ia9VX3Cc,1650
3
- glaip_sdk/exceptions.py,sha256=QTVtwxRHMN4e8gGn0icXphZvdugiRvcSrlMYylwGsDc,1993
4
- glaip_sdk/models.py,sha256=i_MumCH0PvqEJLsUrGm7vkytxnhsJ3YtWq2y6H-JVzQ,7235
5
- glaip_sdk/cli/__init__.py,sha256=cPI-uOOBww_ESiH6NQBdJiTg8CUVNigFOU3kl0tgTuI,143
6
- glaip_sdk/cli/main.py,sha256=Xx7kNbnWV--oLh-DxfR94a2rGecziwi_JHIFkwEqj70,10133
7
- glaip_sdk/cli/utils.py,sha256=PeVsG84-i1UbX-ETDUPrrLuismRQZTJLQdBvOqWia6Q,25540
8
- glaip_sdk/cli/commands/__init__.py,sha256=WShiuYqHcbuexPboibDJ_Q2jOPIWp-TgsyUAO2-T20I,134
9
- glaip_sdk/cli/commands/agents.py,sha256=5-bhSo_lXFhhpJRAPd9Z0lxQq4Yg_OImRBVwk-debko,17331
10
- glaip_sdk/cli/commands/configure.py,sha256=2MDQ5Q-Rrd7T3eO8ThKJZz_B3-Gqp3UFKk-rrnmPPvk,7135
11
- glaip_sdk/cli/commands/init.py,sha256=Er8UH2aMpnLJ9aiSBOfp26__G1ll5L7W-CYaiHpats8,5778
12
- glaip_sdk/cli/commands/mcps.py,sha256=09KlY9ICjinuTkZvLKDsyOT3Ahz4zk_LJPZqhJrc9Lk,11956
13
- glaip_sdk/cli/commands/models.py,sha256=j8VqQ2edSEvD-sQXWm8ifUco9gX8J-OBib6OvzthpqU,1405
14
- glaip_sdk/cli/commands/tools.py,sha256=0YVJ7Z4g5Saor2M0jCp2B2BzkgfVaE5Wr4S-7oSpV6U,14397
15
- glaip_sdk/client/__init__.py,sha256=jnsD3HCiOGiuL_4aqJiVnBsF8HNFS-s_aNLfg26gJqs,7530
16
- glaip_sdk/client/agents.py,sha256=PF-4HF2gx8E3uA5Xx6rQcEzKI9svaYgJPBuO8Ze-wdQ,14000
17
- glaip_sdk/client/base.py,sha256=3Ri5GVYrZ4cZ5lex1pyG0nvEmGxeXwAY194MxSH1_cY,9463
18
- glaip_sdk/client/mcps.py,sha256=UEwgFbl4ogeozfJGcUbQQ7JGfwYliN9i5V6fTvkbOZ0,4311
19
- glaip_sdk/client/tools.py,sha256=RMSDFeaV0u_iE331d66hkinz4a1_GWfBRbyrOEejvYA,8610
20
- glaip_sdk/client/validators.py,sha256=3MtOt11IivEwQAgzmdRGWUBzP223ytECOLU_a77x7IU,7101
21
- glaip_sdk/config/constants.py,sha256=Pm0tGYiJ9VdW9XXz0CG36l8-sAhnlFPTKbHKKleUgik,705
22
- glaip_sdk/utils/__init__.py,sha256=5pOPBTjJ4hzvMNYjLnTut_ovwU8QJ39kARKx9-qr5Qs,5101
23
- glaip_sdk/utils/client_utils.py,sha256=O44OlbQD4X0cMo_3E_Ysb_XyfEG20v0wecl5SlM9kxo,9407
24
- glaip_sdk/utils/run_renderer.py,sha256=JGQzXymsptgr927-F49H1AOT5bzqErDXZMF2pOxqbfw,1365
25
- glaip_sdk/utils/rendering/__init__.py,sha256=vXjwk5rPhhfPyD8S0DnV4GFFEtPJp4HCCg1Um9SXfs0,70
26
- glaip_sdk/utils/rendering/formatting.py,sha256=HPCBcpWP3EpSXsIgfm-uWm6Fjo6VWzqxrnhEc137wjA,6941
27
- glaip_sdk/utils/rendering/models.py,sha256=ffPMv4XrKY4V2-THL69KONZf1NL7msIa-jVZAVuz2Js,1559
28
- glaip_sdk/utils/rendering/steps.py,sha256=qx6aNhfYYAbcXaHws-zdHOc4Yw3me3Cd19SZkZluJvg,5837
29
- glaip_sdk/utils/rendering/renderer/__init__.py,sha256=kZwCYRcQdK-9sfZPxAAqLB--A2icLbSKq7AW1_NIIGQ,987
30
- glaip_sdk/utils/rendering/renderer/base.py,sha256=IRQMNW4WHPRpBFXfXuHSo8oOWi4-Tn1_hF9a9x0_q3c,32288
31
- glaip_sdk/utils/rendering/renderer/config.py,sha256=E4ER8TJJbqr1hcWjkwG7XROqLuccQy4EL99CbuLvSXE,783
32
- glaip_sdk/utils/rendering/renderer/console.py,sha256=ibQU07rmrWw-MMX6n3J2ewxuOEY-Z6RnKEfzMH2-IrA,1744
33
- glaip_sdk/utils/rendering/renderer/debug.py,sha256=2XP6A4w3EIjVVY_M-BDPvHf05QQSz0TDTo-dRPf1fSc,2862
34
- glaip_sdk/utils/rendering/renderer/panels.py,sha256=iTDJoRBaa73pX9z9nTcb6aKhfXe1Mds0RzCuhwtvkdc,2994
35
- glaip_sdk/utils/rendering/renderer/progress.py,sha256=i4HG_iNwtK4c3Gf2sviLCiOJ-5ydX4t-YE5dgtLOxNI,3438
36
- glaip_sdk/utils/rendering/renderer/stream.py,sha256=ZKitYkt_7OirNeERu3cc_NybQ8mWUMoEstg9UL1S090,7323
37
- glaip_sdk-0.0.3.dist-info/METADATA,sha256=Rtei3FvfrthFvPqL3t1biMy6zvxiwAsCyJi_iB-6KHk,19501
38
- glaip_sdk-0.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- glaip_sdk-0.0.3.dist-info/entry_points.txt,sha256=65vNPUggyYnVGhuw7RhNJ8Fp2jygTcX0yxJBcBY3iLU,48
40
- glaip_sdk-0.0.3.dist-info/RECORD,,