cycls 0.0.2.15__tar.gz β†’ 0.0.2.40__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,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: cycls
3
+ Version: 0.0.2.40
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: cloudpickle (>=3.1.1,<4.0.0)
16
+ Requires-Dist: docker (>=7.1.0,<8.0.0)
17
+ Requires-Dist: fastapi (>=0.111.0,<0.112.0)
18
+ Requires-Dist: httpx (>=0.27.0,<0.28.0)
19
+ Requires-Dist: jwt (>=1.4.0,<2.0.0)
20
+ Requires-Dist: modal (>=1.1.0,<2.0.0)
21
+ Description-Content-Type: text/markdown
22
+
23
+ <h3 align="center">
24
+ The Distribution SDK for AI Agents.
25
+ </h3>
26
+
27
+ <h4 align="center">
28
+ <a href="https://cycls.com">Website</a> |
29
+ <a href="https://docs.cycls.com">Docs</a>
30
+ </h4>
31
+
32
+ <h4 align="center">
33
+ <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>
34
+ <a href="https://blog.cycls.com"><img src="https://img.shields.io/badge/newsletter-blueviolet.svg?logo=substack&label=cycls" alt="Cycls newsletter" /></a>
35
+ <a href="https://x.com/cyclsai">
36
+ <img src="https://img.shields.io/twitter/follow/CyclsAI" alt="Cycls Twitter" />
37
+ </a>
38
+ </h4>
39
+
40
+
41
+ # Cycls 🚲
42
+
43
+ `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.
44
+
45
+ ### Design Philosophy
46
+ `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.
47
+
48
+ 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.
49
+
50
+ 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.
51
+
52
+
53
+ ## Key Features
54
+
55
+ * ✨ **Zero-Config Deployment:** No YAML or Dockerfiles. `cycls` infers your dependencies, and APIs directly from your Python code.
56
+ * πŸš€ **One-Command Push to Cloud:** Go from local code to a globally scalable, serverless application with a single `agent.push()`.
57
+ * πŸ’» **Instant Local Testing:** Run `agent.run()` to spin up a local server with hot-reloading for rapid iteration and debugging.
58
+ * πŸ€– **OpenAI-Compatible API:** Automatically serves a streaming `/chat/completions` endpoint.
59
+ * 🌐 **Automatic Web UI:** Get a clean, interactive front-end for your agent out of the box, with no front-end code required.
60
+ * πŸ” **Built-in Authentication:** Secure your agent for production with a simple `auth=True` flag that enables JWT-based authentication.
61
+ * πŸ“¦ **Declarative Dependencies:** Define all your `pip`, `apt`, or local file dependencies directly in Python.
62
+
63
+
64
+ ## Installation
65
+
66
+ ```bash
67
+ pip install cycls
68
+ ```
69
+
70
+ ## How to Use
71
+ ### 1. Local Development: "Hello, World!"
72
+
73
+ Create a file main.py. This simple example creates an agent that streams back the message "hi".
74
+
75
+ ```py
76
+ import cycls
77
+
78
+ # Initialize the agent
79
+ agent = cycls.Agent()
80
+
81
+ # Decorate your function to register it as an agent
82
+ @agent()
83
+ async def hello(context):
84
+ yield "hi"
85
+
86
+ agent.run()
87
+ ```
88
+
89
+ Run it from your terminal:
90
+
91
+ ```bash
92
+ python main.py
93
+ ```
94
+ This will start a local server. Open your browser to http://127.0.0.1:8000 to interact with your agent.
95
+
96
+ ### 2. Cloud Deployment: An OpenAI-Powered Agent
97
+ This example creates a more advanced agent that calls the OpenAI API. It will be deployed to the cloud with authentication enabled.
98
+
99
+ ```py
100
+ # deploy.py
101
+ import cycls
102
+
103
+ # Initialize the agent with dependencies and API keys
104
+ agent = cycls.Agent(
105
+ pip=["openai"],
106
+ keys=["ak-<token_id>", "as-<token_secret>"]
107
+ )
108
+
109
+ # A helper function to call the LLM
110
+ async def llm(messages):
111
+ # Import inside the function: 'openai' is only needed at runtime in the container.
112
+ import openai
113
+ client = openai.AsyncOpenAI(api_key="sk-...") # Your OpenAI key
114
+ model = "gpt-4o"
115
+ response = await client.chat.completions.create(
116
+ model=model,
117
+ messages=messages,
118
+ temperature=1.0,
119
+ stream=True
120
+ )
121
+ # Yield the content from the streaming response
122
+ async def event_stream():
123
+ async for chunk in response:
124
+ content = chunk.choices[0].delta.content
125
+ if content:
126
+ yield content
127
+ return event_stream()
128
+
129
+ # Register the function as an agent named "cake" and enable auth
130
+ @agent("cake", auth=True)
131
+ async def cake_agent(context):
132
+ # The context object contains the message history
133
+ return await llm(context.messages)
134
+
135
+ # Deploy the agent to the cloud
136
+ agent.push(prod=True)
137
+ ```
138
+
139
+ Run the deployment command from your terminal:
140
+
141
+ ```bash
142
+ python main.py
143
+ ```
144
+ After a few moments, your agent will be live and accessible at a public URL like https://cake.cycls.ai.
145
+
146
+ ### License
147
+ This project is licensed under the MIT License.
148
+
@@ -0,0 +1,125 @@
1
+ <h3 align="center">
2
+ The Distribution SDK for AI Agents.
3
+ </h3>
4
+
5
+ <h4 align="center">
6
+ <a href="https://cycls.com">Website</a> |
7
+ <a href="https://docs.cycls.com">Docs</a>
8
+ </h4>
9
+
10
+ <h4 align="center">
11
+ <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>
12
+ <a href="https://blog.cycls.com"><img src="https://img.shields.io/badge/newsletter-blueviolet.svg?logo=substack&label=cycls" alt="Cycls newsletter" /></a>
13
+ <a href="https://x.com/cyclsai">
14
+ <img src="https://img.shields.io/twitter/follow/CyclsAI" alt="Cycls Twitter" />
15
+ </a>
16
+ </h4>
17
+
18
+
19
+ # Cycls 🚲
20
+
21
+ `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.
22
+
23
+ ### Design Philosophy
24
+ `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.
25
+
26
+ 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.
27
+
28
+ 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.
29
+
30
+
31
+ ## Key Features
32
+
33
+ * ✨ **Zero-Config Deployment:** No YAML or Dockerfiles. `cycls` infers your dependencies, and APIs directly from your Python code.
34
+ * πŸš€ **One-Command Push to Cloud:** Go from local code to a globally scalable, serverless application with a single `agent.push()`.
35
+ * πŸ’» **Instant Local Testing:** Run `agent.run()` to spin up a local server with hot-reloading for rapid iteration and debugging.
36
+ * πŸ€– **OpenAI-Compatible API:** Automatically serves a streaming `/chat/completions` endpoint.
37
+ * 🌐 **Automatic Web UI:** Get a clean, interactive front-end for your agent out of the box, with no front-end code required.
38
+ * πŸ” **Built-in Authentication:** Secure your agent for production with a simple `auth=True` flag that enables JWT-based authentication.
39
+ * πŸ“¦ **Declarative Dependencies:** Define all your `pip`, `apt`, or local file dependencies directly in Python.
40
+
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install cycls
46
+ ```
47
+
48
+ ## How to Use
49
+ ### 1. Local Development: "Hello, World!"
50
+
51
+ Create a file main.py. This simple example creates an agent that streams back the message "hi".
52
+
53
+ ```py
54
+ import cycls
55
+
56
+ # Initialize the agent
57
+ agent = cycls.Agent()
58
+
59
+ # Decorate your function to register it as an agent
60
+ @agent()
61
+ async def hello(context):
62
+ yield "hi"
63
+
64
+ agent.run()
65
+ ```
66
+
67
+ Run it from your terminal:
68
+
69
+ ```bash
70
+ python main.py
71
+ ```
72
+ This will start a local server. Open your browser to http://127.0.0.1:8000 to interact with your agent.
73
+
74
+ ### 2. Cloud Deployment: An OpenAI-Powered Agent
75
+ This example creates a more advanced agent that calls the OpenAI API. It will be deployed to the cloud with authentication enabled.
76
+
77
+ ```py
78
+ # deploy.py
79
+ import cycls
80
+
81
+ # Initialize the agent with dependencies and API keys
82
+ agent = cycls.Agent(
83
+ pip=["openai"],
84
+ keys=["ak-<token_id>", "as-<token_secret>"]
85
+ )
86
+
87
+ # A helper function to call the LLM
88
+ async def llm(messages):
89
+ # Import inside the function: 'openai' is only needed at runtime in the container.
90
+ import openai
91
+ client = openai.AsyncOpenAI(api_key="sk-...") # Your OpenAI key
92
+ model = "gpt-4o"
93
+ response = await client.chat.completions.create(
94
+ model=model,
95
+ messages=messages,
96
+ temperature=1.0,
97
+ stream=True
98
+ )
99
+ # Yield the content from the streaming response
100
+ async def event_stream():
101
+ async for chunk in response:
102
+ content = chunk.choices[0].delta.content
103
+ if content:
104
+ yield content
105
+ return event_stream()
106
+
107
+ # Register the function as an agent named "cake" and enable auth
108
+ @agent("cake", auth=True)
109
+ async def cake_agent(context):
110
+ # The context object contains the message history
111
+ return await llm(context.messages)
112
+
113
+ # Deploy the agent to the cloud
114
+ agent.push(prod=True)
115
+ ```
116
+
117
+ Run the deployment command from your terminal:
118
+
119
+ ```bash
120
+ python main.py
121
+ ```
122
+ After a few moments, your agent will be live and accessible at a public URL like https://cake.cycls.ai.
123
+
124
+ ### License
125
+ This project is licensed under the MIT License.
@@ -0,0 +1,2 @@
1
+ from .sdk import Agent, function
2
+ from .runtime import Runtime