Background
DatabaseTaskStore currently exposes useful advanced extension seams such as engine, initialize(), task_model, owner_resolver, and async_session_maker.
However, adapters that need to perform custom SQL persistence logic while still preserving the SDK's authoritative Task <-> ORM mapping currently have to call the private methods:
DatabaseTaskStore._to_orm(...)
DatabaseTaskStore._from_orm(...)
This works today, but it makes downstream integrations depend on private conversion helpers that may need rework on future SDK upgrades.
Why this matters
In some integrations, the need is not to replace the SDK's persistence policy, but to add a small amount of custom SQL behavior around it.
Examples include:
- conditional/atomic upsert logic
- adapter-side persistence guards
- custom conflict handling that still wants to reuse the SDK's conversion hooks
Without a public conversion seam, downstream code has two options:
- Call the private methods.
- Reimplement the SDK's conversion logic locally.
Option 2 is usually worse, because it duplicates:
core_to_model_conversion
model_to_core_conversion
- default protobuf JSON mapping
- any legacy compatibility conversion behavior
Proposal
Expose a small public conversion seam for DatabaseTaskStore, for example:
to_task_model(task: Task, owner: str) -> TaskModel
from_task_model(task_model: TaskModel) -> Task
The exact names are not important, but the public contract would let advanced adapters reuse the SDK's authoritative conversions without depending on underscored methods.
These public methods could internally keep using the existing conversion flow:
core_to_model_conversion
model_to_core_conversion
- the default built-in conversion behavior
Nice-to-have
If this direction makes sense, it may also be worth considering the same public conversion seam for DatabasePushNotificationConfigStore, which appears to have the same _to_orm() / _from_orm() pattern.
Non-goal
This is not a proposal to upstream adapter-specific task persistence policies or terminal-state guards. The request is only about making the conversion boundary explicit and public for advanced integrations.
Reference
Evaluated against local checkout:
a2aproject/a2a-python HEAD: 5f8fa229b376c09e754851683d12766b1abad314
Background
DatabaseTaskStorecurrently exposes useful advanced extension seams such asengine,initialize(),task_model,owner_resolver, andasync_session_maker.However, adapters that need to perform custom SQL persistence logic while still preserving the SDK's authoritative Task <-> ORM mapping currently have to call the private methods:
DatabaseTaskStore._to_orm(...)DatabaseTaskStore._from_orm(...)This works today, but it makes downstream integrations depend on private conversion helpers that may need rework on future SDK upgrades.
Why this matters
In some integrations, the need is not to replace the SDK's persistence policy, but to add a small amount of custom SQL behavior around it.
Examples include:
Without a public conversion seam, downstream code has two options:
Option 2 is usually worse, because it duplicates:
core_to_model_conversionmodel_to_core_conversionProposal
Expose a small public conversion seam for
DatabaseTaskStore, for example:to_task_model(task: Task, owner: str) -> TaskModelfrom_task_model(task_model: TaskModel) -> TaskThe exact names are not important, but the public contract would let advanced adapters reuse the SDK's authoritative conversions without depending on underscored methods.
These public methods could internally keep using the existing conversion flow:
core_to_model_conversionmodel_to_core_conversionNice-to-have
If this direction makes sense, it may also be worth considering the same public conversion seam for
DatabasePushNotificationConfigStore, which appears to have the same_to_orm()/_from_orm()pattern.Non-goal
This is not a proposal to upstream adapter-specific task persistence policies or terminal-state guards. The request is only about making the conversion boundary explicit and public for advanced integrations.
Reference
Evaluated against local checkout:
a2aproject/a2a-pythonHEAD:5f8fa229b376c09e754851683d12766b1abad314