-
Notifications
You must be signed in to change notification settings - Fork 29
docs: Add README and more details package doc #72
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
Merged
+806
−249
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0fc76ab
helloworld example
yarolegovich 746e65a
readme doc
yarolegovich ee663f7
licenses
yarolegovich 6f6f210
Merge branch 'main' into yarolegovich/readme-doc
yarolegovich 1a8fc3d
update
yarolegovich ebf505b
Merge branch 'main' into yarolegovich/readme-doc
yarolegovich be1aceb
restructure helloworld example
yarolegovich 4560df2
a2aclient docs
yarolegovich 79f50c1
a2agrpc package doc
yarolegovich c5009c7
log package doc
yarolegovich 4fc10b1
internal package doc updates
yarolegovich 9195699
a2asrv doc
yarolegovich a602500
a2asrv nested packages
yarolegovich ca94307
a2aclient auth
yarolegovich 1799187
fix go-get
yarolegovich 2f7d7d8
Merge branch 'main' into yarolegovich/readme-doc
yarolegovich d6b4b96
jsonrpc server example
yarolegovich 86460c4
update readme
yarolegovich 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 |
|---|---|---|
| @@ -1,2 +1,116 @@ | ||
| # a2a-go | ||
| Golang SDK for A2A Protocol | ||
| # A2A Go SDK | ||
|
|
||
| [](LICENSE) | ||
| [](https://github.com/a2aproject/a2a-go/actions/workflows/nightly.yaml) | ||
| [](https://pkg.go.dev/github.com/a2aproject/a2a-go) | ||
| [](https://deepwiki.com/a2aproject/a2a-go) | ||
|
|
||
| <!-- markdownlint-disable no-inline-html --> | ||
|
|
||
| <div align="center"> | ||
| <img src="https://raw.githubusercontent.com/a2aproject/A2A/refs/heads/main/docs/assets/a2a-logo-black.svg" width="256" alt="A2A Logo"/> | ||
| <h3> | ||
| A Go library for running agentic applications as A2A Servers, following the <a href="https://a2a-protocol.org">Agent2Agent (A2A) Protocol</a>. | ||
| </h3> | ||
| </div> | ||
|
|
||
| <!-- markdownlint-enable no-inline-html --> | ||
|
|
||
| --- | ||
|
|
||
| ## ✨ Features | ||
|
|
||
| - **A2A Protocol Compliant:** Build agentic applications that adhere to the Agent2Agent (A2A) Protocol. | ||
| - **Extensible:** Easily add support for different communication protocols and database backends. | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Getting Started | ||
|
|
||
| Requires Go `1.24.4` or newer: | ||
|
|
||
| ```bash | ||
| go get github.com/a2aproject/[email protected] | ||
| ``` | ||
|
|
||
| Visit [**pkg.go**](https://pkg.go.dev/github.com/a2aproject/a2a-go) for a full documentation. | ||
|
|
||
| ## Examples | ||
|
|
||
| For a simple example refer to the [helloworld] example(./examples/helloworld). | ||
|
|
||
| ### Server | ||
|
|
||
| For a full documentation visit [**pkg.go.dev/a2asrv**](https://pkg.go.dev/github.com/a2aproject/a2a-go/a2asrv). | ||
|
|
||
| 1. Create a transport-agnostic A2A request handler: | ||
|
|
||
| ```go | ||
| var options []a2asrv.RequestHandlerOption = newCustomOptions() | ||
| var agentExecutor a2asrv.AgentExecutor = newCustomAgentExecutor() | ||
| requestHandler := a2asrv.NewHandler(agentExecutor, options...) | ||
| ``` | ||
|
|
||
| 2. Wrap the handler into a transport implementation: | ||
|
|
||
| ```go | ||
| grpcHandler := a2agrpc.NewHandler(requestHandler) | ||
|
|
||
| // or | ||
|
|
||
| jsonrpcHandler := a2asrv.NewJSONRPCHandler(requestHandler) | ||
| ``` | ||
|
|
||
| 3. Register handler with a server, for example: | ||
yarolegovich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```go | ||
| import "google.golang.org/grpc" | ||
| ... | ||
| server := grpc.NewServer() | ||
| grpcHandler.RegisterWith(server) | ||
| err := server.Serve(listener) | ||
| ``` | ||
|
|
||
| ### Client | ||
|
|
||
| For a full documentation visit [**pkg.go.dev/a2aclient**](https://pkg.go.dev/github.com/a2aproject/a2a-go/a2aclient). | ||
|
|
||
| 1. Resolve an `AgentCard` to get an information about how an agent is exposed. | ||
|
|
||
| ```go | ||
| card, err := agentcard.DefaultResolver.Resolve(ctx) | ||
| ``` | ||
|
|
||
| 2. Create a transport-agnostic client from the `AgentCard`: | ||
|
|
||
| ```go | ||
| var options a2aclient.FactoryOption = newCustomClientOptions() | ||
| client, err := a2aclient.NewFromCard(ctx, card, options...) | ||
| ``` | ||
|
|
||
| 3. The connection is now open and can be used to send requests to a server: | ||
yarolegovich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```go | ||
| msg := a2a.NewMessage(a2a.MessageRoleUser, a2a.TextPart{Text: "..."}) | ||
| resp, err := client.SendMessage(ctx, &a2a.MessageSendParams{Message: msg}) | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🌐 More Examples | ||
|
|
||
| You can find a variety of more detailed examples in the [a2a-samples](https://github.com/a2aproject/a2a-samples) repository. | ||
|
|
||
| --- | ||
|
|
||
| ## 🤝 Contributing | ||
|
|
||
| Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on how to get involved. | ||
|
|
||
| Before starting work on a new feature or significant change, please open an issue to discuss your proposed approach with the maintainers. This helps ensure your contribution aligns with the project's goals and prevents duplicated effort or wasted work | ||
|
|
||
| --- | ||
|
|
||
| ## 📄 License | ||
|
|
||
| This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for more details. | ||
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
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,36 @@ | ||
| // Copyright 2025 The A2A Authors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| /* | ||
| Package agentcard provides utilities for fetching public [a2a.AgentCard]. | ||
| A [Resolver] can be created with a custom [http.Client] or package-level DefaultResolver can be used. | ||
|
|
||
| card, err := agentcard.DefaultResolver.Resolve(ctx, baseURL) | ||
|
|
||
| // or | ||
|
|
||
| resolver := agentcard.NewResolver(customClient) | ||
| card, err := resolver.Resolve(ctx, baseURL) | ||
|
|
||
| By default the request is sent for a well-known card location, but custom | ||
| this can be configured by providing [ResolveOption]s. | ||
|
|
||
| card, err := resolver.Resolve( | ||
| ctx, | ||
| baseURL, | ||
| a2aclient.WithPath(customPath), | ||
| a2aclient.WithHeader(key, value), | ||
| ) | ||
| */ | ||
| package agentcard |
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
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.