Skip to content

fix: make MemoryConfig.field_weights optional#810

Open
mjnovice wants to merge 1 commit intomainfrom
fix/memory-config-optional-weights
Open

fix: make MemoryConfig.field_weights optional#810
mjnovice wants to merge 1 commit intomainfrom
fix/memory-config-optional-weights

Conversation

@mjnovice
Copy link
Copy Markdown
Contributor

Summary

  • Make field_weights optional (dict[str, float] | None, default None) instead of required with a strict validator
  • Remove the _validate_field_weights model validator that raised ValueError for empty dicts

Why

When no fieldSettings are configured in the agent definition's dynamicFewShotSettings, the runtime passes field_weights={} which fails validation. In practice, memory spaces may not have field weights configured — in that case, all input fields should be searched with default weights.

This was causing AGENT_STARTUP.UNEXPECTED_ERROR in production:

1 validation error for MemoryConfig
  Value error, field_weights must contain at least one field

Test plan

  • Agents with no fieldSettings configured can start without error
  • Agents with fieldSettings still work as before (weights are passed through)

🤖 Generated with Claude Code

When no fieldSettings are configured in the agent definition,
field_weights should be None (search all fields with default weights)
rather than raising a validation error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant