René's URL Explorer Experiment


Title: feat: improve schema usability type instantiation · Issue #47 · agentclientprotocol/python-sdk · GitHub

Open Graph Title: feat: improve schema usability type instantiation · Issue #47 · agentclientprotocol/python-sdk

X Title: feat: improve schema usability type instantiation · Issue #47 · agentclientprotocol/python-sdk

Description: Problem statement I'm just diving into using this SDK to add a compatibility layer to an agent service for ACP clients, and encountered a few initial difficulties with regards to the schema that felt could be improved. First is that when...

Open Graph Description: Problem statement I'm just diving into using this SDK to add a compatibility layer to an agent service for ACP clients, and encountered a few initial difficulties with regards to the schema that fe...

X Description: Problem statement I'm just diving into using this SDK to add a compatibility layer to an agent service for ACP clients, and encountered a few initial difficulties with regards to the schema tha...

Opengraph URL: https://github.com/agentclientprotocol/python-sdk/issues/47

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: improve schema usability type instantiation","articleBody":"### Problem statement\n\nI'm just diving into using this SDK to add a compatibility layer to an agent service for ACP clients, and encountered a few initial difficulties with regards to the schema that felt could be improved.\n\nFirst is that when instantiating classes that have a required field and only one possible value, that field shouldn't need to be provided, it should default. For example, when I construct `AgentMessageChunk`, the `session_update` field only has one possible value, `\"agent_message_chunk\"`. It's a required field, and it cannot be anything else. So why do I have to provide it? I understand that it's used as the discriminator when deserializing, but when `AgentMessageChunk` is constructed explicitly, it shouldn't be needed. This is a common pattern, not exclusive to `AgentMessageChunk`.\n\nHowever if these fields are given a default such as:\n```\nclass AgentMessageChunk(ContentChunk):\n    session_update: Annotated[Literal[\"agent_message_chunk\"], Field(alias=\"sessionUpdate\")] = \"agent_message_chunk\"\n```\nThis then leads to another issue, in that when the SDK serializes the message, it's omitted because of `exclude_defaults=True` in https://github.com/agentclientprotocol/python-sdk/blob/a09e090cf3db70491abacb126d016187552796e1/src/acp/utils.py#L33\n\nNow after going through the examples, I noticed that you provide helpers such as `update_agent_message` for addressing this. But IMHO these should not be necessary. When I look at a function or class, and I see that it accepts some type, I shouldn't have to go hunting through the source code to see if there's a helper that is supposed to be used for construction of that type. And while I would argue that the type shouldn't need a helper at all, and that types should be simple to instantiate directly, if there is going to be a helper, I think it would be better for discoverability to put the helper as a static/class method on the class itself. Then if you want to expose all the helpers in some top level package for ease of import, you would declare local variables which reference the static method.\n\n### Proposed solution\n\n* Change all types that have a required parameter with only a single possible value to default to that value.\n* Change `params.model_dump` to use `exclude_defaults=False`.\n    * A little more work, but if you still want to use `exclude_defaults`, then implement a custom serializer that does exclude defaults, but only when the field is optional.\n* Remove the helpers.\n\n\n### Alternatives considered\n\nMake the helpers easier to discover by putting them as static methods on the class they construct.\n\n### Additional context\n\n_No response_\n\n### Can you help build it?\n\n- [ ] I can contribute code or docs for this request.","author":{"url":"https://github.com/phemmer","@type":"Person","name":"phemmer"},"datePublished":"2025-12-14T19:37:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/47/python-sdk/issues/47"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fcb96b78-1e32-ea9e-4833-4c4e4662ffe1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8872:268A9:90DD7F:BA1E82:697FE5A1
html-safe-nonce9e8dfde7c3ffc4d5a87fc69c8ab29154a054b589b51255df27eee0da623436f7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODcyOjI2OEE5OjkwREQ3RjpCQTFFODI6Njk3RkU1QTEiLCJ2aXNpdG9yX2lkIjoiODMwNjk4Nzg0NzczMTExMTMyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac8890e332c512b964cf724e35712eeacb616a23f9aa0acd5dbeb76c07f4fe0f1f
hovercard-subject-tagissue:3727894639
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/agentclientprotocol/python-sdk/47/issue_layout
twitter:imagehttps://opengraph.githubassets.com/38ae7cfe6d9958de82b1074f05781c3b06f6019ff1a3f3014b14fb9abe5e74f6/agentclientprotocol/python-sdk/issues/47
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/38ae7cfe6d9958de82b1074f05781c3b06f6019ff1a3f3014b14fb9abe5e74f6/agentclientprotocol/python-sdk/issues/47
og:image:altProblem statement I'm just diving into using this SDK to add a compatibility layer to an agent service for ACP clients, and encountered a few initial difficulties with regards to the schema that fe...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamephemmer
hostnamegithub.com
expected-hostnamegithub.com
None60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6
turbo-cache-controlno-preview
go-importgithub.com/agentclientprotocol/python-sdk git https://github.com/agentclientprotocol/python-sdk.git
octolytics-dimension-user_id235308037
octolytics-dimension-user_loginagentclientprotocol
octolytics-dimension-repository_id1051445009
octolytics-dimension-repository_nwoagentclientprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1051445009
octolytics-dimension-repository_network_root_nwoagentclientprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7c85641c598ad130c74f7bcc27f58575cac69551
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/issues/47#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fagentclientprotocol%2Fpython-sdk%2Fissues%2F47
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fagentclientprotocol%2Fpython-sdk%2Fissues%2F47
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=agentclientprotocol%2Fpython-sdk
Reloadhttps://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/issues/47
Reloadhttps://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/issues/47
Reloadhttps://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/issues/47
agentclientprotocol https://patch-diff.githubusercontent.com/agentclientprotocol
python-sdkhttps://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fagentclientprotocol%2Fpython-sdk
Fork 12 https://patch-diff.githubusercontent.com/login?return_to=%2Fagentclientprotocol%2Fpython-sdk
Star 143 https://patch-diff.githubusercontent.com/login?return_to=%2Fagentclientprotocol%2Fpython-sdk
Code https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk
Issues 2 https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/issues
Pull requests 1 https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/pulls
Discussions https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/discussions
Actions https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/actions
Projects 0 https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/projects
Security 0 https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/security
Insights https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/pulse
Code https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk
Issues https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/issues
Pull requests https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/pulls
Discussions https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/discussions
Actions https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/actions
Projects https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/projects
Security https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/security
Insights https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/agentclientprotocol/python-sdk/issues/47
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/agentclientprotocol/python-sdk/issues/47
feat: improve schema usability type instantiationhttps://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/issues/47#top
enhancementNew feature or requesthttps://github.com/agentclientprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/phemmer
https://github.com/phemmer
phemmerhttps://github.com/phemmer
on Dec 14, 2025https://github.com/agentclientprotocol/python-sdk/issues/47#issue-3727894639
python-sdk/src/acp/utils.pyhttps://github.com/agentclientprotocol/python-sdk/blob/a09e090cf3db70491abacb126d016187552796e1/src/acp/utils.py#L33
a09e090https://patch-diff.githubusercontent.com/agentclientprotocol/python-sdk/commit/a09e090cf3db70491abacb126d016187552796e1
enhancementNew feature or requesthttps://github.com/agentclientprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.