-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add stdio transport binding #46
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
Open
Ketankhunti
wants to merge
17
commits into
a2aproject:main
Choose a base branch
from
Ketankhunti:feat/stdio-transport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4713797
a2a-stdio: scaffold crate with error types and STDIO transport constant
Ketankhunti 0bf6caa
a2a-stdio: implement LSP-style Content-Length framing module
Ketankhunti 5fef643
a2a-stdio: implement handshake types and negotiation logic
Ketankhunti 242c0d4
a2a-stdio: implement StdioTransport client with true async streaming
Ketankhunti d6197ef
feat(a2a-stdio): implement StdioServer with macro-based dispatch
Ketankhunti 1c3bd1a
test(a2a-stdio): add end-to-end integration tests
Ketankhunti 1a28864
style(a2a-stdio): fix clippy warnings
Ketankhunti d2df2dd
chore: update Cargo.lock for a2a-stdio crate
Ketankhunti 2ab6d45
fix(a2a-stdio): handle malformed JSON and stream results gracefully
Ketankhunti c74e09e
style(a2a-stdio): apply rustfmt formatting
Ketankhunti 20e7cf1
fix(a2a-stdio): address quick review items
Ketankhunti af03f94
fix(a2a-stdio): serialize requests and bound handshake/close waits
Ketankhunti 217cf5b
test(a2a-stdio): cover all Transport methods, factory, and error paths
Ketankhunti 52d8754
test(a2a-stdio): cover handshake error branches and server dispatch e…
Ketankhunti 0bd45f3
style(a2a-client): drop useless .into_iter() in rest error parsing
Ketankhunti 877e7fc
style(a2a-stdio): apply rustfmt to client and tests
Ketankhunti b3ca336
test(a2a-stdio): cover server::serve and streaming reader error paths
Ketankhunti 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,32 @@ | ||
| [package] | ||
| name = "agntcy-a2a-stdio" | ||
| version = "0.1.0" | ||
| description = "A2A v1 STDIO transport binding for client and server" | ||
| readme = "README.md" | ||
| edition.workspace = true | ||
| license.workspace = true | ||
| repository.workspace = true | ||
| rust-version.workspace = true | ||
|
|
||
| [lib] | ||
| name = "a2a_stdio" | ||
|
|
||
| # Test-only helper subprocess used by integration tests in tests/spawned.rs. | ||
| # Not part of the public surface; kept under tests/bin/ to make that explicit. | ||
| [[bin]] | ||
| name = "stdio_test_helper" | ||
| path = "tests/bin/stdio_test_helper.rs" | ||
|
|
||
| [dependencies] | ||
| a2a = { workspace = true } | ||
| a2a-client = { workspace = true } | ||
| a2a-server = { workspace = true } | ||
| tokio = { workspace = true } | ||
| tokio-stream = { workspace = true } | ||
| futures = { workspace = true } | ||
| async-trait = { workspace = true } | ||
| serde = { workspace = true } | ||
| serde_json = { workspace = true } | ||
| thiserror = { workspace = true } | ||
| tracing = { workspace = true } | ||
| uuid = { workspace = true } | ||
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,66 @@ | ||
| # a2a-stdio | ||
|
|
||
| STDIO transport binding for A2A v1 client and server implementations. | ||
|
|
||
| This crate is published as `agntcy-a2a-stdio` and imported in Rust as `a2a_stdio`. | ||
|
|
||
| ## What It Provides | ||
|
|
||
| - `StdioTransport` — `Transport` implementation that spawns an agent | ||
| subprocess and speaks A2A JSON-RPC over its stdin/stdout | ||
| - `StdioTransportFactory` — `TransportFactory` integration for agent cards | ||
| that advertise the `STDIO` protocol | ||
| - `StdioServer` — server-side dispatcher that wraps an | ||
| `a2a_server::RequestHandler` and serves requests over a pair of | ||
| asynchronous reader/writer streams | ||
|
|
||
| ## Wire Format | ||
|
|
||
| Messages on the wire use LSP-style framing followed by a JSON-RPC 2.0 body: | ||
|
|
||
| ```text | ||
| Content-Length: <N>\r\n | ||
| Content-Type: application/json\r\n | ||
| \r\n | ||
| <N bytes of JSON> | ||
| ``` | ||
|
|
||
| Method names use the slash-separated A2A convention | ||
| (`message/send`, `tasks/get`, `tasks/subscribe`, ...). | ||
|
|
||
| ## Handshake | ||
|
|
||
| Before serving requests, the server emits a `handshake` message advertising | ||
| its supported variants and features. The client replies with a | ||
| `handshakeAck` that either accepts (selecting a variant) or rejects the | ||
| session. | ||
|
|
||
| A session identifier may be passed via the `A2A_SESSION_ID` environment | ||
| variable; otherwise the server generates a UUIDv7. | ||
|
|
||
| ## Agent Card Target Format | ||
|
|
||
| `StdioTransportFactory` interprets `supportedInterfaces[].url` as one of: | ||
|
|
||
| - `stdio:///path/to/binary` — spawn the binary with no arguments | ||
| - `stdio:///path/to/binary?arg1&arg2` — spawn with the given arguments | ||
| - `/path/to/binary arg1 arg2` — plain command line, split on whitespace | ||
|
|
||
| Arguments in the `stdio://` form are split on `&` and the path is split on | ||
| the first `?`, so individual arguments cannot contain `&` or `?`. Use the | ||
| plain command-line form when those characters are required. | ||
|
|
||
| ## Install | ||
|
|
||
| ```toml | ||
| [dependencies] | ||
| a2a = { package = "a2a-lf", version = "0.2" } | ||
| a2a-stdio = { package = "agntcy-a2a-stdio", version = "0.1" } | ||
| ``` | ||
|
|
||
| ## Workspace | ||
|
|
||
| This crate is part of the `a2a-rs` workspace. | ||
|
|
||
| - Repository: https://github.com/a2aproject/a2a-rs | ||
| - Workspace README: https://github.com/a2aproject/a2a-rs/blob/main/README.md |
Oops, something went wrong.
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.