finos / finos/fluxnova-plugins
Implement User Prompt Handling in Agentic Subprocess XML Parsing and Agent Initialization
- Dominant language
- Java
- Stars
- 3
- Forks
- 7
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 3
Description
### Description of Problem
Based on https://github.com/finos/fluxnova-plugins/issues/53
### Description
As the Fluxnova core engine, I need to support a configurable `userPrompt` in the agentic namespace during agent initialization, so that each agentic subprocess can be configured with a process-specific initial user message instead of using a hardcoded default.
Currently, agent initialization sends a hardcoded default empty user message. We need to:
1. Create support for reading the `userPrompt` attribute from the BPMN extension elements
2. Pass the configured `userPrompt` to the agent initialization logic
3. Handle edge cases (null, empty, special characters)
4. Support `${...}` expressions for instance-specific prompt values with fallback to default when empty
5. Maintain backwards compatibility for models without a configured `userPrompt`
### Acceptance Criteria
- The XML parser correctly reads the `userPrompt` attribute from the agentic namespace element
- The parsed `userPrompt` is passed to the agent initialization logic (alongside the existing `systemPrompt`)
- `${...}` expressions in the `userPrompt` are evaluated against the process instance variables at runtime
- `${...}` expressions in the `userPrompt` can be combined with normal strings.
- If `userPrompt` is null, empty, or evaluates to an empty string after expression substitution, the agent falls back to the current default
- Multi-line prompts (containing line breaks) are correctly parsed and preserved
- Special characters in the prompt are properly unescaped from XML and passed to the agent
- The engine gracefully handles BPMN models without a `userPrompt` attribute (uses default fallback)
- Existing unit tests continue to pass; new tests added for `userPrompt` parsing and initialization
### Potential Solutions
### Technical Notes
- Extend the existing agentic namespace schema to include the `userPrompt` element/attribute
- Ensure the XML attribute name and structure match the modeler implementation from JIRA Story 1
- The `userPrompt` should be created using the same underlying type as the system prompt
- Expression evaluation should follow the same pattern as other configurable fields in Fluxnova (e.g., variable substitution)
- Update any relevant documentation on the agentic namespace structure
### Definition of Done
- Unit tests cover:
- Parsing `userPrompt` from valid BPMN
- Handling null/empty `userPrompt`
- Evaluating `${...}` expressions in `userPrompt`
- Fallback to default when `userPrompt` is empty or evaluates to empty
- Handling multi-line prompts
- Handling special characters
- Backwards compatibility with models lacking `userPrompt`
- Documentation updated with new agentic namespace attribute and expression support examples
Contributor guide
Assessment
This issue has not been assessed yet.