Skip to content

[Bug]: REST get_task does not send historyLength=0, causing full history to return #479

@TadakiAsechi

Description

@TadakiAsechi

What happened?

Environment

  • a2a-python: v0.3.7
  • Python: 3.13
  • Transport: REST (RestTransport)
  • Server: FastAPI + Uvicorn(A2A REST backend)

Expected behavior
history_length=0 should result in ?historyLength=0 being sent, yielding zero history items (or the field being omitted).

Actual behavior
No historyLength parameter is sent when 0 is provided, leading to full history being returned.

Steps to Reproduce

task = await client.get_task(TaskQueryParams(id=task_id, history_length=0))

It looks like request.history_length is evaluated directly here, so 0 is treated as falsy:

response_data = await self._send_get_request(
f'/v1/tasks/{request.id}',
{'historyLength': str(request.history_length)}
if request.history_length
else {},
modified_kwargs,
)

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions