How to add User Data Functions to Fabric Data Agent ?

Karthikeyan V 0 Reputation points
2026-07-01T07:07:59.3766667+00:00

Hi,

We have been exploring the Fabric Data Agent and planned to integrate User Data Functions to evaluate how they can support our target use case. While attempting this, we created a Fabric Data Agent and tried to add User Data Functions. However, we encountered an error during the process. The User Data Functions were created using the default custom template provided by Fabric during function creation. Additionally, I have administrative access to the Fabric workspace.

User's image

Could you please help us understand the cause of this issue and guide us toward a resolution?

Microsoft Foundry
Microsoft Foundry

A unified Azure platform for creating and managing AI models, agents, and applications with built‑in enterprise security, monitoring, and governance


1 answer

Sort by: Most helpful
  1. AI answer

    2026-07-01T07:08:23.9766667+00:00

    The validation error indicates that the Fabric Data Agent cannot successfully validate the selected User Data Functions item or the functions inside it. Validation typically fails when the functions themselves are not correctly defined or published.

    Use the following checks and fixes directly in the User Data Functions item, then retry adding it to the Data Agent:

    1. Confirm required imports and context
      Open the User Data Functions item in the Fabric portal and verify that the code file contains both of these lines at the top:
         import fabric.functions as fn
         
         udf = fn.UserDataFunctions()
      
      These are required for the functions to work. If they are missing, add them and republish.
    2. Verify function decorators
      Each function that should be callable by other Fabric items (including Data Agents) must be decorated with @udf.function():
         @udf.function()
         def yourFunctionName(parameter: type) -> return_type:
             # logic
             return result
      
      If the functions use the default template but were modified, ensure the decorator is still present for every function that needs to be exposed.
    3. Check parameter naming rules
      Validation can fail if parameter names violate syntax rules. In the function signatures:
      • Use camelCase for parameter names (for example, productName, not product_name).
      • Ensure parameters and defaults follow the syntax requirements and limitations for User Data Functions.
    4. Validate default values and types
      Incorrect or unsupported default values can cause publish/validation failures:
      • Use JSON-serializable defaults (strings, booleans, integers, floats).
      • For date/time defaults, use ISO 8601 strings (for example, 2025-12-31T23:59:59Z).
      • Avoid mutable defaults for lists/dicts; use None in the signature and set the default inside the function body.
      • Do not use sets or tuples as default values.
    5. Confirm libraries and environment
      If the functions import additional libraries:
      • Ensure required libraries are added via Library Management for the User Data Functions item.
      • Verify library versions are compatible with Python 3.11.
    6. Ensure functions are published and visible
      In the User Data Functions editor:
      • Check the Functions explorer: functions that are ready to be invoked must appear there without the circle icon (circle indicates changes not yet published).
      • Select Publish and wait for completion. If publishing fails, fix the reported issues, then publish again.
    7. Re-add the User Data Functions to the Data Agent
      After the above fixes:
      • Return to the Fabric Data Agent configuration.
      • Remove the previous User Data Functions reference if present.
      • Add the User Data Functions item again and let the agent re-validate. With correctly defined and published functions, the validation step should succeed.

    If validation still fails after these checks, focus on any function that recently changed or was added, as a single invalid function in the item can cause the overall validation to fail.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.