celesto 0.0.1.dev0__tar.gz → 0.0.2__tar.gz

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.
@@ -0,0 +1,26 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Check out repository
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v3
18
+
19
+ - name: Set up Python
20
+ run: uv python install 3.12
21
+
22
+ - name: Install dependencies
23
+ run: uv sync --group dev
24
+
25
+ - name: Run tests
26
+ run: uv run pytest
@@ -0,0 +1,62 @@
1
+ # Celesto SDK - GitHub Copilot Instructions
2
+
3
+ ## Project Overview
4
+
5
+ Celesto SDK is a Python client + CLI for the Celesto AI platform. It provides:
6
+ - A typed Python SDK (`CelestoSDK`) for Deployments and GateKeeper.
7
+ - A CLI (`celesto`) for deployment and A2A utilities.
8
+
9
+ ## Repository Structure
10
+
11
+ ```
12
+ celesto-sdk/
13
+ ├── src/celesto/ # SDK + CLI source code
14
+ │ ├── sdk/ # SDK client, exceptions, types
15
+ │ ├── main.py # CLI app entrypoint (typer)
16
+ │ ├── deployment.py # CLI deployment helpers
17
+ │ ├── a2a.py # CLI A2A helpers
18
+ │ └── proxy.py # CLI MCP proxy helper
19
+ ├── tests/ # Test suite
20
+ ├── pyproject.toml # Project metadata and dependencies
21
+ └── README.md # Usage and install docs
22
+ ```
23
+
24
+ ## Development Setup
25
+
26
+ - Python >= 3.10
27
+ - Install deps with uv (recommended):
28
+
29
+ ```bash
30
+ pip install uv
31
+ uv venv
32
+ uv sync
33
+ ```
34
+
35
+ Or with pip:
36
+
37
+ ```bash
38
+ pip install -e .
39
+ ```
40
+
41
+ ## Code Style and Linting
42
+
43
+ - **Ruff** is the linter and formatter.
44
+
45
+ ```bash
46
+ uv run ruff check .
47
+ uv run ruff format .
48
+ ```
49
+
50
+ ## Tests
51
+
52
+ ```bash
53
+ uv run pytest
54
+ ```
55
+
56
+ ## Development Guidelines
57
+
58
+ - Make minimal, targeted changes.
59
+ - Keep functions focused and well-documented.
60
+ - Avoid placeholders like `# ... rest of code ...`.
61
+ - Prefer clear, explicit error messages.
62
+ - Maintain backwards compatibility where possible (public SDK/CLI).
celesto-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,543 @@
1
+ Metadata-Version: 2.4
2
+ Name: celesto
3
+ Version: 0.0.2
4
+ Summary: Python SDK and CLI for the Celesto AI platform.
5
+ Project-URL: Homepage, https://celesto.ai
6
+ Project-URL: Documentation, https://docs.celesto.ai/celesto-sdk
7
+ Project-URL: Repository, https://github.com/CelestoAI/sdk
8
+ Project-URL: Source Code, https://github.com/CelestoAI/sdk
9
+ Project-URL: Issue Tracker, https://github.com/CelestoAI/sdk/issues
10
+ Project-URL: Changelog, https://github.com/CelestoAI/sdk/releases
11
+ Author-email: Aniket Maurya <aniket@celesto.ai>
12
+ Maintainer-email: Aniket Maurya <aniket@celesto.ai>
13
+ License-Expression: Apache-2.0
14
+ License-File: LICENSE
15
+ Keywords: agent-deployment,agents,ai,ai-platform,api,celesto,delegated-access,deployment,gatekeeper,google-drive,oauth,sdk
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Topic :: Internet :: WWW/HTTP
28
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
+ Classifier: Typing :: Typed
31
+ Requires-Python: >=3.10
32
+ Requires-Dist: a2a-sdk>=0.3.10
33
+ Requires-Dist: fastmcp>=2.7.1
34
+ Requires-Dist: httpx>=0.27.0
35
+ Requires-Dist: python-dotenv>=1.0.0
36
+ Requires-Dist: rich>=14.0.0
37
+ Requires-Dist: typer>=0.20.0
38
+ Requires-Dist: typing-extensions>=4.10.0
39
+ Description-Content-Type: text/markdown
40
+
41
+ # Celesto SDK
42
+
43
+ [![PyPI version](https://badge.fury.io/py/celesto.svg)](https://pypi.org/project/celesto/)
44
+ [![Python](https://img.shields.io/pypi/pyversions/celesto.svg)](https://pypi.org/project/celesto/)
45
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
46
+
47
+ Python SDK and CLI for the [Celesto AI platform](https://celesto.ai) - Deploy and manage AI agents with built-in delegated access to user resources.
48
+
49
+ ## What is Celesto?
50
+
51
+ Celesto is a managed AI platform that enables you to:
52
+ - **Deploy AI agents** to production with automatic scaling and monitoring
53
+ - **Manage delegated access** to end-user resources (Google Drive, etc.) through GateKeeper
54
+ - **Build faster** with infrastructure handled for you
55
+
56
+ ## Features
57
+
58
+ - **Agent Deployment**: Deploy your AI agents as containerized applications with zero infrastructure management
59
+ - **GateKeeper**: Secure delegated access management with OAuth and fine-grained permissions for user resources
60
+ - **CLI & SDK**: Flexible interfaces for both interactive usage and programmatic integration
61
+ - **Project Organization**: Organize your agents and access rules by projects
62
+ - **Automatic Scaling**: Your agents scale automatically based on demand
63
+
64
+ ## Installation
65
+
66
+ ```bash
67
+ pip install celesto
68
+ ```
69
+
70
+ **Requirements:** Python 3.10 or higher
71
+
72
+ ## Quick Start
73
+
74
+ ### 1. Get Your API Key
75
+
76
+ Sign up at [celesto.ai](https://celesto.ai) and get your API key from **Settings → Security**.
77
+
78
+ ### 2. Configure Environment
79
+
80
+ ```bash
81
+ export CELESTO_API_KEY="your-api-key-here"
82
+ export CELESTO_PROJECT_NAME="your-project-name" # Optional: set default project
83
+ ```
84
+
85
+ ### 3. Deploy Your First Agent
86
+
87
+ ```python
88
+ from celesto.sdk import CelestoSDK
89
+ from pathlib import Path
90
+
91
+ with CelestoSDK() as client:
92
+ result = client.deployment.deploy(
93
+ folder=Path("./my-agent"),
94
+ name="my-agent",
95
+ description="My AI assistant",
96
+ project_name="My Project"
97
+ )
98
+ print(f"Deployed! Status: {result['status']}")
99
+ ```
100
+
101
+ ## Authentication
102
+
103
+ The SDK supports two authentication methods:
104
+
105
+ ### Environment Variable (Recommended)
106
+
107
+ ```bash
108
+ export CELESTO_API_KEY="your-api-key"
109
+ ```
110
+
111
+ ```python
112
+ from celesto.sdk import CelestoSDK
113
+
114
+ client = CelestoSDK() # Automatically uses CELESTO_API_KEY
115
+ ```
116
+
117
+ ### Explicit API Key
118
+
119
+ ```python
120
+ from celesto.sdk import CelestoSDK
121
+
122
+ client = CelestoSDK(api_key="your-api-key")
123
+ ```
124
+
125
+ ### Context Manager (Best Practice)
126
+
127
+ Use the context manager to ensure proper resource cleanup:
128
+
129
+ ```python
130
+ with CelestoSDK() as client:
131
+ deployments = client.deployment.list()
132
+ # Resources automatically cleaned up
133
+ ```
134
+
135
+ ## Core Concepts
136
+
137
+ ### Projects
138
+
139
+ Projects are organizational units that group your deployments and access connections. You can specify a project by:
140
+ - Setting `CELESTO_PROJECT_NAME` environment variable
141
+ - Passing `project_name` parameter to methods
142
+ - If not specified, the SDK uses your first available project
143
+
144
+ ### Deployments
145
+
146
+ Deployments are your AI agents running on Celesto's managed infrastructure. Each deployment:
147
+ - Runs in an isolated container
148
+ - Scales automatically based on load
149
+ - Can have custom environment variables
150
+ - Belongs to a specific project
151
+
152
+ ### GateKeeper
153
+
154
+ GateKeeper manages delegated access to end-user resources (like Google Drive). It handles:
155
+ - OAuth authorization flows
156
+ - Connection management per user (subject)
157
+ - Fine-grained access rules (folder/file permissions)
158
+ - Secure credential storage
159
+
160
+ ## SDK Reference
161
+
162
+ ### Deployment API
163
+
164
+ #### Deploy an Agent
165
+
166
+ ```python
167
+ from pathlib import Path
168
+
169
+ result = client.deployment.deploy(
170
+ folder=Path("./my-agent"),
171
+ name="weather-bot",
172
+ description="A bot that provides weather information",
173
+ envs={
174
+ "OPENAI_API_KEY": "sk-...",
175
+ "DEBUG": "false"
176
+ },
177
+ project_name="My Project"
178
+ )
179
+
180
+ print(f"Deployment ID: {result['id']}")
181
+ print(f"Status: {result['status']}") # "READY" or "BUILDING"
182
+ ```
183
+
184
+ **Parameters:**
185
+ - `folder` (Path): Directory containing your agent code
186
+ - `name` (str): Unique deployment name
187
+ - `description` (str, optional): Human-readable description
188
+ - `envs` (dict, optional): Environment variables for your agent
189
+ - `project_name` (str, optional): Project to deploy to (defaults to `CELESTO_PROJECT_NAME` or first project)
190
+
191
+ #### List Deployments
192
+
193
+ ```python
194
+ deployments = client.deployment.list()
195
+
196
+ for dep in deployments:
197
+ print(f"{dep['name']}: {dep['status']}")
198
+ ```
199
+
200
+ ### GateKeeper API
201
+
202
+ #### Connect a User (Initiate OAuth)
203
+
204
+ ```python
205
+ # Initiate delegated access for a user
206
+ result = client.gatekeeper.connect(
207
+ subject="user:john@example.com",
208
+ project_name="my-project",
209
+ provider="google_drive"
210
+ )
211
+
212
+ if oauth_url := result.get("oauth_url"):
213
+ print(f"User must authorize at: {oauth_url}")
214
+ # Send this URL to the user
215
+ elif result["status"] == "authorized":
216
+ print("User already connected!")
217
+
218
+ print(f"Connection ID: {result['connection_id']}")
219
+ ```
220
+
221
+ **Parameters:**
222
+ - `subject` (str): Unique user identifier (e.g., "user:email@example.com")
223
+ - `project_name` (str): Your project name
224
+ - `provider` (str): OAuth provider (default: "google_drive")
225
+ - `redirect_uri` (str, optional): Custom OAuth callback URL
226
+
227
+ #### List User's Google Drive Files
228
+
229
+ ```python
230
+ files = client.gatekeeper.list_drive_files(
231
+ project_name="my-project",
232
+ subject="user:john@example.com",
233
+ page_size=50,
234
+ include_folders=True
235
+ )
236
+
237
+ for file in files["files"]:
238
+ print(f"{file['name']} ({file['mimeType']})")
239
+
240
+ # Handle pagination
241
+ if next_token := files.get("next_page_token"):
242
+ more_files = client.gatekeeper.list_drive_files(
243
+ project_name="my-project",
244
+ subject="user:john@example.com",
245
+ page_token=next_token
246
+ )
247
+ ```
248
+
249
+ **Parameters:**
250
+ - `project_name` (str): Your project name
251
+ - `subject` (str): User identifier
252
+ - `page_size` (int): Results per page (1-1000, default: 20)
253
+ - `page_token` (str, optional): Token for pagination
254
+ - `folder_id` (str, optional): List specific folder
255
+ - `query` (str, optional): Google Drive search query
256
+ - `include_folders` (bool): Include folders in results (default: True)
257
+ - `order_by` (str, optional): Sort order
258
+
259
+ #### Configure Access Rules
260
+
261
+ Restrict which files/folders a user can access:
262
+
263
+ ```python
264
+ # Allow access only to specific folders (recursive)
265
+ result = client.gatekeeper.update_access_rules(
266
+ subject="user:john@example.com",
267
+ project_name="my-project",
268
+ allowed_folders=["1A2B3C4D5E6F", "7G8H9I0J1K2L"], # Google Drive folder IDs
269
+ allowed_files=[] # Optional: specific file IDs
270
+ )
271
+
272
+ print(f"Access rules updated. Version: {result['version']}")
273
+ ```
274
+
275
+ **Parameters:**
276
+ - `subject` (str): User identifier
277
+ - `project_name` (str): Your project name
278
+ - `allowed_folders` (list, optional): Folder IDs with recursive access
279
+ - `allowed_files` (list, optional): Individual file IDs
280
+ - `provider` (str, optional): Provider filter
281
+
282
+ #### List Connections
283
+
284
+ ```python
285
+ result = client.gatekeeper.list_connections(
286
+ project_name="my-project",
287
+ status_filter="authorized" # or "pending", "failed"
288
+ )
289
+
290
+ for conn in result["connections"]:
291
+ print(f"{conn['subject']}: {conn['status']}")
292
+ ```
293
+
294
+ #### Revoke Access
295
+
296
+ ```python
297
+ result = client.gatekeeper.revoke_connection(
298
+ subject="user:john@example.com",
299
+ project_name="my-project"
300
+ )
301
+
302
+ print(f"Revoked connection: {result['id']}")
303
+ ```
304
+
305
+ #### Clear Access Rules
306
+
307
+ Remove all restrictions (grant full access):
308
+
309
+ ```python
310
+ # Get connection ID first
311
+ connections = client.gatekeeper.list_connections(project_name="my-project")
312
+ connection_id = connections["connections"][0]["id"]
313
+
314
+ # Clear rules
315
+ result = client.gatekeeper.clear_access_rules(connection_id)
316
+ print(f"Access unrestricted: {result['unrestricted']}") # True
317
+ ```
318
+
319
+ ## CLI Reference
320
+
321
+ The Celesto CLI provides command-line access to all SDK features.
322
+
323
+ ### Deployment Commands
324
+
325
+ ```bash
326
+ # Deploy an agent
327
+ celesto deploy --project "My Project"
328
+
329
+ # List deployments
330
+ celesto ls
331
+ ```
332
+
333
+ ### A2A (Agent-to-Agent) Commands
334
+
335
+ ```bash
336
+ # Get agent card
337
+ celesto a2a get-card --agent http://localhost:8000
338
+
339
+ # Additional A2A commands
340
+ celesto a2a --help
341
+ ```
342
+
343
+ ### General Commands
344
+
345
+ ```bash
346
+ # Show help
347
+ celesto --help
348
+
349
+ # Show version
350
+ celesto --version
351
+ ```
352
+
353
+ ## Error Handling
354
+
355
+ The SDK provides specific exception types for different error scenarios:
356
+
357
+ ```python
358
+ from celesto.sdk import CelestoSDK
359
+ from celesto.sdk.exceptions import (
360
+ CelestoAuthenticationError,
361
+ CelestoNotFoundError,
362
+ CelestoValidationError,
363
+ CelestoRateLimitError,
364
+ CelestoServerError,
365
+ CelestoNetworkError,
366
+ )
367
+
368
+ try:
369
+ with CelestoSDK() as client:
370
+ result = client.deployment.deploy(
371
+ folder=Path("./my-agent"),
372
+ name="my-agent",
373
+ project_name="My Project"
374
+ )
375
+ except CelestoAuthenticationError as e:
376
+ print(f"Authentication failed: {e}")
377
+ print("Check your API key at https://celesto.ai → Settings → Security")
378
+ except CelestoValidationError as e:
379
+ print(f"Invalid input: {e}")
380
+ except CelestoNotFoundError as e:
381
+ print(f"Resource not found: {e}")
382
+ except CelestoRateLimitError as e:
383
+ print(f"Rate limit exceeded. Retry after {e.retry_after} seconds")
384
+ except CelestoServerError as e:
385
+ print(f"Server error: {e}")
386
+ except CelestoNetworkError as e:
387
+ print(f"Network error: {e}")
388
+ ```
389
+
390
+ ### Exception Types
391
+
392
+ - **CelestoAuthenticationError**: Invalid API key or unauthorized (401/403)
393
+ - **CelestoNotFoundError**: Resource not found (404)
394
+ - **CelestoValidationError**: Invalid request parameters (400/422)
395
+ - **CelestoRateLimitError**: Rate limit exceeded (429) - includes `retry_after` attribute
396
+ - **CelestoServerError**: Server-side errors (5xx)
397
+ - **CelestoNetworkError**: Network/connection failures
398
+
399
+ ## Advanced Configuration
400
+
401
+ ### Custom API Endpoint
402
+
403
+ ```python
404
+ # For testing or custom deployments
405
+ client = CelestoSDK(
406
+ api_key="your-key",
407
+ base_url="https://custom-api.example.com/v1"
408
+ )
409
+ ```
410
+
411
+ Or via environment variable:
412
+
413
+ ```bash
414
+ export CELESTO_BASE_URL="https://custom-api.example.com/v1"
415
+ ```
416
+
417
+ ### Resource Cleanup
418
+
419
+ Always close the client when done, or use a context manager:
420
+
421
+ ```python
422
+ # Manual cleanup
423
+ client = CelestoSDK()
424
+ try:
425
+ deployments = client.deployment.list()
426
+ finally:
427
+ client.close()
428
+
429
+ # Context manager (recommended)
430
+ with CelestoSDK() as client:
431
+ deployments = client.deployment.list()
432
+ # Automatically closed
433
+ ```
434
+
435
+ ## Examples
436
+
437
+ ### Complete Deployment Workflow
438
+
439
+ ```python
440
+ from celesto.sdk import CelestoSDK
441
+ from pathlib import Path
442
+ import os
443
+
444
+ # Set environment
445
+ os.environ["CELESTO_API_KEY"] = "your-api-key"
446
+
447
+ with CelestoSDK() as client:
448
+ # Deploy agent
449
+ deployment = client.deployment.deploy(
450
+ folder=Path("./my-agent"),
451
+ name="production-bot-v2",
452
+ description="Production chatbot version 2",
453
+ envs={
454
+ "OPENAI_API_KEY": os.environ["OPENAI_API_KEY"],
455
+ "ENVIRONMENT": "production"
456
+ },
457
+ project_name="Production"
458
+ )
459
+
460
+ print(f"Deployed: {deployment['id']}")
461
+ print(f"Status: {deployment['status']}")
462
+
463
+ # List all deployments
464
+ all_deployments = client.deployment.list()
465
+ print(f"\nTotal deployments: {len(all_deployments)}")
466
+ ```
467
+
468
+ ### Complete GateKeeper Workflow
469
+
470
+ ```python
471
+ from celesto.sdk import CelestoSDK
472
+
473
+ with CelestoSDK() as client:
474
+ project = "my-saas-app"
475
+ user = "user:alice@example.com"
476
+
477
+ # Step 1: Initiate connection
478
+ conn = client.gatekeeper.connect(
479
+ subject=user,
480
+ project_name=project
481
+ )
482
+
483
+ if oauth_url := conn.get("oauth_url"):
484
+ print(f"Send user to: {oauth_url}")
485
+ # Wait for user to authorize...
486
+
487
+ # Step 2: Configure access rules (limit to specific folders)
488
+ rules = client.gatekeeper.update_access_rules(
489
+ subject=user,
490
+ project_name=project,
491
+ allowed_folders=["shared_folder_id_123"]
492
+ )
493
+ print(f"Access rules set: {rules}")
494
+
495
+ # Step 3: List accessible files
496
+ files = client.gatekeeper.list_drive_files(
497
+ project_name=project,
498
+ subject=user,
499
+ page_size=100
500
+ )
501
+
502
+ print(f"\nAccessible files: {len(files['files'])}")
503
+ for file in files["files"]:
504
+ print(f" - {file['name']}")
505
+
506
+ # Step 4: Revoke when done
507
+ # client.gatekeeper.revoke_connection(
508
+ # subject=user,
509
+ # project_name=project
510
+ # )
511
+ ```
512
+
513
+ ## Documentation
514
+
515
+ - **API Documentation**: https://docs.celesto.ai/celesto-sdk
516
+ - **Platform Guide**: https://celesto.ai/docs
517
+ - **Repository**: https://github.com/CelestoAI/sdk
518
+
519
+ ## Support
520
+
521
+ - **Issues & Bugs**: [GitHub Issues](https://github.com/CelestoAI/sdk/issues)
522
+ - **Questions**: Create a discussion on GitHub
523
+ - **Email**: support@celesto.ai
524
+
525
+ ## Contributing
526
+
527
+ We welcome contributions! Please see our contributing guidelines in the repository.
528
+
529
+ 1. Fork the repository
530
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
531
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
532
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
533
+ 5. Open a Pull Request
534
+
535
+ ## License
536
+
537
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
538
+
539
+ ## About
540
+
541
+ Created and maintained by the [Celesto AI](https://celesto.ai) team.
542
+
543
+ For more information about the Celesto platform, visit [celesto.ai](https://celesto.ai).