-
Notifications
You must be signed in to change notification settings - Fork 423
feat: Enforce Task or Message as an initial response for Send Streaming Message
#964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9b6f0ee
fix: update `samples/cli.py`
sokoliva b23c112
fix readme
sokoliva 35310ac
enforce first streaming event to be Task
sokoliva 5d9ba84
update `cli.py`
sokoliva c4346ed
comment
sokoliva 49d2831
remove warnings import
sokoliva 4f1d78e
change launch.json
sokoliva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # A2A Python SDK — Samples | ||
|
|
||
| This directory contains runnable examples demonstrating how to build and interact with an A2A-compliant agent using the Python SDK. | ||
|
|
||
| ## Contents | ||
|
|
||
| | File | Role | Description | | ||
| |---|---|---| | ||
| | `hello_world_agent.py` | **Server** | A2A agent server | | ||
| | `cli.py` | **Client** | Interactive terminal client | | ||
|
|
||
| The samples are designed to work together out of the box: the agent listens on `http://127.0.0.1:41241`, which is the default URL used by the client. | ||
| --- | ||
|
|
||
| ## `hello_world_agent.py` — Agent Server | ||
|
|
||
| Implements an A2A agent that responds to simple greeting messages (e.g., "hello", "how are you", "bye") with text replies, simulating a 1-second processing delay. | ||
|
|
||
| Demonstrates: | ||
| - Subclassing `AgentExecutor` and implementing `execute()` / `cancel()` | ||
| - Publishing streaming status updates and artifacts via `TaskUpdater` | ||
| - Exposing all three transports in both protocol versions (v1.0 and v0.3 compat) simultaneously: | ||
| - **JSON-RPC** (v1.0 and v0.3) at `http://127.0.0.1:41241/a2a/jsonrpc` | ||
| - **HTTP+JSON (REST)** (v1.0 and v0.3) at `http://127.0.0.1:41241/a2a/rest` | ||
| - **gRPC v1.0** on port `50051` | ||
| - **gRPC v0.3 (compat)** on port `50052` | ||
| - Serving the agent card at `http://127.0.0.1:41241/.well-known/agent-card.json` | ||
|
|
||
| **Run:** | ||
|
|
||
| ```bash | ||
| uv run python samples/hello_world_agent.py | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## `cli.py` — Client | ||
|
|
||
| An interactive terminal client with full visibility into the streaming event flow. Each `TaskStatusUpdate` and `TaskArtifactUpdate` event is printed as it arrives. | ||
|
|
||
| Features: | ||
| - Transport selection via `--transport` flag (`JSONRPC`, `HTTP+JSON`, `GRPC`) | ||
| - Session management (`context_id` persisted across messages, `task_id` per task) | ||
| - Graceful error handling for HTTP and gRPC failures | ||
|
|
||
| **Run:** | ||
|
|
||
| ```bash | ||
| # Connect to the local hello_world_agent (default): | ||
| uv run python samples/cli.py | ||
|
|
||
| # Connect to a different URL, using gRPC: | ||
| uv run python samples/cli.py --url http://192.168.1.10:41241 --transport GRPC | ||
| ``` | ||
|
|
||
| Then type a message like `hello` and press Enter. | ||
|
|
||
| Type `/quit` or `/exit` to stop, or press `Ctrl+C`. | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.