feat(core): expand interactive card schemas - #908
Open
tejus3131 wants to merge 2 commits into
Open
Conversation
Align card payload validation with predefined + element-tree specs: DisplayImage, VideoNode, LabelWithIcon, extended input kinds, richer ButtonAction/ButtonNode, carousel detail/form/review field additions.
tejus3131
requested review from
Alejandro-Morales,
Archento,
jrriehl,
lrahmani and
qati
as code owners
June 26, 2026 11:18
There was a problem hiding this comment.
Pull request overview
This PR expands the Pydantic validation models for interactive chat cards in uagents_core.contrib.protocols.chat.cards to align payload validation with the Agentverse interactive card specification, while keeping the metadata wire format at protocol version "1".
Changes:
- Added shared schema primitives and validators (e.g.,
DisplayImage, stricterCtaAction, HTTP URL +aspect_ratiovalidation). - Expanded predefined card payload schemas (carousel/detail/form) and tightened validation rules for media and input field kinds.
- Extended custom element-tree support (e.g.,
VideoNode, richerButtonAction, unifiedInputNodevalidation viaInputFieldBase).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Expands
uagents_core.contrib.protocols.chat.cardspayload validation to match predefined card schemas + element-tree primitives (parity w/ Agentverse card spec).Predefined cards
style,root_cta,logo;imageaccepts URL |DisplayImage| listExpandedChoiceon sub-option choices;hero_imagerich media; URL validationcancel_cta;FormFieldsharesInputFieldBasew/ custom-treeinputCtaActionvalidationShared
DisplayImage(src,alt,aspect_ratio)CtaAction: non-emptyselectionrequiredaspect_ratio(W:H) validation on media fieldsCustom element tree (
card_kind: "custom")VideoNodeButtonNode: optionallabel(str |LabelWithIcon) orimage; ≥1 requiredButtonAction:selection|redirect,bypass_required_validationInputNode: full input kinds (date,time,multiselect,phone, etc.) + kind-specific validationChoiceGridChoice.image: URL |DisplayImageGroupNode.gap:>= 1when setMAX_ELEMENT_TREE_DEPTH = 8)Metadata helpers (
create_card_content,extract_card, etc.) unchanged — wire format still v1.Follow-up to #897; single-file change in
cards/__init__.py.Linked Issues
Closes #907
Types of changes
Checklist
If applicable
python/scripts/generate_api_docs.py)Further comments
Validation tightened per spec (non-empty CTA selections, HTTP URLs, input kind rules). Valid payloads from #897 should still pass; loose/invalid payloads may now fail — intentional.