10xscale-agentflow-cli 0.1.9__tar.gz → 0.2.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.
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/10xscale_agentflow_cli.egg-info/PKG-INFO +1 -1
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/PKG-INFO +1 -1
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/auth/jwt_auth.py +6 -1
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/config/setup_middleware.py +31 -3
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/loader.py +8 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/checkpointer/services/checkpointer_service.py +2 -1
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/graph/router.py +3 -2
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/graph/services/graph_service.py +14 -12
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/parse_output.py +4 -4
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/graph/react.py +2 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/pyproject.toml +1 -1
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/tests/test_utils_parse_and_callable.py +2 -5
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/10xscale_agentflow_cli.egg-info/SOURCES.txt +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/10xscale_agentflow_cli.egg-info/dependency_links.txt +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/10xscale_agentflow_cli.egg-info/entry_points.txt +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/10xscale_agentflow_cli.egg-info/not-zip-safe +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/10xscale_agentflow_cli.egg-info/requires.txt +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/10xscale_agentflow_cli.egg-info/top_level.txt +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/MANIFEST.in +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/README.md +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/Task.md +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow.json +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/api.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/build.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/init.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/version.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/constants.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/config.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/output.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/validation.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/exceptions.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/logger.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/main.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/templates/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/templates/defaults.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/auth/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/auth/auth_backend.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/auth/base_auth.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/config/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/config/graph_config.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/config/sentry_config.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/config/settings.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/config/setup_logs.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/config/worker_middleware.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/exceptions/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/exceptions/general_exception.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/exceptions/handle_errors.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/exceptions/resources_exceptions.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/exceptions/user_exception.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/main.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/checkpointer/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/checkpointer/router.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/checkpointer/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/checkpointer/schemas/checkpointer_schemas.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/checkpointer/services/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/graph/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/graph/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/graph/schemas/graph_schemas.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/graph/services/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/ping/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/ping/router.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/setup_router.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/store/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/store/router.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/store/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/store/schemas/store_schemas.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/store/services/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/routers/store/services/store_service.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/tasks/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/tasks/user_tasks.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/callable_helper.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/response_helper.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/schemas/output_schemas.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/schemas/user_schemas.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/snowflake_id_generator.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/swagger_helper.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/utils/thread_name_generator.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/worker.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/graph/__init__.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/graph/thread_name_generator.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/scripts/generate_docs.py +0 -0
- {10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/setup.cfg +0 -0
|
@@ -44,6 +44,11 @@ class JwtAuth(BaseAuth):
|
|
|
44
44
|
jwt_secret_key = os.environ.get("JWT_SECRET_KEY", None)
|
|
45
45
|
jwt_algorithm = os.environ.get("JWT_ALGORITHM", None)
|
|
46
46
|
|
|
47
|
+
# check bearer token then remove barer prefix
|
|
48
|
+
token = credential.credentials
|
|
49
|
+
if token.lower().startswith("bearer "):
|
|
50
|
+
token = token[7:]
|
|
51
|
+
|
|
47
52
|
if jwt_secret_key is None or jwt_algorithm is None:
|
|
48
53
|
raise UserAccountError(
|
|
49
54
|
message="JWT settings are not configured",
|
|
@@ -52,7 +57,7 @@ class JwtAuth(BaseAuth):
|
|
|
52
57
|
|
|
53
58
|
try:
|
|
54
59
|
decoded_token = jwt.decode(
|
|
55
|
-
|
|
60
|
+
token,
|
|
56
61
|
jwt_secret_key, # type: ignore
|
|
57
62
|
algorithms=[jwt_algorithm], # type: ignore
|
|
58
63
|
)
|
|
@@ -7,11 +7,38 @@ from fastapi.middleware.trustedhost import TrustedHostMiddleware
|
|
|
7
7
|
from starlette.middleware.base import BaseHTTPMiddleware
|
|
8
8
|
from starlette.middleware.cors import CORSMiddleware
|
|
9
9
|
from starlette.requests import Request
|
|
10
|
+
from starlette.types import ASGIApp, Receive, Scope, Send
|
|
10
11
|
|
|
11
12
|
from .sentry_config import init_sentry
|
|
12
13
|
from .settings import get_settings, logger
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
# Paths that should be excluded from GZip compression (streaming endpoints)
|
|
17
|
+
GZIP_EXCLUDED_PATHS = frozenset({"/v1/graph/stream"})
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SelectiveGZipMiddleware:
|
|
21
|
+
"""
|
|
22
|
+
GZip middleware that excludes certain paths from compression.
|
|
23
|
+
|
|
24
|
+
This is necessary because streaming endpoints need to send data
|
|
25
|
+
immediately without buffering, but GZipMiddleware buffers the
|
|
26
|
+
entire response before compressing.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(self, app: ASGIApp, minimum_size: int = 1000):
|
|
30
|
+
self.app = app
|
|
31
|
+
self.gzip_app = GZipMiddleware(app, minimum_size=minimum_size)
|
|
32
|
+
|
|
33
|
+
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
34
|
+
if scope["type"] == "http" and scope["path"] in GZIP_EXCLUDED_PATHS:
|
|
35
|
+
# Skip GZip for excluded paths - pass through directly
|
|
36
|
+
await self.app(scope, receive, send)
|
|
37
|
+
else:
|
|
38
|
+
# Apply GZip for all other paths
|
|
39
|
+
await self.gzip_app(scope, receive, send)
|
|
40
|
+
|
|
41
|
+
|
|
15
42
|
class RequestIDMiddleware(BaseHTTPMiddleware):
|
|
16
43
|
"""
|
|
17
44
|
Middleware to add a unique request ID and timestamp to each request and response.
|
|
@@ -74,7 +101,7 @@ def setup_middleware(app: FastAPI):
|
|
|
74
101
|
Middleware:
|
|
75
102
|
- CORS: Configured based on settings.ORIGINS.
|
|
76
103
|
- TrustedHost: Configured with allowed hosts from settings.ALLOWED_HOST.
|
|
77
|
-
- GZip: Applied with a minimum size of 1000 bytes.
|
|
104
|
+
- GZip: Applied with a minimum size of 1000 bytes (excludes streaming endpoints).
|
|
78
105
|
"""
|
|
79
106
|
settings = get_settings()
|
|
80
107
|
# init cors
|
|
@@ -90,8 +117,9 @@ def setup_middleware(app: FastAPI):
|
|
|
90
117
|
|
|
91
118
|
app.add_middleware(RequestIDMiddleware)
|
|
92
119
|
|
|
93
|
-
#
|
|
94
|
-
|
|
120
|
+
# Use SelectiveGZipMiddleware to exclude streaming endpoints from compression
|
|
121
|
+
# Streaming endpoints need immediate data transmission without buffering
|
|
122
|
+
app.add_middleware(SelectiveGZipMiddleware, minimum_size=1000)
|
|
95
123
|
logger.debug("Middleware set up")
|
|
96
124
|
|
|
97
125
|
# Initialize Sentry
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/loader.py
RENAMED
|
@@ -202,6 +202,14 @@ async def attach_all_modules(
|
|
|
202
202
|
path,
|
|
203
203
|
)
|
|
204
204
|
container.bind_instance(BaseAuth, auth_backend)
|
|
205
|
+
elif method == "jwt":
|
|
206
|
+
from agentflow_cli.src.app.core.auth.jwt_auth import JwtAuth
|
|
207
|
+
|
|
208
|
+
jwt_auth = JwtAuth()
|
|
209
|
+
container.bind_instance(BaseAuth, jwt_auth)
|
|
210
|
+
|
|
211
|
+
elif method == "none":
|
|
212
|
+
container.bind_instance(BaseAuth, None, allow_none=True)
|
|
205
213
|
else:
|
|
206
214
|
# bind None
|
|
207
215
|
container.bind_instance(BaseAuth, None, allow_none=True)
|
|
@@ -174,7 +174,8 @@ class CheckpointerService:
|
|
|
174
174
|
base: dict[str, Any] = {}
|
|
175
175
|
if old_state is not None:
|
|
176
176
|
# Keep full dump so we can preserve existing fields
|
|
177
|
-
|
|
177
|
+
# Use serialize_as_any=True to include subclass fields
|
|
178
|
+
base = old_state.model_dump(serialize_as_any=True)
|
|
178
179
|
|
|
179
180
|
merged: dict[str, Any] = {**base}
|
|
180
181
|
|
|
@@ -81,11 +81,12 @@ async def stream_graph(
|
|
|
81
81
|
|
|
82
82
|
return StreamingResponse(
|
|
83
83
|
result,
|
|
84
|
-
media_type="text/
|
|
84
|
+
media_type="text/event-stream",
|
|
85
85
|
headers={
|
|
86
|
-
"Cache-Control": "no-cache",
|
|
86
|
+
"Cache-Control": "no-cache, no-transform",
|
|
87
87
|
"Connection": "keep-alive",
|
|
88
88
|
"X-Accel-Buffering": "no", # Disable nginx buffering
|
|
89
|
+
"Content-Encoding": "identity", # Disable any content encoding (bypasses GZip)
|
|
89
90
|
},
|
|
90
91
|
)
|
|
91
92
|
|
|
@@ -10,7 +10,6 @@ from agentflow.utils.thread_info import ThreadInfo
|
|
|
10
10
|
from fastapi import HTTPException
|
|
11
11
|
from injectq import InjectQ, inject, singleton
|
|
12
12
|
from pydantic import BaseModel
|
|
13
|
-
from starlette.responses import Content
|
|
14
13
|
|
|
15
14
|
from agentflow_cli.src.app.core import logger
|
|
16
15
|
from agentflow_cli.src.app.core.config.graph_config import GraphConfig
|
|
@@ -247,7 +246,7 @@ class GraphService:
|
|
|
247
246
|
|
|
248
247
|
return GraphInvokeOutputSchema(
|
|
249
248
|
messages=messages,
|
|
250
|
-
state=raw_state.model_dump() if raw_state else None,
|
|
249
|
+
state=raw_state.model_dump(serialize_as_any=True) if raw_state else None,
|
|
251
250
|
context=context,
|
|
252
251
|
summary=context_summary,
|
|
253
252
|
meta=meta,
|
|
@@ -261,7 +260,7 @@ class GraphService:
|
|
|
261
260
|
self,
|
|
262
261
|
graph_input: GraphInputSchema,
|
|
263
262
|
user: dict[str, Any],
|
|
264
|
-
) -> AsyncIterable[
|
|
263
|
+
) -> AsyncIterable[str]:
|
|
265
264
|
"""
|
|
266
265
|
Streams the graph execution with the provided input.
|
|
267
266
|
|
|
@@ -270,7 +269,7 @@ class GraphService:
|
|
|
270
269
|
stream_mode (str): The stream mode ("values", "updates", "messages", etc.).
|
|
271
270
|
|
|
272
271
|
Yields:
|
|
273
|
-
|
|
272
|
+
str: Individual JSON chunks from graph execution with newline delimiters.
|
|
274
273
|
|
|
275
274
|
Raises:
|
|
276
275
|
HTTPException: If graph streaming fails.
|
|
@@ -295,7 +294,7 @@ class GraphService:
|
|
|
295
294
|
mt = chunk.metadata or {}
|
|
296
295
|
mt.update(meta)
|
|
297
296
|
chunk.metadata = mt
|
|
298
|
-
yield chunk.model_dump_json()
|
|
297
|
+
yield chunk.model_dump_json(serialize_as_any=True) + "\n"
|
|
299
298
|
if (
|
|
300
299
|
self.config.thread_name_generator_path
|
|
301
300
|
and meta["is_new_thread"]
|
|
@@ -313,11 +312,14 @@ class GraphService:
|
|
|
313
312
|
)
|
|
314
313
|
meta["thread_name"] = thread_name
|
|
315
314
|
|
|
316
|
-
yield
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
315
|
+
yield (
|
|
316
|
+
StreamChunk(
|
|
317
|
+
event=StreamEvent.UPDATES,
|
|
318
|
+
data={"status": "completed"},
|
|
319
|
+
metadata=meta,
|
|
320
|
+
).model_dump_json(serialize_as_any=True)
|
|
321
|
+
+ "\n"
|
|
322
|
+
)
|
|
321
323
|
|
|
322
324
|
except Exception as e:
|
|
323
325
|
logger.error(f"Graph streaming failed: {e}")
|
|
@@ -416,7 +418,7 @@ class GraphService:
|
|
|
416
418
|
"success": True,
|
|
417
419
|
"message": "No messages found in state",
|
|
418
420
|
"removed_count": 0,
|
|
419
|
-
"state": state.model_dump_json(),
|
|
421
|
+
"state": state.model_dump_json(serialize_as_any=True),
|
|
420
422
|
}
|
|
421
423
|
|
|
422
424
|
filtered = [m for m in messages if not self._has_empty_tool_call(m)]
|
|
@@ -433,7 +435,7 @@ class GraphService:
|
|
|
433
435
|
"success": True,
|
|
434
436
|
"message": message,
|
|
435
437
|
"removed_count": removed_count,
|
|
436
|
-
"state": state.model_dump_json(),
|
|
438
|
+
"state": state.model_dump_json(serialize_as_any=True),
|
|
437
439
|
}
|
|
438
440
|
except Exception as e:
|
|
439
441
|
logger.error(f"Fix graph operation failed: {e}")
|
|
@@ -7,11 +7,11 @@ from agentflow_cli.src.app.core.config.settings import Settings
|
|
|
7
7
|
|
|
8
8
|
def parse_state_output(settings: Settings, response: BaseModel) -> dict[str, Any]:
|
|
9
9
|
# if settings.IS_DEBUG:
|
|
10
|
-
# return response.model_dump(exclude={"execution_meta"})
|
|
11
|
-
return response.model_dump()
|
|
10
|
+
# return response.model_dump(exclude={"execution_meta"}, serialize_as_any=True)
|
|
11
|
+
return response.model_dump(serialize_as_any=True)
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def parse_message_output(settings: Settings, response: BaseModel) -> dict[str, Any]:
|
|
15
15
|
# if settings.IS_DEBUG:
|
|
16
|
-
# return response.model_dump(exclude={"raw"})
|
|
17
|
-
return response.model_dump()
|
|
16
|
+
# return response.model_dump(exclude={"raw"}, serialize_as_any=True)
|
|
17
|
+
return response.model_dump(serialize_as_any=True)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from time import sleep
|
|
2
3
|
from typing import Any
|
|
3
4
|
|
|
4
5
|
from agentflow.adapters.llm.model_response_converter import ModelResponseConverter
|
|
@@ -51,6 +52,7 @@ def get_weather(
|
|
|
51
52
|
logger.debug("Number of messages in context: %d", len(state.context))
|
|
52
53
|
|
|
53
54
|
# Mock weather response - in production, this would call a real weather API
|
|
55
|
+
sleep(1) # Simulate network delay
|
|
54
56
|
return f"The weather in {location} is sunny"
|
|
55
57
|
|
|
56
58
|
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/tests/test_utils_parse_and_callable.py
RENAMED
|
@@ -28,9 +28,7 @@ def test_parse_state_output(is_debug: bool):
|
|
|
28
28
|
settings = Settings(IS_DEBUG=is_debug)
|
|
29
29
|
model = _StateModel(a=1, b="x", execution_meta={"duration": 123})
|
|
30
30
|
out = parse_state_output(settings, model)
|
|
31
|
-
#
|
|
32
|
-
# Since parse_state_output doesn't filter execution_meta (commented out),
|
|
33
|
-
# it should always be present regardless of debug mode
|
|
31
|
+
# Current implementation always includes execution_meta regardless of debug
|
|
34
32
|
assert out["execution_meta"] == {"duration": 123}
|
|
35
33
|
assert out["a"] == 1 and out["b"] == "x"
|
|
36
34
|
|
|
@@ -40,8 +38,7 @@ def test_parse_message_output(is_debug: bool):
|
|
|
40
38
|
settings = Settings(IS_DEBUG=is_debug)
|
|
41
39
|
model = _MessageModel(content="hello", raw={"tokens": 5})
|
|
42
40
|
out = parse_message_output(settings, model)
|
|
43
|
-
#
|
|
44
|
-
# it should always be present regardless of debug mode
|
|
41
|
+
# Current implementation always includes raw regardless of debug
|
|
45
42
|
assert out["raw"] == {"tokens": 5}
|
|
46
43
|
assert out["content"] == "hello"
|
|
47
44
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/__init__.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/api.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/build.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/init.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/commands/version.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/constants.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/__init__.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/config.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/output.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/core/validation.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/cli/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/__init__.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/core/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/agentflow_cli/src/app/worker.py
RENAMED
|
File without changes
|
|
File without changes
|
{10xscale_agentflow_cli-0.1.9 → 10xscale_agentflow_cli-0.2.1}/graph/thread_name_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|