Skip to content

Conversation

@Leoyzen
Copy link
Contributor

@Leoyzen Leoyzen commented Jan 28, 2026

Summary

Resolves #12 - Enables support for YAML anchors and metadata fields in AgentsManifest configuration files.

Changes

New Features

  • Metadata Fields: Allows top-level fields with prefixes ., _, and x- for YAML anchors and custom metadata
  • Warning System: Unknown fields now trigger warnings instead of raising validation errors, improving user experience
  • YAML Anchors: Users can now define anchors (e.g., &default_settings) and reference them (e.g., *default_settings) to reduce configuration duplication

Implementation

  • Modified src/agentpool/models/manifest.py:
    • Changed extra="allow" in model_config to accept extra top-level fields
    • Added @model_validator(mode="after") to validate and warn about unknown fields
    • Preserved strict validation for nested models (agents, teams, etc.)
  • Added comprehensive test suite in tests/manifest/test_metadata_fields.py:
    • Tests for allowed metadata fields (.anchor, _meta, x-custom)
    • Tests for warning generation on unknown fields
    • Tests for mixed scenarios

Test Coverage

All tests passing (27/27):

  • ✅ New metadata field tests (3 tests)
  • ✅ Existing manifest tests (24 tests)
  • ✅ Regression test fixed for missing response references

Example Usage

# Define anchors for reuse
.shared_config: &default_settings
  type: native
  model: "openai:gpt-4o"
  system_prompt: "You are a helpful assistant"
# Custom metadata
x-version: "1.0.0"
_internal: "for internal use only"
responses:
  MyResponse:
    type: object
    fields:
      message: str
agents:
  coder: *default_settings
    name: coder
    tools:
      - read
      - write

Technical Details

  • Validation Logic: validate_extra_fields() method checks all extra top-level keys
  • Allowed Prefixes:
    • . (dot) - for YAML anchors and hidden fields
    • _ (underscore) - for internal/metadata fields
    • x- - for custom extensions (following OpenAPI convention)
  • Warning Behavior: Unknown fields log a WARNING with message: "Unknown field '{key}' in manifest. This field will be IGNORED."

Related Issue

Fixes #12

Leoyzen and others added 4 commits January 28, 2026 10:16
Add test suite for manifest metadata fields (YAML anchors and extensions).

RED PHASE: All tests fail because extra fields are currently forbidden.

Tests cover:
- Allowed metadata fields (.anchor, _meta, x-custom)
- Unknown fields (random_field)
- Mixed scenarios

After implementation in GREEN phase, these tests will pass.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Implement support for YAML anchors and metadata fields in AgentsManifest.

- Set extra='allow' in model_config to accept extra fields
- Add validate_extra_fields() model validator to warn about unknown fields
- Allowed prefixes: '.' (anchors), '_' (metadata), 'x-' (extensions)
- Unknown fields log WARNING but don't raise ValidationError
- Fix tests to check agent.model.identifier instead of agent.model

All tests pass (GREEN phase).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Change logger.warning from f-string to lazy % format (ruff G004)
- Add isinstance(agent.model, StringModelConfig) checks for mypy strict mode
- Add StringModelConfig import from llmling_models_config
- Remove debug_validation.py (debug file, not needed in repo)
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.

Support for YAML Anchors and Metadata Fields in Manifest

1 participant