Skip to content

Fix(372) agent metadata model#373

Merged
sicoyle merged 36 commits intodapr:mainfrom
CasperGN:fix(372)--agent-metadata-model
Feb 26, 2026
Merged

Fix(372) agent metadata model#373
sicoyle merged 36 commits intodapr:mainfrom
CasperGN:fix(372)--agent-metadata-model

Conversation

@CasperGN
Copy link
Contributor

@CasperGN CasperGN commented Jan 15, 2026

Description

This PR includes generation of json schemas against the new AgentMetadataSchema model that defines the Agents Metadata model. This enables consumers (including platform providers) to easily fetch the valid schema for an agent with its current version.
The agent will use importlib's metadata package to derive the package version when distributed. This should ensure we don't need to keep a hardcoded version field to remember to update.

Edit: This PR requires dapr/python-sdk#899 to be merged as it now consumes the metadata and agent registration from the dapr.ext.agent_core package in the python sdk.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR closes: #372
Closes: #393

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

Note: We expect contributors to open a corresponding documentation PR in the dapr/docs repository. As the implementer, you are the best person to document your work! Implementation PRs will not be merged until the documentation PR is opened and ready for review.

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Copy link
Collaborator

@sicoyle sicoyle left a comment

Choose a reason for hiding this comment

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

overall really liking this addition, thank you!!

Comment on lines 73 to 81
# Generate schema for specific version
python scripts/generate_schema.py --version 1.0.0

# Generate for pre-release
python scripts/generate_schema.py --version 1.1.0-rc1

# Custom output directory
python scripts/generate_schema.py --version 1.0.0 --output ./custom-schemas
""",
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add in using the goldenfile package for in the event there are breaking changes and it will indicate as such easily for us in test?
https://github.com/oprypin/pytest-golden
https://ro-che.info/articles/2017-12-04-golden-tests

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
@sicoyle
Copy link
Collaborator

sicoyle commented Feb 4, 2026

bump @CasperGN to pls circle back here 🙏

@CasperGN
Copy link
Contributor Author

CasperGN commented Feb 5, 2026

@sicoyle this one waits for dapr/python-sdk#899

@CasperGN CasperGN marked this pull request as draft February 5, 2026 09:41
@CasperGN CasperGN marked this pull request as ready for review February 12, 2026 14:04
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
@CasperGN CasperGN requested a review from sicoyle February 23, 2026 20:52
@CasperGN
Copy link
Contributor Author

@sicoyle this is ready for review now

CasperGN and others added 3 commits February 23, 2026 16:34
…eys with a meta field

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the agent metadata model and registry behavior to support versioned metadata/schemas tied to the installed dapr-agents package version (via importlib.metadata), and adjusts tests/examples accordingly.

Changes:

  • Introduces a Pydantic-based AgentMetadataSchema model and exports it via public package APIs.
  • Updates agent registry persistence to a per-agent key plus a team index key, with ETag-protected index updates.
  • Adds a schema generation script and commits generated schema artifacts under schemas/agent-metadata/.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
dapr_agents/agents/configs.py Adds Pydantic models for agent metadata + schema export helper.
dapr_agents/agents/base.py Builds validated metadata schema at agent init and registers it.
dapr_agents/agents/components.py Changes registry storage format to per-agent key + index and bulk-fetches metadata.
dapr_agents/agents/orchestrators/base.py Adjusts orchestrator registration flow (currently broken due to new metadata requirement).
dapr_agents/agents/schemas.py Adds an import (currently unused).
dapr_agents/agents/standalone.py / dapr_agents/agents/durable.py Attempts deregistration on shutdown/stop.
scripts/generate_metadata_schema.py Adds CLI tool to generate versioned JSON schema files.
schemas/agent-metadata/* Adds committed schema artifacts (currently inconsistent with code model).
tests/agents/* Updates tests to use the new schema object and new registry storage format.
examples/*.yaml Trims whitespace-only lines.
dapr_agents/__init__.py / dapr_agents/agents/__init__.py Re-exports metadata models and adds __version__ from package metadata.
Comments suppressed due to low confidence (1)

dapr_agents/agents/components.py:650

  • exclude_orchestrator filtering is checking meta.get("orchestrator"), but the stored payload shape is {"agent": {"orchestrator": ...}} (per AgentMetadataSchema). As written, orchestrators will never be filtered out. Update the filter to read the orchestrator flag from the correct nested field (and consider backwards compatibility if older registry entries used a different shape).
            filtered = {
                name: meta
                for name, meta in agents_metadata.items()
                if not (exclude_self and name == self.name)
                and not (exclude_orchestrator and meta.get("orchestrator", False))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
…f schema missing, post comment if breaking change

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
@CasperGN CasperGN force-pushed the fix(372)--agent-metadata-model branch from c78322b to 059012c Compare February 25, 2026 16:48
Copy link
Collaborator

@sicoyle sicoyle left a comment

Choose a reason for hiding this comment

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

it's super close! 🌞 few comments for ya pls!

…nup, gen new schema & update tests to address comments

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
…so convert the schema check to pull_request_target to run in scope of base

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Copy link
Collaborator

@sicoyle sicoyle left a comment

Choose a reason for hiding this comment

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

thank you!!

@sicoyle sicoyle merged commit 7eb48f9 into dapr:main Feb 26, 2026
7 checks passed
@sicoyle sicoyle deleted the fix(372)--agent-metadata-model branch February 26, 2026 14:28
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.

Move Agent Registry to Python SDK [Agent Metadata] Ensure the metadata is versioned

3 participants