This is an automated email from the ASF dual-hosted git repository. xtsong pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/flink-agents.git
commit 53050bfaace0d427c6be4d6cd9fb2e99a212d78c Author: WenjinXie <[email protected]> AuthorDate: Mon Jan 26 16:02:50 2026 +0800 [api] Align the AgentExecutionOptions between python and java. --- python/flink_agents/api/core_options.py | 8 ++++---- .../e2e_tests/e2e_tests_integration/react_agent_test.py | 13 ++++++++----- python/flink_agents/plan/actions/chat_model_action.py | 5 ++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/python/flink_agents/api/core_options.py b/python/flink_agents/api/core_options.py index 42343017..f904174a 100644 --- a/python/flink_agents/api/core_options.py +++ b/python/flink_agents/api/core_options.py @@ -90,6 +90,10 @@ class AgentConfigOptions(metaclass=AgentConfigOptionsMeta): default=None, ) + +class AgentExecutionOptions: + """Execution options for Flink Agents.""" + ERROR_HANDLING_STRATEGY = ConfigOption( key="error-handling-strategy", config_type=ErrorHandlingStrategy, @@ -102,10 +106,6 @@ class AgentConfigOptions(metaclass=AgentConfigOptionsMeta): default=3, ) - -class AgentExecutionOptions(metaclass=AgentConfigOptionsMeta): - """Execution options for Flink Agents.""" - CHAT_ASYNC = ConfigOption( key="chat.async", config_type=bool, diff --git a/python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_test.py b/python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_test.py index f2ca48ea..5e4880df 100644 --- a/python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_test.py +++ b/python/flink_agents/e2e_tests/e2e_tests_integration/react_agent_test.py @@ -31,7 +31,10 @@ from flink_agents.api.agents.react_agent import ( ReActAgent, ) from flink_agents.api.chat_message import ChatMessage, MessageRole -from flink_agents.api.core_options import AgentConfigOptions, ErrorHandlingStrategy +from flink_agents.api.core_options import ( + AgentExecutionOptions, + ErrorHandlingStrategy, +) from flink_agents.api.execution_environment import AgentsExecutionEnvironment from flink_agents.api.prompts.prompt import Prompt from flink_agents.api.resource import ( @@ -78,9 +81,9 @@ client = pull_model(OLLAMA_MODEL) def test_react_agent_on_local_runner() -> None: # noqa: D103 env = AgentsExecutionEnvironment.get_execution_environment() env.get_config().set( - AgentConfigOptions.ERROR_HANDLING_STRATEGY, ErrorHandlingStrategy.RETRY + AgentExecutionOptions.ERROR_HANDLING_STRATEGY, ErrorHandlingStrategy.RETRY ) - env.get_config().set(AgentConfigOptions.MAX_RETRIES, 3) + env.get_config().set(AgentExecutionOptions.MAX_RETRIES, 3) # register resource to execution environment ( @@ -156,10 +159,10 @@ def test_react_agent_on_remote_runner(tmp_path: Path) -> None: # noqa: D103 ) env.get_config().set( - AgentConfigOptions.ERROR_HANDLING_STRATEGY, ErrorHandlingStrategy.RETRY + AgentExecutionOptions.ERROR_HANDLING_STRATEGY, ErrorHandlingStrategy.RETRY ) - env.get_config().set(AgentConfigOptions.MAX_RETRIES, 3) + env.get_config().set(AgentExecutionOptions.MAX_RETRIES, 3) # register resource to execution environment ( diff --git a/python/flink_agents/plan/actions/chat_model_action.py b/python/flink_agents/plan/actions/chat_model_action.py index ffef800e..02e92ed8 100644 --- a/python/flink_agents/plan/actions/chat_model_action.py +++ b/python/flink_agents/plan/actions/chat_model_action.py @@ -30,7 +30,6 @@ from flink_agents.api.agents.react_agent import OutputSchema from flink_agents.api.chat_message import ChatMessage, MessageRole from flink_agents.api.chat_models.java_chat_model import JavaChatModelSetup from flink_agents.api.core_options import ( - AgentConfigOptions, AgentExecutionOptions, ErrorHandlingStrategy, ) @@ -184,10 +183,10 @@ async def chat( # see https://github.com/apache/flink-agents/issues/448 for details. chat_async = chat_async and not isinstance(chat_model, JavaChatModelSetup) - error_handling_strategy = ctx.config.get(AgentConfigOptions.ERROR_HANDLING_STRATEGY) + error_handling_strategy = ctx.config.get(AgentExecutionOptions.ERROR_HANDLING_STRATEGY) num_retries = 0 if error_handling_strategy == ErrorHandlingStrategy.RETRY: - num_retries = max(0, ctx.config.get(AgentConfigOptions.MAX_RETRIES)) + num_retries = max(0, ctx.config.get(AgentExecutionOptions.MAX_RETRIES)) response = None for attempt in range(num_retries + 1):
