slfan1989 opened a new issue, #1365: URL: https://github.com/apache/flink-agents/issues/1365
### Search before asking - [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar. ### Description When Java YAML loading fails on a shared resource name conflict, resources registered earlier from the same file remain in the environment. For example, if a tool named "demo" already exists, loading a YAML file with a new prompt "fresh" and another tool named "demo" fails with "TOOL demo already defined." However, "fresh" has already been registered. Correcting the tool name and retrying then fails with "PROMPT fresh already defined." Expected behavior: Check registration conflicts before modifying the environment, so the corrected file can be retried in the same environment. ### How to reproduce > existing.yaml ``` tools: - name: demo function: example:demo ``` > candidate.yaml ``` prompts: - name: fresh text: hello tools: - name: demo function: example:other ``` 1. Load existing.yaml into a Java AgentsExecutionEnvironment: ``` env.loadYaml(Path.of("existing.yaml")); ``` 2. Load candidate.yaml into the same environment: ``` env.loadYaml(Path.of("candidate.yaml")); ``` Loading fails with "TOOL demo already defined." 3. Inspect the environment's PROMPT resources. The prompt "fresh" is already present despite the failure. 4. Change the tool name in candidate.yaml from "demo" to "other" and retry loading it in the same environment. Loading now fails with "PROMPT fresh already defined." This behavior was reproduced through the YAML loading API without submitting a Flink job. ### Version and environment Flink Agents: version 1.0-SNAPSHOT Flink: 2.3.0 Java: OpenJDK 17 OS: macOS, ARM64 ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
