A2A artifact delivery interceptor exists but is never enabled by default
Summary
include_artifacts_in_a2a_event_interceptor was added in commit e63d991 to allow artifact delivery on the A2A path. However it is opt-in only — A2aAgentExecutorConfig.execute_interceptors defaults to None, and fast_api.py constructs A2aAgentExecutor with no config.
As a result, agents that save artifacts during a run (via artifact_service.save_artifact) have no way to deliver them to A2A callers without patching internal ADK code. Issue #3630 was closed as resolved but the fix is incomplete.
Reproduction
- Build an agent that calls
artifact_service.save_artifact()during a run - Call the agent via A2A
message/sendormessage/stream - Observe: no
TaskArtifactUpdateEventis emitted —event.actions.artifact_deltais silently dropped
Root cause
In fast_api.py:
agent_executor = A2aAgentExecutor(
runner=create_a2a_runner_loader(app_name),
# no config passed — execute_interceptors defaults to None
)
In config.py:
execute_interceptors: Optional[list[ExecuteInterceptor]] = None
# interceptor exists but never wired
Proposed fix
Default execute_interceptors to [include_artifacts_in_a2a_event_interceptor] in A2aAgentExecutorConfig:
from .interceptors.include_artifacts_in_a2a_event import include_artifacts_in_a2a_event_interceptor
execute_interceptors: list[ExecuteInterceptor] = dataclasses.field(
default_factory=lambda: [include_artifacts_in_a2a_event_interceptor]
)
This is a non-breaking change — the interceptor is a no-op when artifact_delta is empty or artifact_service is None. Users who want to opt out can pass execute_interceptors=[] explicitly.
Relates to
Closes #3630 (actually)
Hi! I'd like to work on this.
The fix looks straightforward — two small changes:
- In
A2aAgentExecutorConfig, defaultexecute_interceptorsto includeinclude_artifacts_in_a2a_event_interceptor:
from .interceptors.include_artifacts_in_a2a_event import include_artifacts_in_a2a_event_interceptor
execute_interceptors: list[ExecuteInterceptor] = dataclasses.field(
default_factory=lambda: [include_artifacts_in_a2a_event_interceptor]
)
- In
fast_api.py, pass a config toA2aAgentExecutor(or rely on the updated default).
As noted in the issue, this is a non-breaking change since the interceptor is a no-op when artifact_delta is empty or artifact_service is None. Users who want to opt out can still pass execute_interceptors=[] explicitly.
I'd add unit tests covering the artifact delivery path via A2A. Would a PR in this direction be welcome?
@Venseven As a workaround worth trying: default execute_interceptors in A2aAgentExecutorConfig using a lazy Field(default_factory=...) with a local import inside the factory to break the circular import between config.py and include_artifacts_in_a2a_event.py.
Could you verify if that resolves it on your end and run your artifact delivery tests against it before moving forward with the PR?
Closing this issue due to inactivity for more than 14 days.