cloudbase-agent-server 0.1.1__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.
Files changed (22) hide show
  1. cloudbase_agent_server-0.1.1/.gitignore +194 -0
  2. cloudbase_agent_server-0.1.1/PKG-INFO +45 -0
  3. cloudbase_agent_server-0.1.1/README.md +19 -0
  4. cloudbase_agent_server-0.1.1/pyproject.toml +45 -0
  5. cloudbase_agent_server-0.1.1/src/cloudbase_agent/__init__.py +5 -0
  6. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/__init__.py +91 -0
  7. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/app.py +365 -0
  8. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/healthz/__init__.py +14 -0
  9. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/healthz/handler.py +203 -0
  10. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/healthz/models.py +132 -0
  11. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/openai/__init__.py +14 -0
  12. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/openai/converter.py +72 -0
  13. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/openai/models.py +57 -0
  14. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/openai/server.py +46 -0
  15. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/send_message/__init__.py +14 -0
  16. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/send_message/handler.py +138 -0
  17. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/send_message/models.py +516 -0
  18. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/send_message/server.py +132 -0
  19. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/utils/__init__.py +33 -0
  20. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/utils/converters.py +176 -0
  21. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/utils/sse.py +32 -0
  22. cloudbase_agent_server-0.1.1/src/cloudbase_agent/server/utils/types.py +73 -0
@@ -0,0 +1,194 @@
1
+
2
+ # Dependencies
3
+ node_modules/
4
+ .pnp
5
+ .pnp.js
6
+
7
+ # Production builds
8
+ dist/
9
+ build/
10
+ out/
11
+
12
+ # Environment variables
13
+ .env
14
+ .env.local
15
+ .env.development.local
16
+ .env.test.local
17
+ .env.production.local
18
+
19
+ # Logs
20
+ logs
21
+ *.log
22
+ npm-debug.log*
23
+ yarn-debug.log*
24
+ yarn-error.log*
25
+ lerna-debug.log*
26
+ .pnpm-debug.log*
27
+
28
+ # Runtime data
29
+ pids
30
+ *.pid
31
+ *.seed
32
+ *.pid.lock
33
+
34
+ # Coverage directory used by tools like istanbul
35
+ coverage/
36
+ *.lcov
37
+
38
+ # nyc test coverage
39
+ .nyc_output
40
+
41
+ # TypeScript
42
+ *.tsbuildinfo
43
+
44
+ # Optional npm cache directory
45
+ .npm
46
+
47
+ # Optional eslint cache
48
+ .eslintcache
49
+
50
+ # Microbundle cache
51
+ .rpt2_cache/
52
+ .rts2_cache_cjs/
53
+ .rts2_cache_es/
54
+ .rts2_cache_umd/
55
+
56
+ # Optional REPL history
57
+ .node_repl_history
58
+
59
+ # Output of 'npm pack'
60
+ *.tgz
61
+
62
+ # Yarn Integrity file
63
+ .yarn-integrity
64
+
65
+ # parcel-bundler cache (https://parceljs.org/)
66
+ .cache
67
+ .parcel-cache
68
+
69
+ # Next.js build output
70
+ .next
71
+
72
+ # Nuxt.js build / generate output
73
+ .nuxt
74
+
75
+ # Gatsby files
76
+ .cache/
77
+
78
+ # vuepress build output
79
+ .vuepress/dist
80
+
81
+ # Serverless directories
82
+ .serverless/
83
+
84
+ # FuseBox cache
85
+ .fusebox/
86
+
87
+ # DynamoDB Local files
88
+ .dynamodb/
89
+
90
+ # TernJS port file
91
+ .tern-port
92
+
93
+ # Stores VSCode versions used for testing VSCode extensions
94
+ .vscode-test
95
+
96
+ # yarn v2
97
+ .yarn/cache
98
+ .yarn/unplugged
99
+ .yarn/build-state.yml
100
+ .yarn/install-state.gz
101
+ .pnp.*
102
+
103
+ # IDE
104
+ .vscode/
105
+ .idea/
106
+ *.swp
107
+ *.swo
108
+
109
+ # OS
110
+ .DS_Store
111
+ .DS_Store?
112
+ ._*
113
+ .Spotlight-V100
114
+ .Trashes
115
+ ehthumbs.db
116
+ Thumbs.db
117
+
118
+ # Temporary files
119
+ *.tmp
120
+ *.temp
121
+
122
+ # WeChat Mini Program
123
+ miniprogram_npm/
124
+ project.config.json
125
+ project.private.config.json
126
+
127
+ # Testing
128
+ coverage/
129
+ .nyc_output/
130
+
131
+ # Storybook build outputs
132
+ storybook-static/
133
+
134
+ # Python
135
+ __pycache__/
136
+ *.pyc
137
+ *.pyo
138
+ *.pyd
139
+ .Python
140
+ *.so
141
+ *.egg
142
+ *.egg-info
143
+ dist/
144
+ build/
145
+ eggs/
146
+ .eggs/
147
+ lib/
148
+ lib64/
149
+ parts/
150
+ sdist/
151
+ var/
152
+ wheels/
153
+ *.egg-info/
154
+ .installed.cfg
155
+ *.egg
156
+ MANIFEST
157
+
158
+ # Python virtual environments
159
+ venv/
160
+ env/
161
+ ENV/
162
+ .venv
163
+
164
+ # Python testing and coverage
165
+ .pytest_cache/
166
+ .coverage
167
+ .coverage.*
168
+ htmlcov/
169
+ .tox/
170
+ .nox/
171
+
172
+ # Python type checking
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+ .pyre/
177
+ .pytype/
178
+
179
+ # Python linting
180
+ .flake8_cache/
181
+
182
+ # Python profiling
183
+ .prof
184
+
185
+ # Jupyter Notebook
186
+ .ipynb_checkpoints
187
+
188
+ # Python package manager
189
+ pip-log.txt
190
+ pip-delete-this-directory.txt
191
+
192
+ # UV lock files (if not tracking)
193
+ # uv.lock
194
+ /docs/dist/
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: cloudbase-agent-server
3
+ Version: 0.1.1
4
+ Summary: Cloudbase Agent Python SDK - FastAPI server implementation
5
+ Author-email: Cloudbase Agent Team <ag-kit@example.com>
6
+ License: Apache-2.0
7
+ Keywords: Cloudbase Agent,agent,ai,llm
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: cloudbase-agent-core
17
+ Requires-Dist: fastapi>=0.100.0
18
+ Requires-Dist: sse-starlette>=1.6.0
19
+ Requires-Dist: uvicorn>=0.20.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
22
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
23
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
24
+ Requires-Dist: ruff>=0.12.0; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # cloudbase-agent-server
28
+
29
+ Cloudbase Agent Python SDK - FastAPI server implementation
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pip install cloudbase-agent-server
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ ```python
40
+ from cloudbase_agent import ...
41
+ ```
42
+
43
+ ## License
44
+
45
+ Apache-2.0
@@ -0,0 +1,19 @@
1
+ # cloudbase-agent-server
2
+
3
+ Cloudbase Agent Python SDK - FastAPI server implementation
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install cloudbase-agent-server
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from cloudbase_agent import ...
15
+ ```
16
+
17
+ ## License
18
+
19
+ Apache-2.0
@@ -0,0 +1,45 @@
1
+ [project]
2
+ name = "cloudbase-agent-server"
3
+ version = "0.1.1"
4
+ description = "Cloudbase Agent Python SDK - FastAPI server implementation"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = { text = "Apache-2.0" }
8
+ authors = [
9
+ { name = "Cloudbase Agent Team", email = "ag-kit@example.com" }
10
+ ]
11
+ keywords = ["ai", "agent", "llm", "Cloudbase Agent"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: Apache Software License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ ]
21
+
22
+ dependencies = [
23
+ "cloudbase-agent-core",
24
+ "fastapi>=0.100.0",
25
+ "uvicorn>=0.20.0",
26
+ "sse-starlette>=1.6.0",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ dev = [
31
+ "ruff>=0.12.0",
32
+ "mypy>=1.0.0",
33
+ "pytest>=7.0.0",
34
+ "pytest-asyncio>=0.21.0",
35
+ ]
36
+
37
+ [build-system]
38
+ requires = ["hatchling"]
39
+ build-backend = "hatchling.build"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/cloudbase_agent"]
43
+
44
+ [tool.uv.sources]
45
+ cloudbase-agent-core = { workspace = true }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """Cloudbase Agent package."""
4
+
5
+ __all__ = []
@@ -0,0 +1,91 @@
1
+ """Cloudbase Agent Server Package.
2
+
3
+ This package provides server components for the Cloudbase Agent Python SDK,
4
+ including FastAPI integration, request handling, streaming responses,
5
+ and resource cleanup support.
6
+
7
+ Core Capabilities (Primary Exports):
8
+ - create_send_message_adapter: Create adapter for Cloudbase Agent native send_message endpoint
9
+ - create_openai_adapter: Create adapter for OpenAI-compatible chat/completions endpoint
10
+
11
+ Convenience Tools (Secondary Exports):
12
+ - AGKitAPIApp: FastAPI application wrapper for quick server setup
13
+
14
+ Data Models:
15
+ - SendMessageInput: Request model for send_message endpoint
16
+ - OpenAIChatCompletionRequest: Request model for OpenAI-compatible endpoint
17
+ - AgentCreatorResult: TypedDict for agent creator return type
18
+ - AgentCreator: Type alias for agent creator functions
19
+
20
+ Example:
21
+ Using core capabilities (advanced users)::
22
+
23
+ from fastapi import FastAPI
24
+ from cloudbase_agent.server import create_send_message_adapter, create_openai_adapter
25
+ from cloudbase_agent.server import SendMessageInput, OpenAIChatCompletionRequest
26
+
27
+ def create_agent():
28
+ return {"agent": MyAgent()}
29
+
30
+ app = FastAPI()
31
+
32
+ @app.post("/custom/send-message")
33
+ async def send_message(request: SendMessageInput):
34
+ return await create_send_message_adapter(create_agent, request)
35
+
36
+ @app.post("/custom/chat/completions")
37
+ async def chat_completions(request: OpenAIChatCompletionRequest):
38
+ return await create_openai_adapter(create_agent, request)
39
+
40
+ Using convenience tool (quick start)::
41
+
42
+ from cloudbase_agent.server import AGKitAPIApp
43
+
44
+ def create_agent():
45
+ return {"agent": MyAgent()}
46
+
47
+ AGKitAPIApp().run(create_agent, port=8000)
48
+
49
+ With resource cleanup::
50
+
51
+ from cloudbase_agent.server import AGKitAPIApp, AgentCreatorResult
52
+
53
+ def create_agent() -> AgentCreatorResult:
54
+ db = connect_database()
55
+ agent = MyAgent(db)
56
+
57
+ def cleanup():
58
+ db.close()
59
+ print("Resources cleaned up")
60
+
61
+ return {"agent": agent, "cleanup": cleanup}
62
+
63
+ AGKitAPIApp().run(create_agent, port=8000)
64
+ """
65
+
66
+ # Core capabilities (primary exports)
67
+ # Convenience tool (secondary export)
68
+ from .app import AGKitAPIApp
69
+ from .healthz.models import HealthzConfig, HealthzResponse
70
+ from .openai.models import OpenAIChatCompletionRequest
71
+ from .openai.server import create_adapter as create_openai_adapter
72
+
73
+ # Data models
74
+ from .send_message.models import SendMessageInput
75
+ from .send_message.server import create_adapter as create_send_message_adapter
76
+ from .utils.types import AgentCreator, AgentCreatorResult
77
+
78
+ __all__ = [
79
+ # Core capabilities (primary)
80
+ "create_send_message_adapter",
81
+ "create_openai_adapter",
82
+ # Convenience tool (secondary)
83
+ "AGKitAPIApp",
84
+ # Data models
85
+ "SendMessageInput",
86
+ "OpenAIChatCompletionRequest",
87
+ "HealthzConfig",
88
+ "HealthzResponse",
89
+ "AgentCreatorResult",
90
+ "AgentCreator",
91
+ ]