workflow-exec-engine 0.0.2__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.
- workflow_engine/__init__.py +95 -0
- workflow_engine/client/__init__.py +47 -0
- workflow_engine/client/a2a_transport.py +560 -0
- workflow_engine/client/agentcard_normalizer.py +106 -0
- workflow_engine/client/auth_manager.py +127 -0
- workflow_engine/client/auth_provider.py +47 -0
- workflow_engine/client/credential_crypto.py +102 -0
- workflow_engine/client/credential_service.py +229 -0
- workflow_engine/client/engine_client.py +374 -0
- workflow_engine/client/env_file_loader.py +68 -0
- workflow_engine/client/extension_handlers.py +197 -0
- workflow_engine/client/extension_interceptor.py +76 -0
- workflow_engine/client/extension_sender.py +203 -0
- workflow_engine/client/extensions.py +43 -0
- workflow_engine/client/protocol_logger.py +78 -0
- workflow_engine/client/sse_normalization.py +87 -0
- workflow_engine/client/ssl_context.py +84 -0
- workflow_engine/client/stub_engine_client.py +68 -0
- workflow_engine/control/__init__.py +26 -0
- workflow_engine/control/control_points.py +223 -0
- workflow_engine/core/__init__.py +34 -0
- workflow_engine/core/context_builder.py +101 -0
- workflow_engine/core/executor.py +278 -0
- workflow_engine/core/models.py +184 -0
- workflow_engine/registry/__init__.py +21 -0
- workflow_engine/registry/registry_client.py +177 -0
- workflow_engine/runner.py +247 -0
- workflow_exec_engine-0.0.2.dist-info/METADATA +309 -0
- workflow_exec_engine-0.0.2.dist-info/RECORD +32 -0
- workflow_exec_engine-0.0.2.dist-info/WHEEL +5 -0
- workflow_exec_engine-0.0.2.dist-info/licenses/LICENSE +17 -0
- workflow_exec_engine-0.0.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Copyright (c) 2026 Huawei Technologies Co., Ltd.
|
|
2
|
+
# All Rights Reserved.
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
# not use this file except in compliance with the License. You may obtain
|
|
8
|
+
# a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
14
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
15
|
+
# License for the specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
"""Workflow Execution SDK for A2A-T agents.
|
|
20
|
+
|
|
21
|
+
Quick start:
|
|
22
|
+
|
|
23
|
+
from workflow_engine import (
|
|
24
|
+
WorkflowExecutor, ControlPoint,
|
|
25
|
+
A2ATransport, WorkflowEngineClient, ExtensionSender,
|
|
26
|
+
Workflow, TaskResponse, RouteDecision,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# 1. User fetches AgentCards (from registry or custom source)
|
|
30
|
+
# 2. User builds a shared transport, then the workflow facade on top
|
|
31
|
+
transport = A2ATransport(agent_cards=my_cards, a2at_env_path=".env")
|
|
32
|
+
engine_client = WorkflowEngineClient(transport)
|
|
33
|
+
|
|
34
|
+
# 3. User implements ControlPoint (workflow decisions)
|
|
35
|
+
class MyCP(ControlPoint):
|
|
36
|
+
async def on_task(self, request, engine_client):
|
|
37
|
+
result = await engine_client.send_message(request.agent_name, request.message)
|
|
38
|
+
return TaskResponse(success=True, output=result.text)
|
|
39
|
+
async def on_route(self, step_name, results, conditions):
|
|
40
|
+
return RouteDecision(next_step="step_b")
|
|
41
|
+
|
|
42
|
+
# 4. Optional: one-shot pre-positioning (Authorization-T / Notification-T)
|
|
43
|
+
# via ExtensionSender before workflow execution
|
|
44
|
+
# sender = ExtensionSender(transport)
|
|
45
|
+
# await sender.send_authorization("agent_a", "authorize", "policy text")
|
|
46
|
+
# await sender.send_notification("agent_a", "subscribe", "topic text")
|
|
47
|
+
|
|
48
|
+
# 5. Execute
|
|
49
|
+
executor = WorkflowExecutor(workflow=wf, control_point=MyCP(), engine_client=engine_client)
|
|
50
|
+
result = await executor.run()
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
from workflow_engine.core import (
|
|
54
|
+
Workflow, WorkflowStep, Task, JumpCondition,
|
|
55
|
+
StepType, TaskStatus, ExecutionResult,
|
|
56
|
+
SendMessageResult, TaskRequest, TaskResponse, RouteDecision,
|
|
57
|
+
WorkflowSearchResult,
|
|
58
|
+
ContextBuilder, WorkflowExecutor,
|
|
59
|
+
)
|
|
60
|
+
from workflow_engine.client import (
|
|
61
|
+
WorkflowEngineClient, A2ATransport, ExtensionSender, AuthManager,
|
|
62
|
+
ExtensionHandler, TaskTHandler, NegotiationTHandler, ExtensionRegistry,
|
|
63
|
+
A2ATExtension, AuthProvider,
|
|
64
|
+
create_ssl_context, normalize_agent_dict, StubWorkflowEngineClient,
|
|
65
|
+
log_request, log_response, log_response_event,
|
|
66
|
+
)
|
|
67
|
+
from workflow_engine.control import ControlPoint, EventCallback, EventType
|
|
68
|
+
from workflow_engine.control import (
|
|
69
|
+
NegotiationStrategy, DefaultControlPoint,
|
|
70
|
+
)
|
|
71
|
+
from workflow_engine.registry import RegistryClient, load_psop, search_psop
|
|
72
|
+
from workflow_engine.runner import execute_psop
|
|
73
|
+
|
|
74
|
+
__all__ = [
|
|
75
|
+
# Core
|
|
76
|
+
"Workflow", "WorkflowStep", "Task", "JumpCondition",
|
|
77
|
+
"StepType", "TaskStatus", "ExecutionResult",
|
|
78
|
+
"SendMessageResult", "TaskRequest", "TaskResponse", "RouteDecision",
|
|
79
|
+
"WorkflowSearchResult",
|
|
80
|
+
"ContextBuilder", "WorkflowExecutor",
|
|
81
|
+
# Client
|
|
82
|
+
"WorkflowEngineClient", "A2ATransport", "ExtensionSender", "AuthManager",
|
|
83
|
+
"ExtensionHandler", "TaskTHandler", "NegotiationTHandler", "ExtensionRegistry",
|
|
84
|
+
"A2ATExtension", "AuthProvider", "log_request", "log_response", "log_response_event", "StubWorkflowEngineClient",
|
|
85
|
+
"create_ssl_context", "normalize_agent_dict",
|
|
86
|
+
# Control (user implements)
|
|
87
|
+
"ControlPoint", "EventCallback", "EventType",
|
|
88
|
+
"NegotiationStrategy", "DefaultControlPoint",
|
|
89
|
+
# Registry (optional)
|
|
90
|
+
"RegistryClient", "load_psop", "search_psop",
|
|
91
|
+
# High-level runner
|
|
92
|
+
"execute_psop",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
__version__ = "0.0.2"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Copyright (c) 2026 Huawei Technologies Co., Ltd.
|
|
2
|
+
# All Rights Reserved.
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
# not use this file except in compliance with the License. You may obtain
|
|
8
|
+
# a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
14
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
15
|
+
# License for the specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
from workflow_engine.client.engine_client import WorkflowEngineClient
|
|
20
|
+
from workflow_engine.client.a2a_transport import A2ATransport
|
|
21
|
+
from workflow_engine.client.extension_sender import ExtensionSender
|
|
22
|
+
from workflow_engine.client.auth_manager import AuthManager
|
|
23
|
+
from workflow_engine.client.extension_handlers import (
|
|
24
|
+
ExtensionHandler, TaskTHandler, NegotiationTHandler, ExtensionRegistry,
|
|
25
|
+
)
|
|
26
|
+
from workflow_engine.client.ssl_context import create_ssl_context
|
|
27
|
+
from workflow_engine.client.credential_service import AgentCredentialService, AgentAuthManager, CustomAuthInterceptor
|
|
28
|
+
from workflow_engine.client.extensions import A2ATExtension
|
|
29
|
+
from workflow_engine.client.credential_crypto import encrypt, decrypt_if_needed
|
|
30
|
+
from workflow_engine.client.env_file_loader import load_to_environ
|
|
31
|
+
from workflow_engine.client.auth_provider import AuthProvider
|
|
32
|
+
from workflow_engine.client.auth_manager import AuthProviderInterceptor
|
|
33
|
+
from workflow_engine.client.extension_interceptor import ExtensionInterceptor
|
|
34
|
+
from workflow_engine.client.agentcard_normalizer import normalize_agent_dict
|
|
35
|
+
|
|
36
|
+
from workflow_engine.client.protocol_logger import log_request, log_response, log_response_event
|
|
37
|
+
from workflow_engine.client.stub_engine_client import StubWorkflowEngineClient
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"WorkflowEngineClient", "A2ATransport", "ExtensionSender", "AuthManager",
|
|
41
|
+
"ExtensionHandler", "TaskTHandler", "NegotiationTHandler", "ExtensionRegistry",
|
|
42
|
+
"create_ssl_context", "AgentCredentialService", "AgentAuthManager",
|
|
43
|
+
"CustomAuthInterceptor", "ExtensionInterceptor", "normalize_agent_dict",
|
|
44
|
+
"A2ATExtension", "encrypt", "decrypt_if_needed", "load_to_environ",
|
|
45
|
+
"AuthProvider", "AuthProviderInterceptor",
|
|
46
|
+
"log_request", "log_response", "log_response_event", "StubWorkflowEngineClient",
|
|
47
|
+
]
|