agentex-sdk 0.1.0__py3-none-any.whl
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.
- agentex/__init__.py +103 -0
- agentex/_base_client.py +1992 -0
- agentex/_client.py +506 -0
- agentex/_compat.py +219 -0
- agentex/_constants.py +14 -0
- agentex/_exceptions.py +108 -0
- agentex/_files.py +123 -0
- agentex/_models.py +829 -0
- agentex/_qs.py +150 -0
- agentex/_resource.py +43 -0
- agentex/_response.py +830 -0
- agentex/_streaming.py +333 -0
- agentex/_types.py +219 -0
- agentex/_utils/__init__.py +57 -0
- agentex/_utils/_logs.py +25 -0
- agentex/_utils/_proxy.py +65 -0
- agentex/_utils/_reflection.py +42 -0
- agentex/_utils/_resources_proxy.py +24 -0
- agentex/_utils/_streams.py +12 -0
- agentex/_utils/_sync.py +86 -0
- agentex/_utils/_transform.py +447 -0
- agentex/_utils/_typing.py +151 -0
- agentex/_utils/_utils.py +422 -0
- agentex/_version.py +4 -0
- agentex/lib/.keep +4 -0
- agentex/lib/__init__.py +0 -0
- agentex/lib/adk/__init__.py +41 -0
- agentex/lib/adk/_modules/__init__.py +0 -0
- agentex/lib/adk/_modules/acp.py +247 -0
- agentex/lib/adk/_modules/agent_task_tracker.py +176 -0
- agentex/lib/adk/_modules/agents.py +77 -0
- agentex/lib/adk/_modules/events.py +141 -0
- agentex/lib/adk/_modules/messages.py +285 -0
- agentex/lib/adk/_modules/state.py +291 -0
- agentex/lib/adk/_modules/streaming.py +75 -0
- agentex/lib/adk/_modules/tasks.py +124 -0
- agentex/lib/adk/_modules/tracing.py +194 -0
- agentex/lib/adk/providers/__init__.py +9 -0
- agentex/lib/adk/providers/_modules/__init__.py +0 -0
- agentex/lib/adk/providers/_modules/litellm.py +232 -0
- agentex/lib/adk/providers/_modules/openai.py +416 -0
- agentex/lib/adk/providers/_modules/sgp.py +85 -0
- agentex/lib/adk/utils/__init__.py +5 -0
- agentex/lib/adk/utils/_modules/__init__.py +0 -0
- agentex/lib/adk/utils/_modules/templating.py +94 -0
- agentex/lib/cli/__init__.py +0 -0
- agentex/lib/cli/commands/__init__.py +0 -0
- agentex/lib/cli/commands/agents.py +328 -0
- agentex/lib/cli/commands/init.py +227 -0
- agentex/lib/cli/commands/main.py +33 -0
- agentex/lib/cli/commands/secrets.py +169 -0
- agentex/lib/cli/commands/tasks.py +118 -0
- agentex/lib/cli/commands/uv.py +133 -0
- agentex/lib/cli/handlers/__init__.py +0 -0
- agentex/lib/cli/handlers/agent_handlers.py +160 -0
- agentex/lib/cli/handlers/cleanup_handlers.py +186 -0
- agentex/lib/cli/handlers/deploy_handlers.py +351 -0
- agentex/lib/cli/handlers/run_handlers.py +452 -0
- agentex/lib/cli/handlers/secret_handlers.py +670 -0
- agentex/lib/cli/templates/default/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/default/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/default/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/default/README.md.j2 +193 -0
- agentex/lib/cli/templates/default/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/default/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/default/project/acp.py.j2 +29 -0
- agentex/lib/cli/templates/default/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/default/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/deploy/Screenshot 2025-03-19 at 10.36.57/342/200/257AM.png +0 -0
- agentex/lib/cli/templates/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/sync/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/sync/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/sync/README.md.j2 +293 -0
- agentex/lib/cli/templates/sync/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/sync/project/acp.py.j2 +26 -0
- agentex/lib/cli/templates/sync/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/sync/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/temporal/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/temporal/Dockerfile-uv.j2 +48 -0
- agentex/lib/cli/templates/temporal/Dockerfile.j2 +48 -0
- agentex/lib/cli/templates/temporal/README.md.j2 +316 -0
- agentex/lib/cli/templates/temporal/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/temporal/manifest.yaml.j2 +137 -0
- agentex/lib/cli/templates/temporal/project/acp.py.j2 +30 -0
- agentex/lib/cli/templates/temporal/project/run_worker.py.j2 +33 -0
- agentex/lib/cli/templates/temporal/project/workflow.py.j2 +66 -0
- agentex/lib/cli/templates/temporal/pyproject.toml.j2 +34 -0
- agentex/lib/cli/templates/temporal/requirements.txt.j2 +5 -0
- agentex/lib/cli/utils/cli_utils.py +14 -0
- agentex/lib/cli/utils/credential_utils.py +103 -0
- agentex/lib/cli/utils/exceptions.py +6 -0
- agentex/lib/cli/utils/kubectl_utils.py +135 -0
- agentex/lib/cli/utils/kubernetes_secrets_utils.py +185 -0
- agentex/lib/core/__init__.py +0 -0
- agentex/lib/core/adapters/__init__.py +0 -0
- agentex/lib/core/adapters/llm/__init__.py +1 -0
- agentex/lib/core/adapters/llm/adapter_litellm.py +46 -0
- agentex/lib/core/adapters/llm/adapter_sgp.py +55 -0
- agentex/lib/core/adapters/llm/port.py +24 -0
- agentex/lib/core/adapters/streams/adapter_redis.py +128 -0
- agentex/lib/core/adapters/streams/port.py +50 -0
- agentex/lib/core/clients/__init__.py +1 -0
- agentex/lib/core/clients/temporal/__init__.py +0 -0
- agentex/lib/core/clients/temporal/temporal_client.py +181 -0
- agentex/lib/core/clients/temporal/types.py +47 -0
- agentex/lib/core/clients/temporal/utils.py +56 -0
- agentex/lib/core/services/__init__.py +0 -0
- agentex/lib/core/services/adk/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/acp.py +210 -0
- agentex/lib/core/services/adk/agent_task_tracker.py +85 -0
- agentex/lib/core/services/adk/agents.py +43 -0
- agentex/lib/core/services/adk/events.py +61 -0
- agentex/lib/core/services/adk/messages.py +164 -0
- agentex/lib/core/services/adk/providers/__init__.py +0 -0
- agentex/lib/core/services/adk/providers/litellm.py +256 -0
- agentex/lib/core/services/adk/providers/openai.py +723 -0
- agentex/lib/core/services/adk/providers/sgp.py +99 -0
- agentex/lib/core/services/adk/state.py +120 -0
- agentex/lib/core/services/adk/streaming.py +262 -0
- agentex/lib/core/services/adk/tasks.py +69 -0
- agentex/lib/core/services/adk/tracing.py +36 -0
- agentex/lib/core/services/adk/utils/__init__.py +0 -0
- agentex/lib/core/services/adk/utils/templating.py +58 -0
- agentex/lib/core/temporal/__init__.py +0 -0
- agentex/lib/core/temporal/activities/__init__.py +207 -0
- agentex/lib/core/temporal/activities/activity_helpers.py +37 -0
- agentex/lib/core/temporal/activities/adk/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/acp_activities.py +86 -0
- agentex/lib/core/temporal/activities/adk/agent_task_tracker_activities.py +76 -0
- agentex/lib/core/temporal/activities/adk/agents_activities.py +35 -0
- agentex/lib/core/temporal/activities/adk/events_activities.py +50 -0
- agentex/lib/core/temporal/activities/adk/messages_activities.py +94 -0
- agentex/lib/core/temporal/activities/adk/providers/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/providers/litellm_activities.py +71 -0
- agentex/lib/core/temporal/activities/adk/providers/openai_activities.py +210 -0
- agentex/lib/core/temporal/activities/adk/providers/sgp_activities.py +42 -0
- agentex/lib/core/temporal/activities/adk/state_activities.py +85 -0
- agentex/lib/core/temporal/activities/adk/streaming_activities.py +33 -0
- agentex/lib/core/temporal/activities/adk/tasks_activities.py +48 -0
- agentex/lib/core/temporal/activities/adk/tracing_activities.py +55 -0
- agentex/lib/core/temporal/activities/adk/utils/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/utils/templating_activities.py +41 -0
- agentex/lib/core/temporal/services/__init__.py +0 -0
- agentex/lib/core/temporal/services/temporal_task_service.py +69 -0
- agentex/lib/core/temporal/types/__init__.py +0 -0
- agentex/lib/core/temporal/types/workflow.py +5 -0
- agentex/lib/core/temporal/workers/__init__.py +0 -0
- agentex/lib/core/temporal/workers/worker.py +162 -0
- agentex/lib/core/temporal/workflows/workflow.py +26 -0
- agentex/lib/core/tracing/__init__.py +5 -0
- agentex/lib/core/tracing/processors/agentex_tracing_processor.py +117 -0
- agentex/lib/core/tracing/processors/sgp_tracing_processor.py +119 -0
- agentex/lib/core/tracing/processors/tracing_processor_interface.py +40 -0
- agentex/lib/core/tracing/trace.py +311 -0
- agentex/lib/core/tracing/tracer.py +70 -0
- agentex/lib/core/tracing/tracing_processor_manager.py +62 -0
- agentex/lib/environment_variables.py +87 -0
- agentex/lib/py.typed +0 -0
- agentex/lib/sdk/__init__.py +0 -0
- agentex/lib/sdk/config/__init__.py +0 -0
- agentex/lib/sdk/config/agent_config.py +61 -0
- agentex/lib/sdk/config/agent_manifest.py +219 -0
- agentex/lib/sdk/config/build_config.py +35 -0
- agentex/lib/sdk/config/deployment_config.py +117 -0
- agentex/lib/sdk/config/local_development_config.py +56 -0
- agentex/lib/sdk/config/project_config.py +103 -0
- agentex/lib/sdk/fastacp/__init__.py +3 -0
- agentex/lib/sdk/fastacp/base/base_acp_server.py +406 -0
- agentex/lib/sdk/fastacp/fastacp.py +74 -0
- agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +72 -0
- agentex/lib/sdk/fastacp/impl/sync_acp.py +109 -0
- agentex/lib/sdk/fastacp/impl/temporal_acp.py +97 -0
- agentex/lib/sdk/fastacp/tests/README.md +297 -0
- agentex/lib/sdk/fastacp/tests/conftest.py +307 -0
- agentex/lib/sdk/fastacp/tests/pytest.ini +10 -0
- agentex/lib/sdk/fastacp/tests/run_tests.py +227 -0
- agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +450 -0
- agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +344 -0
- agentex/lib/sdk/fastacp/tests/test_integration.py +477 -0
- agentex/lib/sdk/state_machine/__init__.py +6 -0
- agentex/lib/sdk/state_machine/noop_workflow.py +21 -0
- agentex/lib/sdk/state_machine/state.py +10 -0
- agentex/lib/sdk/state_machine/state_machine.py +189 -0
- agentex/lib/sdk/state_machine/state_workflow.py +16 -0
- agentex/lib/sdk/utils/__init__.py +0 -0
- agentex/lib/sdk/utils/messages.py +223 -0
- agentex/lib/types/__init__.py +0 -0
- agentex/lib/types/acp.py +94 -0
- agentex/lib/types/agent_configs.py +79 -0
- agentex/lib/types/agent_results.py +29 -0
- agentex/lib/types/credentials.py +34 -0
- agentex/lib/types/fastacp.py +61 -0
- agentex/lib/types/files.py +13 -0
- agentex/lib/types/json_rpc.py +49 -0
- agentex/lib/types/llm_messages.py +354 -0
- agentex/lib/types/task_message_updates.py +171 -0
- agentex/lib/types/tracing.py +34 -0
- agentex/lib/utils/__init__.py +0 -0
- agentex/lib/utils/completions.py +131 -0
- agentex/lib/utils/console.py +14 -0
- agentex/lib/utils/io.py +29 -0
- agentex/lib/utils/iterables.py +14 -0
- agentex/lib/utils/json_schema.py +23 -0
- agentex/lib/utils/logging.py +31 -0
- agentex/lib/utils/mcp.py +17 -0
- agentex/lib/utils/model_utils.py +46 -0
- agentex/lib/utils/parsing.py +15 -0
- agentex/lib/utils/regex.py +6 -0
- agentex/lib/utils/temporal.py +13 -0
- agentex/py.typed +0 -0
- agentex/resources/__init__.py +103 -0
- agentex/resources/agents.py +707 -0
- agentex/resources/events.py +294 -0
- agentex/resources/messages/__init__.py +33 -0
- agentex/resources/messages/batch.py +271 -0
- agentex/resources/messages/messages.py +492 -0
- agentex/resources/spans.py +557 -0
- agentex/resources/states.py +544 -0
- agentex/resources/tasks.py +615 -0
- agentex/resources/tracker.py +384 -0
- agentex/types/__init__.py +56 -0
- agentex/types/acp_type.py +7 -0
- agentex/types/agent.py +29 -0
- agentex/types/agent_list_params.py +13 -0
- agentex/types/agent_list_response.py +10 -0
- agentex/types/agent_rpc_by_name_params.py +21 -0
- agentex/types/agent_rpc_params.py +51 -0
- agentex/types/agent_rpc_params1.py +21 -0
- agentex/types/agent_rpc_response.py +20 -0
- agentex/types/agent_rpc_result.py +90 -0
- agentex/types/agent_task_tracker.py +34 -0
- agentex/types/data_content.py +30 -0
- agentex/types/data_content_param.py +31 -0
- agentex/types/data_delta.py +14 -0
- agentex/types/event.py +29 -0
- agentex/types/event_list_params.py +22 -0
- agentex/types/event_list_response.py +10 -0
- agentex/types/message_author.py +7 -0
- agentex/types/message_create_params.py +18 -0
- agentex/types/message_list_params.py +14 -0
- agentex/types/message_list_response.py +10 -0
- agentex/types/message_style.py +7 -0
- agentex/types/message_update_params.py +18 -0
- agentex/types/messages/__init__.py +8 -0
- agentex/types/messages/batch_create_params.py +16 -0
- agentex/types/messages/batch_create_response.py +10 -0
- agentex/types/messages/batch_update_params.py +16 -0
- agentex/types/messages/batch_update_response.py +10 -0
- agentex/types/shared/__init__.py +3 -0
- agentex/types/shared/task_message_update.py +83 -0
- agentex/types/span.py +36 -0
- agentex/types/span_create_params.py +40 -0
- agentex/types/span_list_params.py +12 -0
- agentex/types/span_list_response.py +10 -0
- agentex/types/span_update_params.py +37 -0
- agentex/types/state.py +25 -0
- agentex/types/state_create_params.py +16 -0
- agentex/types/state_list_params.py +16 -0
- agentex/types/state_list_response.py +10 -0
- agentex/types/state_update_params.py +16 -0
- agentex/types/task.py +23 -0
- agentex/types/task_delete_by_name_response.py +8 -0
- agentex/types/task_delete_response.py +8 -0
- agentex/types/task_list_response.py +10 -0
- agentex/types/task_message.py +33 -0
- agentex/types/task_message_content.py +16 -0
- agentex/types/task_message_content_param.py +17 -0
- agentex/types/task_message_delta.py +16 -0
- agentex/types/text_content.py +53 -0
- agentex/types/text_content_param.py +54 -0
- agentex/types/text_delta.py +14 -0
- agentex/types/tool_request_content.py +36 -0
- agentex/types/tool_request_content_param.py +37 -0
- agentex/types/tool_request_delta.py +18 -0
- agentex/types/tool_response_content.py +36 -0
- agentex/types/tool_response_content_param.py +36 -0
- agentex/types/tool_response_delta.py +18 -0
- agentex/types/tracker_list_params.py +16 -0
- agentex/types/tracker_list_response.py +10 -0
- agentex/types/tracker_update_params.py +19 -0
- agentex_sdk-0.1.0.dist-info/METADATA +423 -0
- agentex_sdk-0.1.0.dist-info/RECORD +289 -0
- agentex_sdk-0.1.0.dist-info/WHEEL +4 -0
- agentex_sdk-0.1.0.dist-info/entry_points.txt +2 -0
- agentex_sdk-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,285 @@
|
|
1
|
+
from datetime import timedelta
|
2
|
+
|
3
|
+
from temporalio.common import RetryPolicy
|
4
|
+
|
5
|
+
from agentex import AsyncAgentex
|
6
|
+
from agentex.lib.core.adapters.streams.adapter_redis import RedisEventStreamRepository
|
7
|
+
from agentex.lib.core.services.adk.messages import MessagesService
|
8
|
+
from agentex.lib.core.services.adk.streaming import StreamingService
|
9
|
+
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
10
|
+
from agentex.lib.core.temporal.activities.adk.messages_activities import (
|
11
|
+
CreateMessageParams,
|
12
|
+
CreateMessagesBatchParams,
|
13
|
+
ListMessagesParams,
|
14
|
+
MessagesActivityName,
|
15
|
+
UpdateMessageParams,
|
16
|
+
UpdateMessagesBatchParams,
|
17
|
+
)
|
18
|
+
from agentex.lib.core.tracing.tracer import AsyncTracer
|
19
|
+
from agentex.types.task_message import TaskMessage, TaskMessageContent
|
20
|
+
from agentex.lib.utils.logging import make_logger
|
21
|
+
from agentex.lib.utils.temporal import in_temporal_workflow
|
22
|
+
|
23
|
+
logger = make_logger(__name__)
|
24
|
+
|
25
|
+
# Default retry policy for all message operations
|
26
|
+
DEFAULT_RETRY_POLICY = RetryPolicy(maximum_attempts=1)
|
27
|
+
|
28
|
+
|
29
|
+
class MessagesModule:
|
30
|
+
"""
|
31
|
+
Module for managing task messages in Agentex.
|
32
|
+
Provides high-level async methods for creating, retrieving, updating, and deleting messages.
|
33
|
+
"""
|
34
|
+
|
35
|
+
def __init__(
|
36
|
+
self,
|
37
|
+
messages_service: MessagesService | None = None,
|
38
|
+
):
|
39
|
+
if messages_service is None:
|
40
|
+
agentex_client = AsyncAgentex()
|
41
|
+
stream_repository = RedisEventStreamRepository()
|
42
|
+
streaming_service = StreamingService(
|
43
|
+
agentex_client=agentex_client,
|
44
|
+
stream_repository=stream_repository,
|
45
|
+
)
|
46
|
+
tracer = AsyncTracer(agentex_client)
|
47
|
+
self._messages_service = MessagesService(
|
48
|
+
agentex_client=agentex_client,
|
49
|
+
streaming_service=streaming_service,
|
50
|
+
tracer=tracer,
|
51
|
+
)
|
52
|
+
else:
|
53
|
+
self._messages_service = messages_service
|
54
|
+
|
55
|
+
async def create(
|
56
|
+
self,
|
57
|
+
task_id: str,
|
58
|
+
content: TaskMessageContent,
|
59
|
+
emit_updates: bool = True,
|
60
|
+
trace_id: str | None = None,
|
61
|
+
parent_span_id: str | None = None,
|
62
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
63
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
64
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
65
|
+
) -> TaskMessage:
|
66
|
+
"""
|
67
|
+
Create a new message for a task.
|
68
|
+
|
69
|
+
Args:
|
70
|
+
task_id (str): The ID of the task.
|
71
|
+
message (TaskMessage): The message to create.
|
72
|
+
trace_id (Optional[str]): The trace ID for tracing.
|
73
|
+
parent_span_id (Optional[str]): The parent span ID for tracing.
|
74
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
75
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
76
|
+
retry_policy (RetryPolicy): The retry policy.
|
77
|
+
|
78
|
+
Returns:
|
79
|
+
TaskMessageEntity: The created message.
|
80
|
+
"""
|
81
|
+
params = CreateMessageParams(
|
82
|
+
trace_id=trace_id,
|
83
|
+
parent_span_id=parent_span_id,
|
84
|
+
task_id=task_id,
|
85
|
+
content=content,
|
86
|
+
emit_updates=emit_updates,
|
87
|
+
)
|
88
|
+
if in_temporal_workflow():
|
89
|
+
return await ActivityHelpers.execute_activity(
|
90
|
+
activity_name=MessagesActivityName.CREATE_MESSAGE,
|
91
|
+
request=params,
|
92
|
+
response_type=TaskMessage,
|
93
|
+
start_to_close_timeout=start_to_close_timeout,
|
94
|
+
retry_policy=retry_policy,
|
95
|
+
heartbeat_timeout=heartbeat_timeout,
|
96
|
+
)
|
97
|
+
else:
|
98
|
+
return await self._messages_service.create_message(
|
99
|
+
task_id=task_id,
|
100
|
+
content=content,
|
101
|
+
emit_updates=emit_updates,
|
102
|
+
)
|
103
|
+
|
104
|
+
async def update(
|
105
|
+
self,
|
106
|
+
task_id: str,
|
107
|
+
message_id: str,
|
108
|
+
content: TaskMessageContent,
|
109
|
+
trace_id: str | None = None,
|
110
|
+
parent_span_id: str | None = None,
|
111
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
112
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
113
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
114
|
+
) -> TaskMessage:
|
115
|
+
"""
|
116
|
+
Update a message for a task.
|
117
|
+
|
118
|
+
Args:
|
119
|
+
task_id (str): The ID of the task.
|
120
|
+
message_id (str): The ID of the message.
|
121
|
+
message (TaskMessage): The message to update.
|
122
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
123
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
124
|
+
retry_policy (RetryPolicy): The retry policy.
|
125
|
+
|
126
|
+
Returns:
|
127
|
+
TaskMessageEntity: The updated message.
|
128
|
+
"""
|
129
|
+
params = UpdateMessageParams(
|
130
|
+
task_id=task_id,
|
131
|
+
message_id=message_id,
|
132
|
+
content=content,
|
133
|
+
trace_id=trace_id,
|
134
|
+
parent_span_id=parent_span_id,
|
135
|
+
)
|
136
|
+
if in_temporal_workflow():
|
137
|
+
return await ActivityHelpers.execute_activity(
|
138
|
+
activity_name=MessagesActivityName.UPDATE_MESSAGE,
|
139
|
+
request=params,
|
140
|
+
response_type=TaskMessage,
|
141
|
+
start_to_close_timeout=start_to_close_timeout,
|
142
|
+
retry_policy=retry_policy,
|
143
|
+
heartbeat_timeout=heartbeat_timeout,
|
144
|
+
)
|
145
|
+
else:
|
146
|
+
return await self._messages_service.update_message(
|
147
|
+
task_id=task_id,
|
148
|
+
message_id=message_id,
|
149
|
+
content=content,
|
150
|
+
)
|
151
|
+
|
152
|
+
async def create_batch(
|
153
|
+
self,
|
154
|
+
task_id: str,
|
155
|
+
contents: list[TaskMessageContent],
|
156
|
+
emit_updates: bool = True,
|
157
|
+
trace_id: str | None = None,
|
158
|
+
parent_span_id: str | None = None,
|
159
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
160
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
161
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
162
|
+
) -> list[TaskMessage]:
|
163
|
+
"""
|
164
|
+
Create a batch of messages for a task.
|
165
|
+
|
166
|
+
Args:
|
167
|
+
task_id (str): The ID of the task.
|
168
|
+
messages (List[TaskMessage]): The messages to create.
|
169
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
170
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
171
|
+
retry_policy (RetryPolicy): The retry policy.
|
172
|
+
|
173
|
+
Returns:
|
174
|
+
List[TaskMessageEntity]: The created messages.
|
175
|
+
"""
|
176
|
+
params = CreateMessagesBatchParams(
|
177
|
+
task_id=task_id,
|
178
|
+
contents=contents,
|
179
|
+
emit_updates=emit_updates,
|
180
|
+
trace_id=trace_id,
|
181
|
+
parent_span_id=parent_span_id,
|
182
|
+
)
|
183
|
+
if in_temporal_workflow():
|
184
|
+
return await ActivityHelpers.execute_activity(
|
185
|
+
activity_name=MessagesActivityName.CREATE_MESSAGES_BATCH,
|
186
|
+
request=params,
|
187
|
+
response_type=list[TaskMessage],
|
188
|
+
start_to_close_timeout=start_to_close_timeout,
|
189
|
+
retry_policy=retry_policy,
|
190
|
+
heartbeat_timeout=heartbeat_timeout,
|
191
|
+
)
|
192
|
+
else:
|
193
|
+
return await self._messages_service.create_messages_batch(
|
194
|
+
task_id=task_id,
|
195
|
+
contents=contents,
|
196
|
+
emit_updates=emit_updates,
|
197
|
+
)
|
198
|
+
|
199
|
+
async def update_batch(
|
200
|
+
self,
|
201
|
+
task_id: str,
|
202
|
+
updates: dict[str, TaskMessageContent],
|
203
|
+
trace_id: str | None = None,
|
204
|
+
parent_span_id: str | None = None,
|
205
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
206
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
207
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
208
|
+
) -> list[TaskMessage]:
|
209
|
+
"""
|
210
|
+
Update a batch of messages for a task.
|
211
|
+
|
212
|
+
Args:
|
213
|
+
task_id (str): The ID of the task.
|
214
|
+
updates (Dict[str, TaskMessage]): The updates to apply to the messages.
|
215
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
216
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
217
|
+
retry_policy (RetryPolicy): The retry policy.
|
218
|
+
|
219
|
+
Returns:
|
220
|
+
List[TaskMessageEntity]: The updated messages.
|
221
|
+
"""
|
222
|
+
params = UpdateMessagesBatchParams(
|
223
|
+
task_id=task_id,
|
224
|
+
updates=updates,
|
225
|
+
trace_id=trace_id,
|
226
|
+
parent_span_id=parent_span_id,
|
227
|
+
)
|
228
|
+
if in_temporal_workflow():
|
229
|
+
return await ActivityHelpers.execute_activity(
|
230
|
+
activity_name=MessagesActivityName.UPDATE_MESSAGES_BATCH,
|
231
|
+
request=params,
|
232
|
+
response_type=list[TaskMessage],
|
233
|
+
start_to_close_timeout=start_to_close_timeout,
|
234
|
+
retry_policy=retry_policy,
|
235
|
+
heartbeat_timeout=heartbeat_timeout,
|
236
|
+
)
|
237
|
+
else:
|
238
|
+
return await self._messages_service.update_messages_batch(
|
239
|
+
task_id=task_id,
|
240
|
+
updates=updates,
|
241
|
+
)
|
242
|
+
|
243
|
+
async def list(
|
244
|
+
self,
|
245
|
+
task_id: str,
|
246
|
+
limit: int | None = None,
|
247
|
+
trace_id: str | None = None,
|
248
|
+
parent_span_id: str | None = None,
|
249
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
250
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
251
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
252
|
+
) -> list[TaskMessage]:
|
253
|
+
"""
|
254
|
+
List messages for a task.
|
255
|
+
|
256
|
+
Args:
|
257
|
+
task_id (str): The ID of the task.
|
258
|
+
limit (Optional[int]): The maximum number of messages to return.
|
259
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
260
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
261
|
+
retry_policy (RetryPolicy): The retry policy.
|
262
|
+
|
263
|
+
Returns:
|
264
|
+
List[TaskMessageEntity]: The list of messages.
|
265
|
+
"""
|
266
|
+
params = ListMessagesParams(
|
267
|
+
task_id=task_id,
|
268
|
+
limit=limit,
|
269
|
+
trace_id=trace_id,
|
270
|
+
parent_span_id=parent_span_id,
|
271
|
+
)
|
272
|
+
if in_temporal_workflow():
|
273
|
+
return await ActivityHelpers.execute_activity(
|
274
|
+
activity_name=MessagesActivityName.LIST_MESSAGES,
|
275
|
+
request=params,
|
276
|
+
response_type=list[TaskMessage],
|
277
|
+
start_to_close_timeout=start_to_close_timeout,
|
278
|
+
retry_policy=retry_policy,
|
279
|
+
heartbeat_timeout=heartbeat_timeout,
|
280
|
+
)
|
281
|
+
else:
|
282
|
+
return await self._messages_service.list_messages(
|
283
|
+
task_id=task_id,
|
284
|
+
limit=limit,
|
285
|
+
)
|
@@ -0,0 +1,291 @@
|
|
1
|
+
from datetime import timedelta
|
2
|
+
from typing import Any
|
3
|
+
|
4
|
+
from pydantic import BaseModel
|
5
|
+
from temporalio.common import RetryPolicy
|
6
|
+
|
7
|
+
from agentex import AsyncAgentex
|
8
|
+
from agentex.lib.core.services.adk.state import StateService
|
9
|
+
from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
|
10
|
+
from agentex.lib.core.temporal.activities.adk.state_activities import (
|
11
|
+
CreateStateParams,
|
12
|
+
DeleteStateParams,
|
13
|
+
GetStateParams,
|
14
|
+
StateActivityName,
|
15
|
+
UpdateStateParams,
|
16
|
+
)
|
17
|
+
from agentex.lib.core.tracing.tracer import AsyncTracer
|
18
|
+
from agentex.types.state import State
|
19
|
+
from agentex.lib.utils.logging import make_logger
|
20
|
+
from agentex.lib.utils.temporal import in_temporal_workflow
|
21
|
+
|
22
|
+
logger = make_logger(__name__)
|
23
|
+
|
24
|
+
# Default retry policy for all state operations
|
25
|
+
DEFAULT_RETRY_POLICY = RetryPolicy(maximum_attempts=1)
|
26
|
+
|
27
|
+
|
28
|
+
class StateModule:
|
29
|
+
"""
|
30
|
+
Module for managing task state in Agentex.
|
31
|
+
Provides high-level async methods for creating, retrieving, updating, and deleting state.
|
32
|
+
"""
|
33
|
+
|
34
|
+
def __init__(
|
35
|
+
self,
|
36
|
+
state_service: StateService | None = None,
|
37
|
+
):
|
38
|
+
if state_service is None:
|
39
|
+
agentex_client = AsyncAgentex()
|
40
|
+
tracer = AsyncTracer(agentex_client)
|
41
|
+
self._state_service = StateService(
|
42
|
+
agentex_client=agentex_client, tracer=tracer
|
43
|
+
)
|
44
|
+
else:
|
45
|
+
self._state_service = state_service
|
46
|
+
|
47
|
+
async def create(
|
48
|
+
self,
|
49
|
+
task_id: str,
|
50
|
+
agent_id: str,
|
51
|
+
state: dict[str, Any] | BaseModel,
|
52
|
+
trace_id: str | None = None,
|
53
|
+
parent_span_id: str | None = None,
|
54
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
55
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
56
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
57
|
+
) -> State:
|
58
|
+
"""
|
59
|
+
Create a new state for a task and agent.
|
60
|
+
|
61
|
+
Args:
|
62
|
+
task_id (str): The ID of the task.
|
63
|
+
agent_id (str): The ID of the agent.
|
64
|
+
state (Dict[str, Any]): The state to create.
|
65
|
+
trace_id (Optional[str]): The trace ID for tracing.
|
66
|
+
parent_span_id (Optional[str]): The parent span ID for tracing.
|
67
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
68
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
69
|
+
retry_policy (RetryPolicy): The retry policy.
|
70
|
+
|
71
|
+
Returns:
|
72
|
+
State: The created state.
|
73
|
+
"""
|
74
|
+
state_dict = state.model_dump() if isinstance(state, BaseModel) else state
|
75
|
+
params = CreateStateParams(
|
76
|
+
task_id=task_id,
|
77
|
+
agent_id=agent_id,
|
78
|
+
state=state_dict,
|
79
|
+
trace_id=trace_id,
|
80
|
+
parent_span_id=parent_span_id,
|
81
|
+
)
|
82
|
+
if in_temporal_workflow():
|
83
|
+
return await ActivityHelpers.execute_activity(
|
84
|
+
activity_name=StateActivityName.CREATE_STATE,
|
85
|
+
request=params,
|
86
|
+
response_type=State,
|
87
|
+
start_to_close_timeout=start_to_close_timeout,
|
88
|
+
retry_policy=retry_policy,
|
89
|
+
heartbeat_timeout=heartbeat_timeout,
|
90
|
+
)
|
91
|
+
else:
|
92
|
+
return await self._state_service.create_state(
|
93
|
+
task_id=task_id,
|
94
|
+
agent_id=agent_id,
|
95
|
+
state=state_dict,
|
96
|
+
trace_id=trace_id,
|
97
|
+
parent_span_id=parent_span_id,
|
98
|
+
)
|
99
|
+
|
100
|
+
async def get(
|
101
|
+
self,
|
102
|
+
state_id: str,
|
103
|
+
trace_id: str | None = None,
|
104
|
+
parent_span_id: str | None = None,
|
105
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
106
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
107
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
108
|
+
) -> State | None:
|
109
|
+
"""
|
110
|
+
Get a state by ID.
|
111
|
+
|
112
|
+
Args:
|
113
|
+
state_id (str): The ID of the state.
|
114
|
+
trace_id (Optional[str]): The trace ID for tracing.
|
115
|
+
parent_span_id (Optional[str]): The parent span ID for tracing.
|
116
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
117
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
118
|
+
retry_policy (RetryPolicy): The retry policy.
|
119
|
+
|
120
|
+
Returns:
|
121
|
+
Optional[State]: The state if found, None otherwise.
|
122
|
+
"""
|
123
|
+
params = GetStateParams(
|
124
|
+
state_id=state_id,
|
125
|
+
trace_id=trace_id,
|
126
|
+
parent_span_id=parent_span_id,
|
127
|
+
)
|
128
|
+
if in_temporal_workflow():
|
129
|
+
return await ActivityHelpers.execute_activity(
|
130
|
+
activity_name=StateActivityName.GET_STATE,
|
131
|
+
request=params,
|
132
|
+
response_type=State,
|
133
|
+
start_to_close_timeout=start_to_close_timeout,
|
134
|
+
retry_policy=retry_policy,
|
135
|
+
heartbeat_timeout=heartbeat_timeout,
|
136
|
+
)
|
137
|
+
else:
|
138
|
+
return await self._state_service.get_state(
|
139
|
+
state_id=state_id,
|
140
|
+
trace_id=trace_id,
|
141
|
+
parent_span_id=parent_span_id,
|
142
|
+
)
|
143
|
+
|
144
|
+
async def get_by_task_and_agent(
|
145
|
+
self,
|
146
|
+
task_id: str,
|
147
|
+
agent_id: str,
|
148
|
+
trace_id: str | None = None,
|
149
|
+
parent_span_id: str | None = None,
|
150
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
151
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
152
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
153
|
+
) -> State | None:
|
154
|
+
"""
|
155
|
+
Get a state by task and agent ID. A state is uniquely identified by task and the agent that created it.
|
156
|
+
|
157
|
+
Args:
|
158
|
+
task_id (str): The ID of the task.
|
159
|
+
agent_id (str): The ID of the agent.
|
160
|
+
trace_id (Optional[str]): The trace ID for tracing.
|
161
|
+
parent_span_id (Optional[str]): The parent span ID for tracing.
|
162
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
163
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
164
|
+
retry_policy (RetryPolicy): The retry policy.
|
165
|
+
|
166
|
+
Returns:
|
167
|
+
Optional[State]: The state if found, None otherwise.
|
168
|
+
"""
|
169
|
+
params = GetStateParams(
|
170
|
+
task_id=task_id,
|
171
|
+
agent_id=agent_id,
|
172
|
+
trace_id=trace_id,
|
173
|
+
parent_span_id=parent_span_id,
|
174
|
+
)
|
175
|
+
if in_temporal_workflow():
|
176
|
+
return await ActivityHelpers.execute_activity(
|
177
|
+
activity_name=StateActivityName.GET_STATE,
|
178
|
+
request=params,
|
179
|
+
response_type=State,
|
180
|
+
start_to_close_timeout=start_to_close_timeout,
|
181
|
+
retry_policy=retry_policy,
|
182
|
+
heartbeat_timeout=heartbeat_timeout,
|
183
|
+
)
|
184
|
+
else:
|
185
|
+
return await self._state_service.get_state(
|
186
|
+
task_id=task_id,
|
187
|
+
agent_id=agent_id,
|
188
|
+
trace_id=trace_id,
|
189
|
+
parent_span_id=parent_span_id,
|
190
|
+
)
|
191
|
+
|
192
|
+
async def update(
|
193
|
+
self,
|
194
|
+
state_id: str,
|
195
|
+
task_id: str,
|
196
|
+
agent_id: str,
|
197
|
+
state: dict[str, Any] | BaseModel,
|
198
|
+
trace_id: str | None = None,
|
199
|
+
parent_span_id: str | None = None,
|
200
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
201
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
202
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
203
|
+
) -> State:
|
204
|
+
"""
|
205
|
+
Update a state by ID.
|
206
|
+
|
207
|
+
Args:
|
208
|
+
state_id (str): The ID of the state.
|
209
|
+
task_id (str): The ID of the task.
|
210
|
+
agent_id (str): The ID of the agent.
|
211
|
+
state (Dict[str, Any]): The state to update.
|
212
|
+
trace_id (Optional[str]): The trace ID for tracing.
|
213
|
+
parent_span_id (Optional[str]): The parent span ID for tracing.
|
214
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
215
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
216
|
+
retry_policy (RetryPolicy): The retry policy.
|
217
|
+
|
218
|
+
Returns:
|
219
|
+
State: The updated state.
|
220
|
+
"""
|
221
|
+
state_dict = state.model_dump() if isinstance(state, BaseModel) else state
|
222
|
+
params = UpdateStateParams(
|
223
|
+
state_id=state_id,
|
224
|
+
task_id=task_id,
|
225
|
+
agent_id=agent_id,
|
226
|
+
state=state_dict,
|
227
|
+
trace_id=trace_id,
|
228
|
+
parent_span_id=parent_span_id,
|
229
|
+
)
|
230
|
+
if in_temporal_workflow():
|
231
|
+
return await ActivityHelpers.execute_activity(
|
232
|
+
activity_name=StateActivityName.UPDATE_STATE,
|
233
|
+
request=params,
|
234
|
+
response_type=State,
|
235
|
+
start_to_close_timeout=start_to_close_timeout,
|
236
|
+
retry_policy=retry_policy,
|
237
|
+
heartbeat_timeout=heartbeat_timeout,
|
238
|
+
)
|
239
|
+
else:
|
240
|
+
return await self._state_service.update_state(
|
241
|
+
state_id=state_id,
|
242
|
+
task_id=task_id,
|
243
|
+
agent_id=agent_id,
|
244
|
+
state=state_dict,
|
245
|
+
trace_id=trace_id,
|
246
|
+
parent_span_id=parent_span_id,
|
247
|
+
)
|
248
|
+
|
249
|
+
async def delete(
|
250
|
+
self,
|
251
|
+
state_id: str,
|
252
|
+
trace_id: str | None = None,
|
253
|
+
parent_span_id: str | None = None,
|
254
|
+
start_to_close_timeout: timedelta = timedelta(seconds=5),
|
255
|
+
heartbeat_timeout: timedelta = timedelta(seconds=5),
|
256
|
+
retry_policy: RetryPolicy = DEFAULT_RETRY_POLICY,
|
257
|
+
) -> State:
|
258
|
+
"""
|
259
|
+
Delete a state by ID.
|
260
|
+
|
261
|
+
Args:
|
262
|
+
state_id (str): The ID of the state.
|
263
|
+
trace_id (Optional[str]): The trace ID for tracing.
|
264
|
+
parent_span_id (Optional[str]): The parent span ID for tracing.
|
265
|
+
start_to_close_timeout (timedelta): The start to close timeout.
|
266
|
+
heartbeat_timeout (timedelta): The heartbeat timeout.
|
267
|
+
retry_policy (RetryPolicy): The retry policy.
|
268
|
+
|
269
|
+
Returns:
|
270
|
+
State: The deleted state.
|
271
|
+
"""
|
272
|
+
params = DeleteStateParams(
|
273
|
+
state_id=state_id,
|
274
|
+
trace_id=trace_id,
|
275
|
+
parent_span_id=parent_span_id,
|
276
|
+
)
|
277
|
+
if in_temporal_workflow():
|
278
|
+
return await ActivityHelpers.execute_activity(
|
279
|
+
activity_name=StateActivityName.DELETE_STATE,
|
280
|
+
request=params,
|
281
|
+
response_type=State,
|
282
|
+
start_to_close_timeout=start_to_close_timeout,
|
283
|
+
retry_policy=retry_policy,
|
284
|
+
heartbeat_timeout=heartbeat_timeout,
|
285
|
+
)
|
286
|
+
else:
|
287
|
+
return await self._state_service.delete_state(
|
288
|
+
state_id=state_id,
|
289
|
+
trace_id=trace_id,
|
290
|
+
parent_span_id=parent_span_id,
|
291
|
+
)
|
@@ -0,0 +1,75 @@
|
|
1
|
+
from temporalio.common import RetryPolicy
|
2
|
+
|
3
|
+
from agentex import AsyncAgentex
|
4
|
+
from agentex.lib.core.adapters.streams.adapter_redis import RedisEventStreamRepository
|
5
|
+
from agentex.lib.core.services.adk.streaming import (
|
6
|
+
StreamingService,
|
7
|
+
StreamingTaskMessageContext,
|
8
|
+
)
|
9
|
+
from agentex.types.task_message_content import TaskMessageContent
|
10
|
+
from agentex.lib.utils.logging import make_logger
|
11
|
+
from agentex.lib.utils.temporal import in_temporal_workflow
|
12
|
+
|
13
|
+
logger = make_logger(__name__)
|
14
|
+
|
15
|
+
DEFAULT_RETRY_POLICY = RetryPolicy(maximum_attempts=1)
|
16
|
+
|
17
|
+
|
18
|
+
class StreamingModule:
|
19
|
+
"""
|
20
|
+
Module for streaming content to clients in Agentex.
|
21
|
+
|
22
|
+
This interface wraps around the StreamingService and provides a high-level API
|
23
|
+
for streaming events to clients, supporting both synchronous and asynchronous
|
24
|
+
(Temporal workflow) contexts.
|
25
|
+
"""
|
26
|
+
|
27
|
+
def __init__(self, streaming_service: StreamingService | None = None):
|
28
|
+
"""
|
29
|
+
Initialize the streaming interface.
|
30
|
+
|
31
|
+
Args:
|
32
|
+
streaming_service (Optional[StreamingService]): Optional StreamingService instance. If not provided,
|
33
|
+
a new service will be created with default parameters.
|
34
|
+
"""
|
35
|
+
if streaming_service is None:
|
36
|
+
stream_repository = RedisEventStreamRepository()
|
37
|
+
agentex_client = AsyncAgentex()
|
38
|
+
self._streaming_service = StreamingService(
|
39
|
+
agentex_client=agentex_client,
|
40
|
+
stream_repository=stream_repository,
|
41
|
+
)
|
42
|
+
else:
|
43
|
+
self._streaming_service = streaming_service
|
44
|
+
|
45
|
+
def streaming_task_message_context(
|
46
|
+
self,
|
47
|
+
task_id: str,
|
48
|
+
initial_content: TaskMessageContent,
|
49
|
+
) -> StreamingTaskMessageContext:
|
50
|
+
"""
|
51
|
+
Create a streaming context for managing TaskMessage lifecycle.
|
52
|
+
|
53
|
+
This is a context manager that automatically creates a TaskMessage, sends START event,
|
54
|
+
and sends DONE event when the context exits. Perfect for simple streaming scenarios.
|
55
|
+
|
56
|
+
Args:
|
57
|
+
task_id: The ID of the task
|
58
|
+
initial_content: The initial content for the TaskMessage
|
59
|
+
agentex_client: The agentex client for creating/updating messages
|
60
|
+
|
61
|
+
Returns:
|
62
|
+
StreamingTaskMessageContext: Context manager for streaming operations
|
63
|
+
"""
|
64
|
+
# Note: We don't support Temporal activities for streaming context methods yet
|
65
|
+
# since they involve complex state management across multiple activity calls
|
66
|
+
if in_temporal_workflow():
|
67
|
+
logger.warning(
|
68
|
+
"Streaming context methods are not yet supported in Temporal workflows. "
|
69
|
+
"You should wrap the entire streaming context in an activity. All nondeterministic network calls should be wrapped in an activity and generators cannot operate across activities and workflows."
|
70
|
+
)
|
71
|
+
|
72
|
+
return self._streaming_service.streaming_task_message_context(
|
73
|
+
task_id=task_id,
|
74
|
+
initial_content=initial_content,
|
75
|
+
)
|