flamepy 0.3.0__tar.gz → 0.5.0__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.
- {flamepy-0.3.0/src/flamepy.egg-info → flamepy-0.5.0}/PKG-INFO +22 -61
- flamepy-0.5.0/README.md +103 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/pyproject.toml +8 -4
- flamepy-0.5.0/src/flamepy/__init__.py +131 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy/client.py +186 -36
- flamepy-0.5.0/src/flamepy/instance.py +170 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy/service.py +62 -31
- flamepy-0.5.0/src/flamepy/shim_pb2.py +44 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy/shim_pb2_grpc.py +15 -15
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy/types.py +74 -13
- flamepy-0.5.0/src/flamepy/types_pb2.py +99 -0
- {flamepy-0.3.0 → flamepy-0.5.0/src/flamepy.egg-info}/PKG-INFO +22 -61
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy.egg-info/SOURCES.txt +1 -1
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy.egg-info/requires.txt +4 -0
- flamepy-0.3.0/README.md +0 -146
- flamepy-0.3.0/src/flamepy/__init__.py +0 -82
- flamepy-0.3.0/src/flamepy/shim_pb2.py +0 -46
- flamepy-0.3.0/src/flamepy/test_flame.py +0 -195
- flamepy-0.3.0/src/flamepy/types_pb2.py +0 -95
- {flamepy-0.3.0 → flamepy-0.5.0}/LICENSE +0 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/setup.cfg +0 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy/frontend_pb2.py +0 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy/frontend_pb2_grpc.py +0 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy/types_pb2_grpc.py +0 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy.egg-info/dependency_links.txt +0 -0
- {flamepy-0.3.0 → flamepy-0.5.0}/src/flamepy.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flamepy
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Python SDK for Flame distributed
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Python SDK for Flame, a distributed system for Agentic AI
|
|
5
5
|
Author-email: XFLOPS Authors <support@xflops.io>
|
|
6
6
|
Project-URL: Homepage, https://xflops.io
|
|
7
7
|
Project-URL: Repository, https://github.com/xflops/flame
|
|
8
8
|
Project-URL: Issues, https://github.com/xflops/flame/issues
|
|
9
|
-
Keywords: distributed
|
|
9
|
+
Keywords: distributed system,agentic ai,flame,sdk
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
@@ -15,12 +15,16 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: grpcio>=1.50.0
|
|
22
22
|
Requires-Dist: grpcio-tools>=1.50.0
|
|
23
23
|
Requires-Dist: protobuf>=4.21.0
|
|
24
|
+
Requires-Dist: pydantic>=2.11.0
|
|
25
|
+
Requires-Dist: fastapi>=0.115.0
|
|
26
|
+
Requires-Dist: uvicorn>=0.35.0
|
|
27
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
24
28
|
Provides-Extra: dev
|
|
25
29
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
26
30
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
@@ -31,7 +35,7 @@ Dynamic: license-file
|
|
|
31
35
|
|
|
32
36
|
# Flame Python SDK
|
|
33
37
|
|
|
34
|
-
Python SDK for the Flame distributed
|
|
38
|
+
Python SDK for the Flame, a distributed system for Agentic AI.
|
|
35
39
|
|
|
36
40
|
## Installation
|
|
37
41
|
|
|
@@ -43,30 +47,20 @@ pip install flamepy
|
|
|
43
47
|
|
|
44
48
|
```python
|
|
45
49
|
import asyncio
|
|
46
|
-
|
|
50
|
+
import flamepy
|
|
47
51
|
|
|
48
52
|
async def main():
|
|
49
|
-
#
|
|
50
|
-
|
|
51
|
-
# Create a session
|
|
52
|
-
session = await conn.create_session(SessionAttributes(
|
|
53
|
-
application="flmlog",
|
|
54
|
-
slots=2,
|
|
55
|
-
common_data=b"shared data"
|
|
56
|
-
))
|
|
53
|
+
# Create a session with the application, e.g. Agent
|
|
54
|
+
session = await flamepy.create_session("flmping")
|
|
57
55
|
|
|
58
56
|
# Create and run a task
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if update.is_completed():
|
|
65
|
-
break
|
|
66
|
-
|
|
57
|
+
resp = await session.invoke(b"task input data")
|
|
58
|
+
|
|
59
|
+
# Handle the output of task
|
|
60
|
+
print(resp.output)
|
|
61
|
+
|
|
67
62
|
# Close session
|
|
68
63
|
await session.close()
|
|
69
|
-
await conn.close()
|
|
70
64
|
|
|
71
65
|
if __name__ == "__main__":
|
|
72
66
|
asyncio.run(main())
|
|
@@ -74,30 +68,13 @@ if __name__ == "__main__":
|
|
|
74
68
|
|
|
75
69
|
## API Reference
|
|
76
70
|
|
|
77
|
-
### Connection
|
|
78
|
-
|
|
79
|
-
The main entry point for connecting to Flame services.
|
|
80
|
-
|
|
81
|
-
```python
|
|
82
|
-
from flamepy import connect
|
|
83
|
-
|
|
84
|
-
# Connect to a Flame service
|
|
85
|
-
conn = await connect("http://localhost:8080")
|
|
86
|
-
```
|
|
87
|
-
|
|
88
71
|
### Session
|
|
89
72
|
|
|
90
|
-
Represents a computing session with
|
|
73
|
+
Represents a computing session with application, e.g. Agent, Tools.
|
|
91
74
|
|
|
92
75
|
```python
|
|
93
76
|
# Create a session
|
|
94
|
-
session = await
|
|
95
|
-
application="my-app",
|
|
96
|
-
slots=2
|
|
97
|
-
))
|
|
98
|
-
|
|
99
|
-
# List sessions
|
|
100
|
-
sessions = await conn.list_sessions()
|
|
77
|
+
session = await flamepy.create_session("my-app")
|
|
101
78
|
|
|
102
79
|
# Close a session
|
|
103
80
|
await session.close()
|
|
@@ -109,7 +86,7 @@ Represents individual computing tasks within a session.
|
|
|
109
86
|
|
|
110
87
|
```python
|
|
111
88
|
# Create a task
|
|
112
|
-
task = await session.
|
|
89
|
+
task = await session.invoke(b"input data")
|
|
113
90
|
|
|
114
91
|
# Get task status
|
|
115
92
|
task = await session.get_task(task.id)
|
|
@@ -121,22 +98,6 @@ async for update in session.watch_task(task.id):
|
|
|
121
98
|
break
|
|
122
99
|
```
|
|
123
100
|
|
|
124
|
-
### Application
|
|
125
|
-
|
|
126
|
-
Manage distributed applications.
|
|
127
|
-
|
|
128
|
-
```python
|
|
129
|
-
# Register an application
|
|
130
|
-
await conn.register_application("my-app", {
|
|
131
|
-
"shim": Shim.SHELL,
|
|
132
|
-
"command": "python",
|
|
133
|
-
"arguments": ["script.py"]
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
# List applications
|
|
137
|
-
apps = await conn.list_applications()
|
|
138
|
-
```
|
|
139
|
-
|
|
140
101
|
## Error Handling
|
|
141
102
|
|
|
142
103
|
The SDK provides custom exception types for different error scenarios:
|
|
@@ -145,7 +106,7 @@ The SDK provides custom exception types for different error scenarios:
|
|
|
145
106
|
from flamepy import FlameError, FlameErrorCode
|
|
146
107
|
|
|
147
108
|
try:
|
|
148
|
-
session = await
|
|
109
|
+
session = await flamepy.create_session("flmping")
|
|
149
110
|
except FlameError as e:
|
|
150
111
|
if e.code == FlameErrorCode.INVALID_CONFIG:
|
|
151
112
|
print("Configuration error:", e.message)
|
|
@@ -159,7 +120,7 @@ To set up the development environment:
|
|
|
159
120
|
|
|
160
121
|
```bash
|
|
161
122
|
# Clone the repository
|
|
162
|
-
git clone https://github.com/
|
|
123
|
+
git clone https://github.com/xflops/flame.git
|
|
163
124
|
cd flame/sdk/python
|
|
164
125
|
|
|
165
126
|
# Install in development mode
|
flamepy-0.5.0/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Flame Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for the Flame, a distributed system for Agentic AI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install flamepy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import asyncio
|
|
15
|
+
import flamepy
|
|
16
|
+
|
|
17
|
+
async def main():
|
|
18
|
+
# Create a session with the application, e.g. Agent
|
|
19
|
+
session = await flamepy.create_session("flmping")
|
|
20
|
+
|
|
21
|
+
# Create and run a task
|
|
22
|
+
resp = await session.invoke(b"task input data")
|
|
23
|
+
|
|
24
|
+
# Handle the output of task
|
|
25
|
+
print(resp.output)
|
|
26
|
+
|
|
27
|
+
# Close session
|
|
28
|
+
await session.close()
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
asyncio.run(main())
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API Reference
|
|
35
|
+
|
|
36
|
+
### Session
|
|
37
|
+
|
|
38
|
+
Represents a computing session with application, e.g. Agent, Tools.
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
# Create a session
|
|
42
|
+
session = await flamepy.create_session("my-app")
|
|
43
|
+
|
|
44
|
+
# Close a session
|
|
45
|
+
await session.close()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Task
|
|
49
|
+
|
|
50
|
+
Represents individual computing tasks within a session.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
# Create a task
|
|
54
|
+
task = await session.invoke(b"input data")
|
|
55
|
+
|
|
56
|
+
# Get task status
|
|
57
|
+
task = await session.get_task(task.id)
|
|
58
|
+
|
|
59
|
+
# Watch task progress
|
|
60
|
+
async for update in session.watch_task(task.id):
|
|
61
|
+
print(f"Task state: {update.state}")
|
|
62
|
+
if update.is_completed():
|
|
63
|
+
break
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Error Handling
|
|
67
|
+
|
|
68
|
+
The SDK provides custom exception types for different error scenarios:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from flamepy import FlameError, FlameErrorCode
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
session = await flamepy.create_session("flmping")
|
|
75
|
+
except FlameError as e:
|
|
76
|
+
if e.code == FlameErrorCode.INVALID_CONFIG:
|
|
77
|
+
print("Configuration error:", e.message)
|
|
78
|
+
elif e.code == FlameErrorCode.INVALID_STATE:
|
|
79
|
+
print("State error:", e.message)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
To set up the development environment:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Clone the repository
|
|
88
|
+
git clone https://github.com/xflops/flame.git
|
|
89
|
+
cd flame/sdk/python
|
|
90
|
+
|
|
91
|
+
# Install in development mode
|
|
92
|
+
pip install -e .[dev]
|
|
93
|
+
|
|
94
|
+
# Run tests
|
|
95
|
+
pytest
|
|
96
|
+
|
|
97
|
+
# Format code
|
|
98
|
+
black flamepy/
|
|
99
|
+
isort flamepy/
|
|
100
|
+
|
|
101
|
+
# Type checking
|
|
102
|
+
mypy flamepy/
|
|
103
|
+
```
|
|
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "flamepy"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "Python SDK for Flame distributed
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "Python SDK for Flame, a distributed system for Agentic AI"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
11
|
license-files = ["LICENSE"]
|
|
12
12
|
authors = [
|
|
13
13
|
{name = "XFLOPS Authors", email = "support@xflops.io"}
|
|
14
14
|
]
|
|
15
|
-
keywords = ["distributed
|
|
15
|
+
keywords = ["distributed system", "agentic ai", "flame", "sdk"]
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 3 - Alpha",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
@@ -27,6 +27,10 @@ dependencies = [
|
|
|
27
27
|
"grpcio>=1.50.0",
|
|
28
28
|
"grpcio-tools>=1.50.0",
|
|
29
29
|
"protobuf>=4.21.0",
|
|
30
|
+
"pydantic>=2.11.0",
|
|
31
|
+
"fastapi>=0.115.0",
|
|
32
|
+
"uvicorn>=0.35.0",
|
|
33
|
+
"pyyaml>=6.0.0",
|
|
30
34
|
]
|
|
31
35
|
|
|
32
36
|
[project.optional-dependencies]
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Copyright 2025 The Flame Authors.
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import logging
|
|
17
|
+
import os
|
|
18
|
+
|
|
19
|
+
_log_level_str = os.getenv("FLAME_LOG_LEVEL", "INFO").upper()
|
|
20
|
+
_log_level_map = {
|
|
21
|
+
"CRITICAL": logging.CRITICAL,
|
|
22
|
+
"ERROR": logging.ERROR,
|
|
23
|
+
"WARNING": logging.WARNING,
|
|
24
|
+
"INFO": logging.INFO,
|
|
25
|
+
"DEBUG": logging.DEBUG,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_log_level = _log_level_map[_log_level_str] if _log_level_str in _log_level_map else logging.INFO
|
|
29
|
+
|
|
30
|
+
logging.basicConfig(level=_log_level)
|
|
31
|
+
|
|
32
|
+
from .types import (
|
|
33
|
+
# Type aliases
|
|
34
|
+
TaskID,
|
|
35
|
+
SessionID,
|
|
36
|
+
ApplicationID,
|
|
37
|
+
Message,
|
|
38
|
+
TaskInput,
|
|
39
|
+
TaskOutput,
|
|
40
|
+
CommonData,
|
|
41
|
+
|
|
42
|
+
# Enums
|
|
43
|
+
SessionState,
|
|
44
|
+
TaskState,
|
|
45
|
+
ApplicationState,
|
|
46
|
+
Shim,
|
|
47
|
+
|
|
48
|
+
FlameErrorCode,
|
|
49
|
+
|
|
50
|
+
# Classes
|
|
51
|
+
FlameError,
|
|
52
|
+
SessionAttributes,
|
|
53
|
+
ApplicationAttributes,
|
|
54
|
+
Task,
|
|
55
|
+
Application,
|
|
56
|
+
FlameContext,
|
|
57
|
+
TaskInformer,
|
|
58
|
+
Request,
|
|
59
|
+
Response,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
from .client import (Connection, Session, TaskWatcher,
|
|
63
|
+
connect, create_session, register_application, unregister_application, list_applications, get_application,
|
|
64
|
+
list_sessions, get_session, close_session
|
|
65
|
+
)
|
|
66
|
+
from .service import (
|
|
67
|
+
FlameService,
|
|
68
|
+
ApplicationContext, SessionContext, TaskContext, TaskOutput,
|
|
69
|
+
run
|
|
70
|
+
)
|
|
71
|
+
from .instance import FlameInstance
|
|
72
|
+
|
|
73
|
+
__version__ = "0.3.0"
|
|
74
|
+
|
|
75
|
+
__all__ = [
|
|
76
|
+
# Type aliases
|
|
77
|
+
"TaskID",
|
|
78
|
+
"SessionID",
|
|
79
|
+
"ApplicationID",
|
|
80
|
+
"Message",
|
|
81
|
+
"TaskInput",
|
|
82
|
+
"TaskOutput",
|
|
83
|
+
"CommonData",
|
|
84
|
+
|
|
85
|
+
# Enums
|
|
86
|
+
"SessionState",
|
|
87
|
+
"TaskState",
|
|
88
|
+
"ApplicationState",
|
|
89
|
+
"Shim",
|
|
90
|
+
"FlameErrorCode",
|
|
91
|
+
|
|
92
|
+
# Service classes
|
|
93
|
+
"FlameService",
|
|
94
|
+
"ApplicationContext",
|
|
95
|
+
"SessionContext",
|
|
96
|
+
"TaskContext",
|
|
97
|
+
"TaskOutput",
|
|
98
|
+
"run",
|
|
99
|
+
|
|
100
|
+
# Classes
|
|
101
|
+
"FlameError",
|
|
102
|
+
"SessionAttributes",
|
|
103
|
+
"ApplicationAttributes",
|
|
104
|
+
"Task",
|
|
105
|
+
"Application",
|
|
106
|
+
"FlameContext",
|
|
107
|
+
"TaskInformer",
|
|
108
|
+
"Request",
|
|
109
|
+
"Response",
|
|
110
|
+
|
|
111
|
+
# Client classes
|
|
112
|
+
"Connection",
|
|
113
|
+
"connect",
|
|
114
|
+
"create_session",
|
|
115
|
+
"register_application",
|
|
116
|
+
"unregister_application",
|
|
117
|
+
"list_applications",
|
|
118
|
+
"get_application",
|
|
119
|
+
"list_sessions",
|
|
120
|
+
"get_session",
|
|
121
|
+
"close_session",
|
|
122
|
+
"TaskWatcher",
|
|
123
|
+
"Session",
|
|
124
|
+
"Task",
|
|
125
|
+
"TaskInput",
|
|
126
|
+
"TaskOutput",
|
|
127
|
+
"CommonData",
|
|
128
|
+
|
|
129
|
+
# Instance classes
|
|
130
|
+
"FlameInstance",
|
|
131
|
+
]
|