[Bug]: Documentation mismatch: A2AStarletteApplication uses `http_handler` not `request_handler`
trunksio opened this issue · 1 comments
What happened?
Title
Documentation mismatch: A2AStarletteApplication uses http_handler not request_handler
Description
Summary
The documentation and examples show using request_handler as a parameter when creating an A2AStarletteApplication, but the actual implementation expects http_handler.
Environment
- a2a-sdk version: 0.3.0
- Python version: 3.12
- OS: Linux
Steps to Reproduce
- Follow the documentation example:
from a2a.server.apps import A2AStarletteApplication
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.tasks import InMemoryTaskStore
# Create components
task_store = InMemoryTaskStore()
request_handler = DefaultRequestHandler(
agent_executor=agent_executor,
task_store=task_store
)
# This fails
app = A2AStarletteApplication(
agent_card=agent_card,
request_handler=request_handler # <-- Documentation shows this
)- Error received:
TypeError: JSONRPCApplication.__init__() got an unexpected keyword argument 'request_handler'
Expected Behavior
The code should work as documented.
Actual Behavior
The constructor expects http_handler instead of request_handler.
Investigation
Using inspect.signature() on the constructor reveals:
A2AStarletteApplication(
agent_card: AgentCard,
http_handler: RequestHandler, # <-- Actual parameter name
extended_agent_card: AgentCard | None = None,
context_builder: CallContextBuilder | None = None,
card_modifier: Callable[[AgentCard], AgentCard] | None = None,
extended_card_modifier: Callable[[AgentCard, ServerCallContext], AgentCard] | None = None
)Workaround
Use http_handler instead of request_handler:
app = A2AStarletteApplication(
agent_card=agent_card,
http_handler=request_handler # <-- Works
)Suggested Fix
Either:
- Update the documentation and examples to use
http_handler - Update the code to accept
request_handler(with deprecation warning forhttp_handler) - Accept both parameter names for backward compatibility
Additional Context
This affects anyone following the official documentation or examples, particularly in:
- The a2a-samples repository
- Any tutorials or blog posts based on the documentation
- The helloworld example
The parameter naming inconsistency makes it difficult for developers to get started with the SDK.
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Hi trunksio,
Thanks for reporting the issue!
Could you provide a link to the documentation that you're referencing here? I can see that the helloword sample that is used in the A2A's tutorial docs already uses http_handler=request_handler.
Thanks,
Lukasz