Skip to content

Conversation

@Chibionos
Copy link
Contributor

Summary

  • Makes resources field optional in AgentDefinition by adding default_factory=list
  • Bumps version to 2.2.42

Problem

The resources field in AgentDefinition was defined as a required field without a default value:

resources: List[AgentResourceConfig]  # Required - no default

This caused validation errors when loading agent.json files that don't include a resources array:

pydantic_core._pydantic_core.ValidationError: 1 validation error for AgentDefinition
resources
  Field required [type=missing, loc: ('resources',), msg: Field required]
  For further information visit https://errors.pydantic.dev/2.12/v/missing

Root Cause

In commit 7016737 ("fix: agent resources discriminator"), the AgentDefinition model was refactored from separate LowCodeAgentDefinition and CodedAgentDefinition classes into a unified model. During this refactor, the resources field was made required without a default value.

Solution

Add default_factory=list to the resources field, matching the pattern already used by features:

# Before (required)
resources: List[AgentResourceConfig]

# After (optional with empty default)
resources: List[AgentResourceConfig] = Field(default_factory=list)

Impact

This fix restores backward compatibility for:

  • Older agent.json files created before resources were added
  • Coded agents that don't specify resources
  • Simple agent definitions without tools/context/escalation

Test plan

  • Verify existing tests pass
  • Verify agent.json files without resources field load successfully
  • Verify agent.json files with resources field still work correctly

🤖 Generated with Claude Code

The `resources` field in AgentDefinition was required without a default value,
causing validation errors when loading agent.json files that don't include
a resources array.

This broke backward compatibility for:
- Older agent.json files created before resources were required
- Coded agents that don't specify resources
- Simple agent definitions without tools/context/escalation

The fix adds `default_factory=list` to match the pattern used by `features`,
ensuring agents without explicit resources still validate successfully.

Error before fix:
```
pydantic_core._pydantic_core.ValidationError: 1 validation error for AgentDefinition
resources
  Field required [type=missing, loc: ('resources',), msg: Field required]
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions github-actions bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Dec 22, 2025
Copy link
Contributor

@radu-mocanu radu-mocanu left a comment

Choose a reason for hiding this comment

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

uv lock needs has to be regenerated for the lint step to pass

@smflorentino smflorentino self-requested a review December 22, 2025 21:51
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Chibionos Chibionos merged commit a2bf1cf into main Dec 23, 2025
80 checks passed
@Chibionos Chibionos deleted the fix/optional-resources-field branch December 23, 2025 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants