10xscale-agentflow-cli 0.2.0__tar.gz → 0.2.2__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.2.0 → 10xscale_agentflow_cli-0.2.2}/10xscale_agentflow_cli.egg-info/PKG-INFO +1 -1
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/PKG-INFO +1 -1
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/auth/auth_backend.py +8 -3
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/auth/base_auth.py +5 -2
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/auth/jwt_auth.py +7 -3
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/config/setup_middleware.py +31 -3
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/loader.py +20 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/graph/router.py +3 -2
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/graph/services/graph_service.py +11 -9
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/graph/react.py +2 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/pyproject.toml +1 -1
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/10xscale_agentflow_cli.egg-info/SOURCES.txt +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/10xscale_agentflow_cli.egg-info/dependency_links.txt +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/10xscale_agentflow_cli.egg-info/entry_points.txt +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/10xscale_agentflow_cli.egg-info/not-zip-safe +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/10xscale_agentflow_cli.egg-info/requires.txt +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/10xscale_agentflow_cli.egg-info/top_level.txt +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/MANIFEST.in +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/README.md +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/Task.md +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow.json +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/api.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/build.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/init.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/version.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/constants.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/config.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/output.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/validation.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/exceptions.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/logger.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/main.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/templates/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/templates/defaults.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/auth/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/config/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/config/graph_config.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/config/sentry_config.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/config/settings.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/config/setup_logs.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/config/worker_middleware.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/exceptions/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/exceptions/general_exception.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/exceptions/handle_errors.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/exceptions/resources_exceptions.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/core/exceptions/user_exception.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/main.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/checkpointer/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/checkpointer/router.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/checkpointer/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/checkpointer/schemas/checkpointer_schemas.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/checkpointer/services/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/checkpointer/services/checkpointer_service.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/graph/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/graph/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/graph/schemas/graph_schemas.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/graph/services/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/ping/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/ping/router.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/setup_router.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/store/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/store/router.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/store/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/store/schemas/store_schemas.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/store/services/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/routers/store/services/store_service.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/tasks/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/tasks/user_tasks.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/callable_helper.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/parse_output.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/response_helper.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/schemas/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/schemas/output_schemas.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/schemas/user_schemas.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/snowflake_id_generator.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/swagger_helper.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/utils/thread_name_generator.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/worker.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/graph/__init__.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/graph/thread_name_generator.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/scripts/generate_docs.py +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/setup.cfg +0 -0
- {10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/tests/test_utils_parse_and_callable.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
-
from fastapi import Depends, Response
|
|
3
|
+
from fastapi import Depends, Request, Response
|
|
4
4
|
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
|
5
5
|
from injectq.integrations import InjectAPI
|
|
6
6
|
|
|
@@ -10,7 +10,8 @@ from agentflow_cli.src.app.core.config.graph_config import GraphConfig
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def verify_current_user(
|
|
13
|
-
|
|
13
|
+
request: Request,
|
|
14
|
+
response: Response,
|
|
14
15
|
credential: HTTPAuthorizationCredentials = Depends(
|
|
15
16
|
HTTPBearer(auto_error=False),
|
|
16
17
|
),
|
|
@@ -27,7 +28,11 @@ def verify_current_user(
|
|
|
27
28
|
logger.error("Auth backend is not configured")
|
|
28
29
|
return user
|
|
29
30
|
|
|
30
|
-
user: dict | None = auth_backend.authenticate(
|
|
31
|
+
user: dict | None = auth_backend.authenticate(
|
|
32
|
+
request,
|
|
33
|
+
response,
|
|
34
|
+
credential,
|
|
35
|
+
)
|
|
31
36
|
if user and "user_id" not in user:
|
|
32
37
|
logger.error("Authentication failed: 'user_id' not found in user info")
|
|
33
38
|
return user or {}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from typing import Any
|
|
3
3
|
|
|
4
|
-
from fastapi import Response
|
|
4
|
+
from fastapi import Request, Response
|
|
5
5
|
from fastapi.security import HTTPAuthorizationCredentials
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class BaseAuth(ABC):
|
|
9
9
|
@abstractmethod
|
|
10
10
|
def authenticate(
|
|
11
|
-
self,
|
|
11
|
+
self,
|
|
12
|
+
request: Request,
|
|
13
|
+
response: Response,
|
|
14
|
+
credential: HTTPAuthorizationCredentials,
|
|
12
15
|
) -> dict[str, Any] | None:
|
|
13
16
|
"""Authenticate the user based on the provided credentials.
|
|
14
17
|
IT should return an empty dict if no authentication is required.
|
|
@@ -2,7 +2,7 @@ import os
|
|
|
2
2
|
from typing import Any
|
|
3
3
|
|
|
4
4
|
import jwt
|
|
5
|
-
from fastapi import Response
|
|
5
|
+
from fastapi import Request, Response
|
|
6
6
|
from fastapi.security import HTTPAuthorizationCredentials
|
|
7
7
|
|
|
8
8
|
from agentflow_cli.src.app.core import logger
|
|
@@ -12,7 +12,10 @@ from agentflow_cli.src.app.core.exceptions import UserAccountError
|
|
|
12
12
|
|
|
13
13
|
class JwtAuth(BaseAuth):
|
|
14
14
|
def authenticate(
|
|
15
|
-
self,
|
|
15
|
+
self,
|
|
16
|
+
request: Request,
|
|
17
|
+
response: Response,
|
|
18
|
+
credential: HTTPAuthorizationCredentials,
|
|
16
19
|
) -> dict[str, Any] | None:
|
|
17
20
|
"""No authentication is required, so return None."""
|
|
18
21
|
"""
|
|
@@ -72,7 +75,8 @@ class JwtAuth(BaseAuth):
|
|
|
72
75
|
message="Invalid token, please login again",
|
|
73
76
|
error_code="INVALID_TOKEN",
|
|
74
77
|
)
|
|
75
|
-
|
|
78
|
+
|
|
79
|
+
response.headers["WWW-Authenticate"] = 'Bearer realm="auth_required"'
|
|
76
80
|
|
|
77
81
|
# check if user_id exists in the token
|
|
78
82
|
if "user_id" not in decoded_token:
|
|
@@ -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.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/loader.py
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import importlib
|
|
2
2
|
import inspect
|
|
3
3
|
import logging
|
|
4
|
+
import os
|
|
5
|
+
from pathlib import Path
|
|
4
6
|
|
|
5
7
|
from agentflow.checkpointer import BaseCheckpointer
|
|
6
8
|
from agentflow.graph import CompiledGraph
|
|
@@ -197,6 +199,24 @@ async def attach_all_modules(
|
|
|
197
199
|
if auth_config:
|
|
198
200
|
method = auth_config.get("method", None)
|
|
199
201
|
path = auth_config.get("path", None)
|
|
202
|
+
if not path or not method:
|
|
203
|
+
raise ValueError("Both 'method' and 'path' must be specified in auth_config.")
|
|
204
|
+
|
|
205
|
+
# Extract file path before the ':' for existence check
|
|
206
|
+
module_or_path = path.split(":", 1)[0] if ":" in path else path
|
|
207
|
+
|
|
208
|
+
# Simple handling: if it appears to be a filesystem path, use it; otherwise
|
|
209
|
+
# convert dotted module path to a file path like src/auth/custom_auth.py
|
|
210
|
+
if os.path.sep in module_or_path or module_or_path.endswith(".py"):
|
|
211
|
+
file_path = Path(module_or_path)
|
|
212
|
+
elif "." in module_or_path and os.path.sep not in module_or_path:
|
|
213
|
+
file_path = Path(module_or_path.replace(".", os.path.sep) + ".py")
|
|
214
|
+
else:
|
|
215
|
+
file_path = Path(module_or_path)
|
|
216
|
+
|
|
217
|
+
if not file_path.exists():
|
|
218
|
+
raise ValueError(f"Custom auth path does not exist: {module_or_path}")
|
|
219
|
+
|
|
200
220
|
if method == "custom":
|
|
201
221
|
auth_backend = load_auth(
|
|
202
222
|
path,
|
|
@@ -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
|
|
@@ -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(serialize_as_any=True)
|
|
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}")
|
|
@@ -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
|
|
|
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.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/__init__.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/api.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/build.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/init.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/commands/version.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/constants.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/__init__.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/config.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/output.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/cli/core/validation.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/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.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/__init__.py
RENAMED
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/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.2.0 → 10xscale_agentflow_cli-0.2.2}/agentflow_cli/src/app/worker.py
RENAMED
|
File without changes
|
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/graph/thread_name_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{10xscale_agentflow_cli-0.2.0 → 10xscale_agentflow_cli-0.2.2}/tests/test_utils_parse_and_callable.py
RENAMED
|
File without changes
|