cycls 0.0.2.30__py3-none-any.whl → 0.0.2.31__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.
cycls/cycls.py
CHANGED
|
@@ -100,25 +100,18 @@ def web(func, front_end_path="", prod=False, org=None, api_token=None, header=""
|
|
|
100
100
|
return app
|
|
101
101
|
|
|
102
102
|
class Agent:
|
|
103
|
-
def __init__(self,
|
|
104
|
-
self.
|
|
105
|
-
self.
|
|
103
|
+
def __init__(self, theme=theme_path, org=None, api_token=None, pip=[], apt=[], copy=[], keys=["",""]):
|
|
104
|
+
self.org, self.api_token = org, api_token
|
|
105
|
+
self.theme = theme
|
|
106
|
+
self.keys, self.pip, self.apt, self.copy = keys, pip, apt, copy
|
|
107
|
+
|
|
106
108
|
self.registered_functions = []
|
|
107
|
-
self.client = modal.Client.from_credentials(*keys)
|
|
108
|
-
image = (modal.Image.debian_slim()
|
|
109
|
-
.pip_install("fastapi[standard]", "pyjwt", "cryptography", *pip)
|
|
110
|
-
.apt_install(*apt)
|
|
111
|
-
.add_local_dir(front_end, "/root/public")
|
|
112
|
-
.add_local_python_source("cycls"))
|
|
113
|
-
for item in copy:
|
|
114
|
-
image = image.add_local_file(item, f"/root/{item}") if "." in item else image.add_local_dir(item, f'/root/{item}')
|
|
115
|
-
self.app = modal.App("development", image=image)
|
|
116
109
|
|
|
117
110
|
def __call__(self, name="", header="", intro="", domain=None, auth=False):
|
|
118
111
|
def decorator(f):
|
|
119
112
|
self.registered_functions.append({
|
|
120
113
|
"func": f,
|
|
121
|
-
"config": ["public",
|
|
114
|
+
"config": ["public", False, self.org, self.api_token, header, intro, auth],
|
|
122
115
|
"name": name,
|
|
123
116
|
"domain": domain or f"{name}.cycls.ai",
|
|
124
117
|
})
|
|
@@ -127,26 +120,39 @@ class Agent:
|
|
|
127
120
|
|
|
128
121
|
def run(self, port=8000):
|
|
129
122
|
if not self.registered_functions:
|
|
130
|
-
|
|
123
|
+
print("Error: No @agent decorated function found.")
|
|
124
|
+
return
|
|
131
125
|
|
|
132
126
|
i = self.registered_functions[0]
|
|
133
127
|
if len(self.registered_functions) > 1:
|
|
134
128
|
print(f"⚠️ Warning: Multiple agents found. Running '{i['name']}'.")
|
|
135
|
-
print(f"🚀 Starting local server at
|
|
136
|
-
i["config"][0] = self.
|
|
137
|
-
uvicorn.run(web(i["func"], *i["config"]), host="
|
|
129
|
+
print(f"🚀 Starting local server at localhost:{port}")
|
|
130
|
+
i["config"][0], i["config"][6] = self.theme, False
|
|
131
|
+
uvicorn.run(web(i["func"], *i["config"]), host="0.0.0.0", port=port)
|
|
138
132
|
return
|
|
139
133
|
|
|
140
|
-
def push(self):
|
|
134
|
+
def push(self, prod=False):
|
|
135
|
+
self.client = modal.Client.from_credentials(*self.keys)
|
|
136
|
+
image = (modal.Image.debian_slim()
|
|
137
|
+
.pip_install("fastapi[standard]", "pyjwt", "cryptography", *self.pip)
|
|
138
|
+
.apt_install(*self.apt)
|
|
139
|
+
.add_local_dir(self.theme, "/root/public")
|
|
140
|
+
.add_local_python_source("cycls"))
|
|
141
|
+
for item in self.copy:
|
|
142
|
+
image = image.add_local_file(item, f"/root/{item}") if "." in item else image.add_local_dir(item, f'/root/{item}')
|
|
143
|
+
self.app = modal.App("development", image=image)
|
|
144
|
+
|
|
141
145
|
if not self.registered_functions:
|
|
142
|
-
|
|
146
|
+
print("Error: No @agent decorated function found.")
|
|
147
|
+
return
|
|
143
148
|
|
|
144
149
|
for i in self.registered_functions:
|
|
150
|
+
i["config"][1] = True if prod else False
|
|
145
151
|
self.app.function(serialized=True, name=i["name"])(
|
|
146
152
|
modal.asgi_app(label=i["name"], custom_domains=[i["domain"]])
|
|
147
153
|
(lambda: web(i["func"], *i["config"]))
|
|
148
154
|
)
|
|
149
|
-
if
|
|
155
|
+
if prod:
|
|
150
156
|
for i in self.registered_functions:
|
|
151
157
|
print(f"✅ Deployed to ⇒ https://{i['domain']}")
|
|
152
158
|
self.app.deploy(client=self.client, name=self.registered_functions[0]["name"])
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cycls
|
|
3
|
+
Version: 0.0.2.31
|
|
4
|
+
Summary: Cycls SDK
|
|
5
|
+
Author: Mohammed J. AlRujayi
|
|
6
|
+
Author-email: mj@cycls.com
|
|
7
|
+
Requires-Python: >=3.9,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Requires-Dist: fastapi (>=0.111.0,<0.112.0)
|
|
16
|
+
Requires-Dist: httpx (>=0.27.0,<0.28.0)
|
|
17
|
+
Requires-Dist: jwt (>=1.4.0,<2.0.0)
|
|
18
|
+
Requires-Dist: modal (>=1.1.0,<2.0.0)
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
<h3 align="center">
|
|
22
|
+
The Distribution SDK for AI Agents.
|
|
23
|
+
</h3>
|
|
24
|
+
|
|
25
|
+
<h4 align="center">
|
|
26
|
+
<a href="https://cycls.com">Website</a> |
|
|
27
|
+
<a href="https://docs.cycls.com">Docs</a>
|
|
28
|
+
</h4>
|
|
29
|
+
|
|
30
|
+
<h4 align="center">
|
|
31
|
+
<a href="https://pypi.python.org/pypi/cycls"><img src="https://img.shields.io/pypi/v/cycls.svg?label=cycls+pypi&color=blueviolet" alt="cycls Python package on PyPi" /></a>
|
|
32
|
+
<a href="https://blog.cycls.com"><img src="https://img.shields.io/badge/newsletter-blueviolet.svg?logo=substack&label=cycls" alt="Cycls newsletter" /></a>
|
|
33
|
+
<a href="https://x.com/cyclsai">
|
|
34
|
+
<img src="https://img.shields.io/twitter/follow/CyclsAI" alt="Cycls Twitter" />
|
|
35
|
+
</a>
|
|
36
|
+
</h4>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Cycls 🚲
|
|
40
|
+
|
|
41
|
+
`cycls` is a zero-config framework for building and publishing AI agents. With a single decorator and one command, you can deploy your code as a web application complete with a front-end UI and an OpenAI-compatible API endpoint.
|
|
42
|
+
|
|
43
|
+
### Design Philosophy
|
|
44
|
+
`cycls` is an anti-framework. We treat the boilerplate, config files, and infrastructure that surround modern applications as a bug to be eliminated. A developer's focus is the most valuable resource, and context-switching is its greatest enemy.
|
|
45
|
+
|
|
46
|
+
Our zero-config approach makes your Python script the single source of truth for the entire application. When your code is all you need, you stay focused, iterate faster, and ship with confidence.
|
|
47
|
+
|
|
48
|
+
This philosophy has a powerful side-effect: it makes development genuinely iterative. The self-contained nature of an agent encourages you to 'build in cycles'—starting simple and adding complexity without penalty. This same simplicity also makes `cycls` an ideal target for code generation. Because the entire application can be expressed in one file, LLMs can write, modify, and reason about `cycls` agents far more effectively than with traditional frameworks. It's a seamless interface for both human and machine.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Key Features
|
|
52
|
+
|
|
53
|
+
* ✨ **Zero-Config Deployment:** No YAML or Dockerfiles. `cycls` infers your dependencies, and APIs directly from your Python code.
|
|
54
|
+
* 🚀 **One-Command Push to Cloud:** Go from local code to a globally scalable, serverless application with a single `agent.push()`.
|
|
55
|
+
* 💻 **Instant Local Testing:** Run `agent.run()` to spin up a local server with hot-reloading for rapid iteration and debugging.
|
|
56
|
+
* 🤖 **OpenAI-Compatible API:** Automatically serves a streaming `/chat/completions` endpoint.
|
|
57
|
+
* 🌐 **Automatic Web UI:** Get a clean, interactive front-end for your agent out of the box, with no front-end code required.
|
|
58
|
+
* 🔐 **Built-in Authentication:** Secure your agent for production with a simple `auth=True` flag that enables JWT-based authentication.
|
|
59
|
+
* 📦 **Declarative Dependencies:** Define all your `pip`, `apt`, or local file dependencies directly in Python.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install cycls
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## How to Use
|
|
69
|
+
### 1. Local Development: "Hello, World!"
|
|
70
|
+
|
|
71
|
+
Create a file main.py. This simple example creates an agent that streams back the message "hi".
|
|
72
|
+
|
|
73
|
+
```py
|
|
74
|
+
import cycls
|
|
75
|
+
|
|
76
|
+
# Initialize the agent
|
|
77
|
+
agent = cycls.Agent()
|
|
78
|
+
|
|
79
|
+
# Decorate your function to register it as an agent
|
|
80
|
+
@agent()
|
|
81
|
+
async def hello(context):
|
|
82
|
+
yield "hi"
|
|
83
|
+
|
|
84
|
+
agent.run()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Run it from your terminal:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
python main.py
|
|
91
|
+
```
|
|
92
|
+
This will start a local server. Open your browser to http://127.0.0.1:8000 to interact with your agent.
|
|
93
|
+
|
|
94
|
+
### 2. Cloud Deployment: An OpenAI-Powered Agent
|
|
95
|
+
This example creates a more advanced agent that calls the OpenAI API. It will be deployed to the cloud with authentication enabled.
|
|
96
|
+
|
|
97
|
+
```py
|
|
98
|
+
# deploy.py
|
|
99
|
+
import cycls
|
|
100
|
+
|
|
101
|
+
# Initialize the agent with dependencies and API keys
|
|
102
|
+
agent = cycls.Agent(
|
|
103
|
+
pip=["openai"],
|
|
104
|
+
keys=["ak-<token_id>", "as-<token_secret>"]
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# A helper function to call the LLM
|
|
108
|
+
async def llm(messages):
|
|
109
|
+
# Import inside the function: 'openai' is only needed at runtime in the container.
|
|
110
|
+
import openai
|
|
111
|
+
client = openai.AsyncOpenAI(api_key="sk-...") # Your OpenAI key
|
|
112
|
+
model = "gpt-4o"
|
|
113
|
+
response = await client.chat.completions.create(
|
|
114
|
+
model=model,
|
|
115
|
+
messages=messages,
|
|
116
|
+
temperature=1.0,
|
|
117
|
+
stream=True
|
|
118
|
+
)
|
|
119
|
+
# Yield the content from the streaming response
|
|
120
|
+
async def event_stream():
|
|
121
|
+
async for chunk in response:
|
|
122
|
+
content = chunk.choices[0].delta.content
|
|
123
|
+
if content:
|
|
124
|
+
yield content
|
|
125
|
+
return event_stream()
|
|
126
|
+
|
|
127
|
+
# Register the function as an agent named "cake" and enable auth
|
|
128
|
+
@agent("cake", auth=True)
|
|
129
|
+
async def cake_agent(context):
|
|
130
|
+
# The context object contains the message history
|
|
131
|
+
return await llm(context.messages)
|
|
132
|
+
|
|
133
|
+
# Deploy the agent to the cloud
|
|
134
|
+
agent.push(prod=True)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Run the deployment command from your terminal:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
python main.py
|
|
141
|
+
```
|
|
142
|
+
After a few moments, your agent will be live and accessible at a public URL like https://cake.cycls.ai.
|
|
143
|
+
|
|
144
|
+
### License
|
|
145
|
+
This project is licensed under the MIT License.
|
|
146
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
cycls/__init__.py,sha256=D808D5xNP8OdQStdABmWqjGfuDNpVgbJhRo0KRKzo7g,24
|
|
2
|
+
cycls/cycls.py,sha256=qW0KzZ7GLMIJ5tLPYDusvBv0HjKJ1NhfuYVu4BbF8Z4,7434
|
|
3
|
+
cycls/theme/assets/index-D0-uI8sw.js,sha256=aUsqm9HZtEJz38o-0MW12ZVeOlSeKigwc_fYJBntiyI,1068551
|
|
4
|
+
cycls/theme/index.html,sha256=epB4cgSjC7xJOXpVuCwt9r7ivoGvLiXSrxsoOgINw58,895
|
|
5
|
+
cycls-0.0.2.31.dist-info/METADATA,sha256=0ldNTvnYxncmbitmY5oRGIGB1f8abh4uefgp9uEFl3s,5583
|
|
6
|
+
cycls-0.0.2.31.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
7
|
+
cycls-0.0.2.31.dist-info/RECORD,,
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: cycls
|
|
3
|
-
Version: 0.0.2.30
|
|
4
|
-
Summary: Cycls SDK
|
|
5
|
-
Author: Mohammed J. AlRujayi
|
|
6
|
-
Author-email: mj@cycls.com
|
|
7
|
-
Requires-Python: >=3.9,<4.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Requires-Dist: fastapi (>=0.111.0,<0.112.0)
|
|
15
|
-
Requires-Dist: httpx (>=0.27.0,<0.28.0)
|
|
16
|
-
Requires-Dist: jwt (>=1.4.0,<2.0.0)
|
|
17
|
-
Requires-Dist: modal (>=1.1.0,<2.0.0)
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
|
-
<p align="center">
|
|
21
|
-
<img src="https://github.com/user-attachments/assets/96bd304d-8116-4bce-8b8f-b08980875ad7" width="800px" alt="Cycls Banner">
|
|
22
|
-
</p>
|
|
23
|
-
|
|
24
|
-
<h3 align="center">
|
|
25
|
-
Generate live apps from code in minutes with built-in memory, <br/>rich hypermedia content, and cross-platform support
|
|
26
|
-
</h3>
|
|
27
|
-
|
|
28
|
-
<h4 align="center">
|
|
29
|
-
<a href="https://cycls.com">Website</a> |
|
|
30
|
-
<a href="https://docs.cycls.com">Docs</a> |
|
|
31
|
-
<a href="https://docs.cycls.com">Blog</a>
|
|
32
|
-
</h4>
|
|
33
|
-
|
|
34
|
-
<h4 align="center">
|
|
35
|
-
<a href="https://pypi.python.org/pypi/cycls"><img src="https://img.shields.io/pypi/v/cycls.svg?label=cycls+pypi&color=blueviolet" alt="cycls Python package on PyPi" /></a>
|
|
36
|
-
<a href="https://blog.cycls.com"><img src="https://img.shields.io/badge/newsletter-blueviolet.svg?logo=substack&label=cycls" alt="Cycls newsletter" /></a>
|
|
37
|
-
<a href="https://x.com/cycls_">
|
|
38
|
-
<img src="https://img.shields.io/twitter/follow/cycls_" alt="Cycls Twitter" />
|
|
39
|
-
</a>
|
|
40
|
-
</h4>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Cycls: The AI App Generator
|
|
44
|
-
Cycls[^1] streamlines AI application development by generating apps from high-level descriptions. It eliminates boilerplate, ensures cross-platform compatibility, and manages memory - all from a single codebase.
|
|
45
|
-
|
|
46
|
-
With Cycls, you can quickly prototype ideas and then turn them into production apps, while focusing on AI logic and user interactions rather than wrestling with implementation details.
|
|
47
|
-
|
|
48
|
-
## ✨ Core Features
|
|
49
|
-
- **Fast App Generation**: Create live web apps from code in minutes
|
|
50
|
-
- **Built-in Memory Management**: Integrated state and session management
|
|
51
|
-
- **Rich Hypermedia Content**: Support for various media types (text, images, audio, video, interactive elements)
|
|
52
|
-
- **Framework Agnostic**: Compatible with a wide range of AI frameworks and models
|
|
53
|
-
|
|
54
|
-
## 🚀 Quickstart
|
|
55
|
-
### Installation
|
|
56
|
-
```
|
|
57
|
-
pip install cycls
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Basic usage
|
|
61
|
-
```py
|
|
62
|
-
from cycls import Cycls
|
|
63
|
-
|
|
64
|
-
cycls = Cycls()
|
|
65
|
-
|
|
66
|
-
@cycls("@my-app")
|
|
67
|
-
def app():
|
|
68
|
-
return "Hello World!"
|
|
69
|
-
|
|
70
|
-
cycls.push()
|
|
71
|
-
```
|
|
72
|
-
This creates an app named "@my-app" that responds with "Hello World!".
|
|
73
|
-
|
|
74
|
-
The `@cycls("@my-app")` decorator registers your app, and `cycls.push()` streams it to Cycls platform.
|
|
75
|
-
|
|
76
|
-
To see a live example, visit https://cycls.com/@spark.
|
|
77
|
-
|
|
78
|
-
> [!IMPORTANT]
|
|
79
|
-
> Use a unique name for your app (like "@my-app"). This is your app's identifier on Cycls.
|
|
80
|
-
|
|
81
|
-
> [!NOTE]
|
|
82
|
-
> Your apps run on your infrastructure and are streamed in real-time to Cycls.
|
|
83
|
-
|
|
84
|
-
## 📖 Documentation
|
|
85
|
-
For more detailes and instructions, visit our documentation at [docs.cycls.com](https://docs.cycls.com/).
|
|
86
|
-
|
|
87
|
-
## 🗺️ Roadmap
|
|
88
|
-
- **iOS and Android apps**
|
|
89
|
-
- **User management**
|
|
90
|
-
- **JavaScript SDK**
|
|
91
|
-
- **Public API**
|
|
92
|
-
- **Cross-app communication**
|
|
93
|
-
|
|
94
|
-
## 🙌 Support
|
|
95
|
-
Join our Discord community for support and discussions. You can reach us on:
|
|
96
|
-
|
|
97
|
-
- [Join our Discord](https://discord.gg/XbxcTFBf7J)
|
|
98
|
-
- [Join our newsletter](https://blog.cycls.com)
|
|
99
|
-
- [Follow us on Twitter](https://x.com/cycls_)
|
|
100
|
-
- [Email us](mailto:hi@cycls.com)
|
|
101
|
-
|
|
102
|
-
[^1]: The name "Cycls" is a play on "cycles," referring to the continuous exchange between AI prompts (generators) and their responses (generated).
|
|
103
|
-
|
cycls-0.0.2.30.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
cycls/__init__.py,sha256=D808D5xNP8OdQStdABmWqjGfuDNpVgbJhRo0KRKzo7g,24
|
|
2
|
-
cycls/cycls.py,sha256=KwoWCybzIvfi_oqLv5i2r8oEcxZL229nBHZf2uBFs78,7332
|
|
3
|
-
cycls/theme/assets/index-D0-uI8sw.js,sha256=aUsqm9HZtEJz38o-0MW12ZVeOlSeKigwc_fYJBntiyI,1068551
|
|
4
|
-
cycls/theme/index.html,sha256=epB4cgSjC7xJOXpVuCwt9r7ivoGvLiXSrxsoOgINw58,895
|
|
5
|
-
cycls-0.0.2.30.dist-info/METADATA,sha256=lBYKgRjAR334fJ5ys7IB6FDI4Ck24k_5z7BDB9c_1rg,3711
|
|
6
|
-
cycls-0.0.2.30.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
7
|
-
cycls-0.0.2.30.dist-info/RECORD,,
|