Skip to content

feat: add prefilled_params support for function node#165

Merged
vishnurk6247 merged 5 commits intodevelopfrom
feat/function-node-prefill-params
Nov 20, 2025
Merged

feat: add prefilled_params support for function node#165
vishnurk6247 merged 5 commits intodevelopfrom
feat/function-node-prefill-params

Conversation

@vishnurk6247
Copy link
Member

@vishnurk6247 vishnurk6247 commented Nov 20, 2025

Summary by CodeRabbit

  • New Features

    • YAML-driven support for prefilled parameters on function nodes.
    • MessageMemoryItem exposed in the public API.
  • Chores

    • Standardized parameter name across APIs, examples, docs, and YAML: pre_filled_params → prefilled_params.
    • Updated examples, docs, and configuration samples.
    • Project version bumped to 1.1.0-rc2.
  • Tests

    • Added/updated tests covering YAML parsing and runtime handling of prefilled parameters.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Walkthrough

This PR standardizes the name prefilled_params across APIs, YAML, examples, and tests; adds prefilled_params support to FunctionNode and AriumBuilder flows; exports MessageMemoryItem; and bumps the project version to 1.1.0-rc2.

Changes

Cohort / File(s) Change Summary
Core tool config & partial tool
flo_ai/flo_ai/tool/tool_config.py, flo_ai/flo_ai/tool/partial_tool.py
Renamed pre_filled_paramsprefilled_params in constructors, attributes, factory helpers, and internal logic; updated accessors/mutators (get_prefilled_params, add_prefilled_param, remove_prefilled_param) and factory signatures.
Agent & YAML builders
flo_ai/flo_ai/builder/agent_builder.py, flo_ai/flo_ai/arium/builder.py
Updated AgentBuilder.add_tool signature to accept **prefilled_params; YAML parsing and builder logic now extract/pass prefilled_params when constructing ToolConfig and FunctionNode.
FunctionNode runtime behavior
flo_ai/flo_ai/arium/nodes.py
FunctionNode.__init__ gains optional prefilled_params attribute; both coroutine and sync execution paths merge prefilled_params into the function call.
Examples & docs
flo_ai/examples/partial_tool_example.py, flo_ai/examples/tools_quickstart.py, flo_ai/examples/yaml_tool_config_example.py, TOOLS.md
Updated examples, YAML snippets, and docs to use prefilled_params and the renamed accessors/mutators.
Public exports
flo_ai/flo_ai/__init__.py, flo_ai/flo_ai/arium/__init__.py
Added MessageMemoryItem to package and arium public exports (__all__).
Tests
flo_ai/tests/unit-tests/* (e.g., test_partial_tool.py, test_tool_config.py, test_agent_builder_tools.py, test_yaml_tool_config.py, test_arium_builder.py, test_arium_yaml.py)
Updated tests to prefilled_params naming; added tests asserting FunctionNode creation and YAML parsing preserve prefilled_params.
Version bump
flo_ai/pyproject.toml
Project version updated from 1.0.8-rc3 to 1.1.0-rc2.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller as Agent / Arium
  participant Builder as AriumBuilder / AgentBuilder
  participant FunctionNode
  participant Function as user_function()
  rect rgb(245,250,245)
    Note over Builder,FunctionNode: YAML/builder extracts `prefilled_params` and constructs node/tool
  end
  Caller->>Builder: add_function_node(name, function, prefilled_params)
  Builder->>FunctionNode: new FunctionNode(..., prefilled_params)
  Caller->>FunctionNode: invoke(runtime_inputs, **call_kwargs)
  Note right of FunctionNode: merge runtime inputs with prefilled_params before call
  FunctionNode->>Function: call(**runtime_inputs, **prefilled_params, **call_kwargs)
  Function-->>FunctionNode: result
  FunctionNode-->>Caller: result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Check for any remaining pre_filled_params occurrences in code, docs, tests, and YAML fixtures.
  • Verify FunctionNode merges preserve call ordering and that coroutine vs sync paths behave identically.
  • Confirm tests cover typed YAML values (e.g., integers) and validate the newly exported MessageMemoryItem.

Poem

🐰 I hopped through names and smoothed the seams,

prefilled_params now whispered in the streams.
Nodes and tools now know their treats,
MessageMemoryItem peeks from its seats.
Version bumped — the rabbit drums gentle beats.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding prefilled_params support to function nodes. However, the changeset also includes a broader refactoring that renames pre_filled_params to prefilled_params across multiple modules (tool config, partial tool, agent builder, YAML configs, examples, and tests), which is a more significant change than what the title conveys.
Docstring Coverage ✅ Passed Docstring coverage is 89.47% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/function-node-prefill-params

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
flo_ai/flo_ai/arium/nodes.py (1)

198-201: Critical: NameError due to undefined variable reference.

Line 198 references result before it's defined, which will cause a NameError when the function is not a coroutine function. The check at line 191 returns early at line 196, so if we reach line 198, result hasn't been defined yet.

The intended logic appears to be checking if a regular function returns a coroutine, but this check should occur after calling the function (after lines 204-206).

Apply this diff to fix the logic:

         if asyncio.iscoroutinefunction(self.function):
             logger.info(f"Executing FunctionNode '{self.name}' as a coroutine function")
             result = await self.function(
                 inputs=inputs, variables=variables, **self.prefilled_params, **kwargs
             )
             return UserMessage(content=result)
 
-        if asyncio.iscoroutine(result):
-            logger.info(f"Executing FunctionNode '{self.name}' as a coroutine")
-            content = await result
-            return UserMessage(content=content)
-
         logger.info(f"Executing FunctionNode '{self.name}' as a regular function")
         result = self.function(
             inputs=inputs, variables=variables, **self.prefilled_params, **kwargs
         )
+        
+        if asyncio.iscoroutine(result):
+            logger.info(f"Executing FunctionNode '{self.name}' as a coroutine")
+            content = await result
+            return UserMessage(content=content)
+        
         return UserMessage(content=result)
🧹 Nitpick comments (1)
flo_ai/flo_ai/tool/partial_tool.py (1)

71-80: Consider renaming methods for consistency.

The methods add_pre_filled_param and remove_pre_filled_param still use the old pre_filled naming convention, while the rest of the API has been updated to prefilled_params. For consistency, consider renaming these to add_prefilled_param and remove_prefilled_param to align with the updated naming scheme.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff018b9 and 57d61f9.

📒 Files selected for processing (18)
  • TOOLS.md (15 hunks)
  • flo_ai/examples/partial_tool_example.py (4 hunks)
  • flo_ai/examples/tools_quickstart.py (3 hunks)
  • flo_ai/examples/yaml_tool_config_example.py (5 hunks)
  • flo_ai/flo_ai/__init__.py (2 hunks)
  • flo_ai/flo_ai/arium/__init__.py (2 hunks)
  • flo_ai/flo_ai/arium/builder.py (3 hunks)
  • flo_ai/flo_ai/arium/nodes.py (3 hunks)
  • flo_ai/flo_ai/builder/agent_builder.py (6 hunks)
  • flo_ai/flo_ai/tool/partial_tool.py (5 hunks)
  • flo_ai/flo_ai/tool/tool_config.py (4 hunks)
  • flo_ai/pyproject.toml (1 hunks)
  • flo_ai/tests/unit-tests/test_agent_builder_tools.py (3 hunks)
  • flo_ai/tests/unit-tests/test_arium_builder.py (1 hunks)
  • flo_ai/tests/unit-tests/test_arium_yaml.py (1 hunks)
  • flo_ai/tests/unit-tests/test_partial_tool.py (8 hunks)
  • flo_ai/tests/unit-tests/test_tool_config.py (4 hunks)
  • flo_ai/tests/unit-tests/test_yaml_tool_config.py (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (7)
flo_ai/examples/tools_quickstart.py (1)
flo_ai/flo_ai/tool/partial_tool.py (2)
  • get_prefilled_params (67-69)
  • remove_pre_filled_param (76-80)
flo_ai/tests/unit-tests/test_partial_tool.py (1)
flo_ai/flo_ai/tool/partial_tool.py (3)
  • get_prefilled_params (67-69)
  • add_pre_filled_param (71-74)
  • remove_pre_filled_param (76-80)
flo_ai/flo_ai/arium/__init__.py (1)
flo_ai/flo_ai/arium/memory.py (3)
  • MessageMemory (134-154)
  • BaseMemory (107-131)
  • MessageMemoryItem (22-35)
flo_ai/tests/unit-tests/test_arium_builder.py (2)
flo_ai/flo_ai/arium/builder.py (2)
  • AriumBuilder (16-970)
  • add_function_node (62-65)
flo_ai/flo_ai/arium/nodes.py (1)
  • FunctionNode (160-207)
flo_ai/flo_ai/__init__.py (2)
flo_ai/flo_ai/arium/memory.py (1)
  • MessageMemoryItem (22-35)
flo_ai/flo_ai/arium/builder.py (1)
  • create_arium (974-976)
flo_ai/examples/partial_tool_example.py (1)
flo_ai/flo_ai/tool/partial_tool.py (2)
  • get_prefilled_params (67-69)
  • remove_pre_filled_param (76-80)
flo_ai/flo_ai/builder/agent_builder.py (1)
flo_ai/flo_ai/tool/tool_config.py (2)
  • ToolConfig (5-56)
  • create_tool_config (59-70)
🔇 Additional comments (24)
flo_ai/pyproject.toml (1)

3-3: Verify the release candidate version number.

The version bumps from 1.0.8-rc3 to 1.1.0-rc2, which means the RC number decreased. Typically, release candidate numbers increment sequentially (rc1 → rc2 → rc3). Confirm whether 1.1.0-rc2 is correct or if it should be 1.1.0-rc1 (first RC of the new minor version) or a higher number if prior RCs exist.

flo_ai/tests/unit-tests/test_agent_builder_tools.py (1)

50-50: LGTM!

Test updates correctly reflect the API rename from pre_filled_params to prefilled_params.

Also applies to: 65-68, 84-84, 89-89

flo_ai/flo_ai/arium/__init__.py (1)

4-4: LGTM!

Adding MessageMemoryItem to the public API expands the API surface appropriately without breaking existing functionality.

Also applies to: 23-23

flo_ai/flo_ai/__init__.py (1)

45-45: LGTM!

Exposing MessageMemoryItem at the top-level package API is appropriate. The repositioning of create_arium in the import block is a minor organizational change with no functional impact.

Also applies to: 47-47, 103-103

flo_ai/tests/unit-tests/test_tool_config.py (1)

33-33: LGTM!

Test updates correctly reflect the API rename from pre_filled_params to prefilled_params in ToolConfig.

Also applies to: 39-39, 58-58, 89-89, 122-125

flo_ai/tests/unit-tests/test_yaml_tool_config.py (1)

80-82: LGTM!

YAML configuration key correctly updated from pre_filled_params to prefilled_params, and tests verify the parsing logic handles the new key name.

Also applies to: 120-122, 173-174, 266-266

flo_ai/tests/unit-tests/test_arium_yaml.py (1)

210-275: LGTM!

The new test method comprehensively validates that prefilled_params are correctly parsed from YAML configuration and properly stored in FunctionNode instances. The test covers multiple data types (strings and integers) and verifies the complete flow from YAML parsing to node construction.

flo_ai/tests/unit-tests/test_arium_builder.py (1)

74-99: LGTM! Well-structured test for prefilled_params functionality.

The test properly validates that:

  • FunctionNode accepts prefilled_params
  • The node is correctly added to the builder
  • Parameter values are preserved and accessible
flo_ai/examples/tools_quickstart.py (2)

128-131: LGTM! Accessor method usage is correct.

The code properly uses get_prefilled_params() to display pre-filled parameters that are hidden from the AI.


160-171: LGTM! YAML configuration properly uses prefilled_params.

The YAML examples correctly demonstrate the renamed prefilled_params key for tool configuration.

flo_ai/examples/yaml_tool_config_example.py (1)

118-138: LGTM! Consistent usage of renamed prefilled_params.

All YAML configurations and ToolConfig usage properly reference the renamed prefilled_params parameter and attribute.

Also applies to: 160-175, 201-212, 241-252

flo_ai/examples/partial_tool_example.py (1)

122-131: LGTM! Examples properly demonstrate the renamed API.

All references to prefilled_params and get_prefilled_params() are consistent with the updated API.

Also applies to: 175-179, 194-194

flo_ai/flo_ai/arium/nodes.py (2)

167-179: LGTM! FunctionNode correctly accepts and stores prefilled_params.

The constructor properly accepts prefilled_params as an optional parameter and stores it with a sensible default of an empty dict.


193-195: LGTM! Prefilled params correctly merged with runtime kwargs.

The function calls properly spread **self.prefilled_params before **kwargs, ensuring that runtime parameters can override prefilled values as expected.

Also applies to: 204-206

flo_ai/tests/unit-tests/test_partial_tool.py (1)

40-50: LGTM! Tests properly updated for renamed API.

All test cases correctly use:

  • prefilled_params parameter in PartialTool constructor
  • get_prefilled_params() accessor method
  • Proper validation of prefilled parameter behavior

Also applies to: 72-78, 109-119, 144-157, 172-189, 217-220, 237-245, 281-293

flo_ai/flo_ai/arium/builder.py (1)

534-552: LGTM! YAML parsing correctly wires prefilled_params to FunctionNode.

The builder properly:

  • Extracts prefilled_params from YAML configuration (line 534)
  • Extracts optional description and input_filter fields (lines 535-536)
  • Passes all parameters to FunctionNode constructor (lines 546-552)
flo_ai/flo_ai/builder/agent_builder.py (2)

54-111: LGTM! AgentBuilder API correctly updated for prefilled_params.

The changes properly:

  • Update documentation to reference prefilled_params (lines 64, 74-75, 80-81, 119)
  • Extract and pass prefilled_params in tool processing (lines 96, 102)
  • Update add_tool method signature to accept **prefilled_params (line 113)
  • Consistently use the renamed parameter throughout

Also applies to: 113-133


302-323: LGTM! YAML tool processing correctly uses prefilled_params.

The YAML parsing logic properly extracts prefilled_params from tool configurations and passes them to ToolConfig, maintaining consistency with the renamed API.

TOOLS.md (3)

136-411: LGTM! Documentation updated consistently.

The documentation has been systematically updated to reflect the parameter rename from pre_filled_params to prefilled_params across all examples (dictionary format, ToolConfig usage, YAML configurations). The changes are comprehensive and maintain consistency throughout.


460-496: LGTM! API reference updated correctly.

The API reference section has been properly updated with the new prefilled_params parameter naming for ToolConfig, PartialTool constructors, and the AgentBuilder.add_tool method.


578-578: LGTM! Debug tip updated correctly.

The debug tip has been updated to use the new get_prefilled_params() method name.

flo_ai/flo_ai/tool/tool_config.py (3)

12-31: LGTM! Constructor updated consistently.

The __init__ method has been properly updated with the new prefilled_params parameter name, including the parameter signature, docstring, and internal attribute assignment. The changes maintain backward compatibility in functionality while updating the API surface.


33-56: LGTM! Methods updated consistently.

The is_partial() and to_tool() methods have been correctly updated to reference self.prefilled_params, and the PartialTool instantiation uses the new parameter name. The logic remains functionally equivalent.


59-70: LGTM! Helper function updated correctly.

The create_tool_config() function has been properly updated with the new prefilled_params parameter name in the signature, docstring, and return statement. The changes are consistent and maintain the function's behavior.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 171ec6c and d97546b.

📒 Files selected for processing (1)
  • flo_ai/flo_ai/arium/nodes.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
flo_ai/flo_ai/arium/nodes.py (1)
flo_ai/flo_ai/models/chat_message.py (1)
  • UserMessage (65-70)
🔇 Additional comments (3)
flo_ai/flo_ai/arium/nodes.py (3)

172-173: LGTM!

The parameter signature is correct, with appropriate type annotation and default value.


178-178: LGTM!

Proper handling of the None default by converting it to an empty dictionary.


193-195: LGTM!

The parameter spreading order is correct: prefilled_params are spread first, followed by kwargs, allowing runtime parameters to override prefilled ones as expected.

vishnurk6247 and others added 2 commits November 20, 2025 18:55
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
flo_ai/flo_ai/arium/nodes.py (2)

167-179: prefilled_params wiring and defaulting look good; consider copying for isolation

Using prefilled_params or {} is correct and makes the **self.prefilled_params expansions safe even when None is passed. To avoid surprising mutations from outside code holding the original dict, you might optionally copy here:

-        self.prefilled_params = prefilled_params or {}
+        self.prefilled_params = dict(prefilled_params) if prefilled_params else {}

191-201: prefilled_params now consistently applied in both async and sync paths; consider guarding reserved keys

Passing **self.prefilled_params, **kwargs into both the coroutine and regular function paths cleanly fixes the earlier inconsistency and lets runtime kwargs override prefilled ones, which is a good default.

One small edge case: if prefilled_params ever includes inputs or variables, the call could raise a confusing "multiple values for keyword argument" error. You may want to either document that these keys are reserved, or add a lightweight check/validation when constructing FunctionNode (or when loading from config) to prevent such overlaps.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 947e456 and 4b41f9b.

📒 Files selected for processing (1)
  • flo_ai/flo_ai/arium/nodes.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
flo_ai/flo_ai/arium/nodes.py (1)
flo_ai/flo_ai/models/chat_message.py (1)
  • UserMessage (65-70)

@vishnurk6247 vishnurk6247 merged commit 5b0bbc3 into develop Nov 20, 2025
6 checks passed
@vishnurk6247 vishnurk6247 deleted the feat/function-node-prefill-params branch November 20, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants