> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-service-account.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Basic A2A Client

> Sends a message to the local A2A server and prints the JSON response.

```python client.py theme={null}
"""
Basic A2A Client
================

Sends a message to the local A2A server and prints the JSON response.
"""

from typing import Any
from uuid import uuid4

import httpx
from a2a.client import A2AClient
from a2a.types import (
    MessageSendParams,
    SendMessageRequest,
    SendStreamingMessageRequest,  # noqa: F401
)


# ---------------------------------------------------------------------------
# Create Client Request
# ---------------------------------------------------------------------------
async def main() -> None:
    async with httpx.AsyncClient() as httpx_client:
        client = await A2AClient.get_client_from_agent_card_url(
            httpx_client, "http://localhost:9999"
        )
        send_message_payload: dict[str, Any] = {
            "message": {
                "role": "user",
                "parts": [
                    {
                        "type": "text",
                        "text": "Hello! What can you tell me about the weather in Tokyo?",
                    }
                ],
                "messageId": uuid4().hex,
            },
        }
        request = SendMessageRequest(params=MessageSendParams(**send_message_payload))

        response = await client.send_message(request)
        print(response.model_dump(mode="json", exclude_none=True))

        # streaming_request = SendStreamingMessageRequest(
        #     params=MessageSendParams(**send_message_payload)
        # )

        # stream_response = client.send_message_streaming(streaming_request)
        # async for chunk in stream_response:
        #     print(chunk.model_dump(mode='json', exclude_none=True))


# ---------------------------------------------------------------------------
# Run Client
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    import asyncio

    asyncio.run(main())
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno a2a
    ```
  </Step>

  <Step title="Run the example">
    Save the code above as `client.py`, then run:

    ```bash theme={null}
    python client.py
    ```
  </Step>
</Steps>

Full source: [cookbook/05\_agent\_os/interfaces/a2a/basic\_agent/client.py](https://github.com/agno-agi/agno/blob/main/cookbook/05_agent_os/interfaces/a2a/basic_agent/client.py)
