Skip to content

Commit b247b8d

Browse files
docs: update README.md and CONTRIBUTING.md (#567)
# Description We are updating the repository's foundational documentation to streamline the onboarding experience for new contributors and ensure consistent code quality. ### Summary of Updates: 1. **README.md:** Added a 2-step **Quick Start** guide for running the `helloworld` sample and a **Repository Structure** directory table. 2. **CONTRIBUTING.md:** Fully detailed the local development workflow using `uv`. Added step-by-step commands for running linting (`ruff`), type checking (`mypy`/`pyright`), and test coverage (`pytest`). > Note: As of now mypy, pyright and pytest are added as suggestion only. 3. **Tooling Configurations:** Bumped `ruff` line-length to 100 in `.ruff.toml` and add static analysis tools (`mypy`, `pyright`, `pytest`) in `pyproject.toml`.
1 parent 96c99b5 commit b247b8d

4 files changed

Lines changed: 164 additions & 40 deletions

File tree

.ruff.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# https://google.github.io/styleguide/pyguide.html
77
#
88

9-
line-length = 80 # Google Style Guide §3.2: 80 columns
9+
line-length = 100 # Relaxed Google Style limit (of 80) for modern IDEs and wider screens
1010
indent-width = 4 # Google Style Guide §3.4: 4 spaces
1111

1212
target-version = "py310" # Minimum Python version
@@ -91,6 +91,7 @@ exclude = [
9191
".svn",
9292
".tox",
9393
".venv",
94+
"uv.lock",
9495
"__pypackages__",
9596
"_build",
9697
"buck-out",

CONTRIBUTING.md

Lines changed: 85 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,100 @@
1-
# How to contribute
1+
# Contributing to Agent2Agent (A2A) Samples
22

3-
We'd love to accept your patches and contributions to this project.
3+
We'd love to accept your patches and contributions to this project. This repository contains code samples and demos demonstrating the [Agent2Agent (A2A) Protocol](https://goo.gle/a2a).
44

5-
## Before you begin
5+
## Table of Contents
66

7-
### Sign our Contributor License Agreement
7+
- [Before You Begin](#before-you-begin)
8+
- [Contribution Process](#contribution-process)
9+
- [Development Workflow](#development-workflow)
810

9-
Contributions to this project must be accompanied by a
10-
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
11-
You (or your employer) retain the copyright to your contribution; this simply
12-
gives us permission to use and redistribute your contributions as part of the
13-
project.
11+
## Before You Begin
1412

15-
If you or your current employer have already signed the Google CLA (even if it
16-
was for a different project), you probably don't need to do it again.
13+
### Prerequisites (for Python agents)
1714

18-
Visit <https://cla.developers.google.com/> to see your current agreements or to
19-
sign a new one.
15+
Ensure your local environment meets the following requirements before starting development:
2016

21-
### Review our community guidelines
17+
- **Python**: Version 3.12 or higher (3.13+ recommended for agent development).
18+
- **Package Manager**: [uv](https://docs.astral.sh/uv/) is required for managing dependencies and workspaces.
2219

23-
This project follows
24-
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
20+
### Local Setup
2521

26-
## Contribution process
22+
1. **Fork and Clone**: [Fork this repository](https://github.com/a2aproject/a2a-samples/fork) to your GitHub account, then clone your fork locally:
23+
```bash
24+
git clone https://github.com/<your-username>/a2a-samples.git
25+
cd a2a-samples
26+
```
2727

28-
### Code reviews
28+
2. **Install Dependencies**: Ensure your workspace dependencies are installed:
29+
```bash
30+
uv sync
31+
```
2932

30-
All submissions, including submissions by project members, require review. We
31-
use GitHub pull requests for this purpose. Consult
32-
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
33-
information on using pull requests.
33+
3. **Create a Branch**: Create a feature branch for your changes:
34+
```bash
35+
git checkout -b feature/my-new-sample
36+
```
3437

35-
---
38+
## Contribution Process
3639

37-
## For Google Employees
40+
### Issues and Proposals
3841

39-
Complete the following steps to register your GitHub account and be added as a contributor to this repository.
42+
Before undertaking significant work, check the [issues page](https://github.com/a2aproject/a2a-samples/issues) to see if your feature or bug fix is already being discussed. If not, open a new issue to discuss your proposed changes.
4043

41-
1. Register your GitHub account at [go/GitHub](http://go/github)
44+
### Code Reviews
45+
46+
All submissions, including submissions by project members, require review using GitHub pull requests. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.
47+
48+
## Development Workflow
49+
50+
We use `uv` for dependency management, linting, formatting, type checking, and testing. Make sure all checks pass before submitting a pull request.
51+
52+
### Formatting and Linting
53+
54+
All code **must** be formatted and linted using `ruff` tool. Check its [.ruff.toml](.ruff.toml) configuration for more details.
55+
56+
To check and automatically fix linting errors across the workspace:
57+
58+
```bash
59+
uv run ruff check --fix
60+
```
61+
62+
To format the codebase:
63+
64+
```bash
65+
uv run ruff format
66+
```
67+
68+
#### Checking a Specific Sample
69+
70+
If you are working on a single agent sample (e.g., `helloworld`), you can target it directly:
71+
72+
```bash
73+
uv run ruff check --fix --config .ruff.toml samples/python/agents/helloworld/
74+
uv run ruff format --config .ruff.toml samples/python/agents/helloworld/
75+
```
76+
77+
Alternatively, you can use [./format.sh](./format.sh) for formatting Python and Notebook files.
78+
79+
### Type Checking
80+
81+
Use static type checks to improve your code readability and maintainability. Run the following commands from the workspace root or target directory:
82+
83+
```bash
84+
uv run mypy samples/python
85+
uv run pyright samples/python
86+
```
87+
88+
### Testing
89+
90+
Build and run your tests using `pytest`. Use `--verbose` for more detailed output.
91+
92+
```bash
93+
uv run pytest --verbose
94+
```
95+
96+
To run tests for a specific agent sample or extension:
97+
98+
```bash
99+
uv run pytest tests/python/agents/<sample-name>/
100+
```

README.md

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,85 @@
4343
</details>
4444
</div>
4545

46-
This repository contains code samples and demos which use the [Agent2Agent (A2A) Protocol](https://goo.gle/a2a).
46+
Welcome to the official code samples and demonstrations for the [Agent2Agent (A2A) Protocol](https://goo.gle/a2a).
4747

48-
## Related Repositories
48+
We are thrilled to have you here! Whether you are exploring multi-agent architectures for the first time or building advanced interoperable agent networks, this repository provides simple, inspiring, and accessible learning resources to accelerate your development.
49+
50+
## Why Agent2Agent?
51+
52+
In a world of diverse AI frameworks and ecosystems, agents need a common language to communicate, collaborate, and delegate tasks securely. The A2A protocol establishes a standardized, open standard for multi-agent interoperability.
53+
54+
Our samples demonstrate how easily complex multi-agent problems can be solved across different languages and host applications.
55+
56+
## Quick Start
57+
58+
Get up and running immediately by launching a Helloworld agent and communicating with it via our Python CLI host.
59+
60+
1. **Start the Agent Server**:
61+
Open a terminal and start the Helloworld agent server:
62+
63+
```bash
64+
cd samples/python/agents/helloworld
65+
uv run .
66+
```
4967

50-
- [A2A](https://github.com/a2aproject/A2A) - A2A Specification and documentation.
51-
- [a2a-python](https://github.com/a2aproject/a2a-python) - A2A Python SDK.
52-
- [a2a-inspector](https://github.com/a2aproject/a2a-inspector) - UI tool for inspecting A2A enabled agents.
68+
2. **Run the Host Client**:
69+
Open a second terminal and run the CLI client to send a task to the agent:
70+
71+
```bash
72+
cd samples/python/agents/helloworld
73+
uv run test_client.py
74+
```
75+
76+
## Repository Structure
77+
78+
The repository is organized into several key directories by language:
79+
80+
| Directory | Description |
81+
| --- | --- |
82+
| [samples](/samples) | Core A2A samples organized by programming language. |
83+
| [samples/python](/samples/python) | Demonstrates Python agent implementations using the A2A Python SDK. |
84+
| [samples/go](/samples/go) | Demonstrates Go agent implementations using the A2A Go SDK. |
85+
| [samples/dotnet](/samples/dotnet) | Demonstrates C# agent implementations using the A2A .NET SDK. |
86+
| [samples/java](/samples/java) | Demonstrates Java agent implementations using the A2A Java SDK. |
87+
| [samples/js](/samples/js) | Demonstrates Node.js agent implementations using the A2A JavaScript SDK. |
5388

5489
## Contributing
5590

56-
Contributions welcome! See the [Contributing Guide](CONTRIBUTING.md).
91+
We welcome and encourage contributions of all skill levels! If you have an idea for a new sample, a bug fix, or a documentation improvement, please check out our [Contributing Guide](CONTRIBUTING.md).
5792

58-
## Getting help
93+
## Getting Help
5994

60-
Please use the [issues page](https://github.com/a2aproject/a2a-samples/issues) to provide suggestions, feedback or submit a bug report.
95+
We are dedicated to providing a welcoming and supportive community. If you have questions, feedback, or run into any issues, please reach out on our [issues page](https://github.com/a2aproject/a2a-samples/issues).
6196

62-
## Disclaimer
97+
## Related Repositories
6398

64-
This repository itself is not an officially supported Google product. The code in this repository is for demonstrative purposes only.
99+
| Repository | Category | Description |
100+
| --- | --- | --- |
101+
| [A2A](https://github.com/a2aproject/A2A) | Core Specification | A2A Specification and documentation. |
102+
| [a2a-inspector](https://github.com/a2aproject/a2a-inspector) | Tooling | UI tool for inspecting A2A enabled agents. |
103+
| [a2a-tck](https://github.com/a2aproject/a2a-tck) | Testing | Test suite for validating A2A Protocol compliance. |
104+
| [a2a-itk](https://github.com/a2aproject/a2a-itk) | Testing | Toolkit to verify compatibility across different A2A SDK implementations and versions using multi-hop traversal model and varied transport protocols. |
105+
| [a2a-python](https://github.com/a2aproject/a2a-python) | SDK (Python) | Official Python SDK for A2A. |
106+
| [a2a-go](https://github.com/a2aproject/a2a-go) | SDK (Go) | Official Go SDK for A2A. |
107+
| [a2a-java](https://github.com/a2aproject/a2a-java) | SDK (Java) | Official Java SDK for A2A. |
108+
| [a2a-js](https://github.com/a2aproject/a2a-js) | SDK (JavaScript) | Official Node.js/JavaScript SDK for A2A. |
109+
| [a2a-dotnet](https://github.com/a2aproject/a2a-dotnet) | SDK (C#/.NET) | Official C#/.NET SDK for A2A. |
110+
| [a2a-rs](https://github.com/a2aproject/a2a-rs) | SDK (Rust) | Official Rust SDK for A2A. |
111+
112+
## Disclaimer
65113

66-
Important: The sample code provided is for demonstration purposes and illustrates the mechanics of the Agent-to-Agent (A2A) protocol. When building production applications, it is critical to treat any agent operating outside of your direct control as a potentially untrusted entity.
114+
**Important:** The sample code provided is for demonstration purposes and illustrates the mechanics of the
115+
Agent-to-Agent (A2A) protocol. When building production applications, it is critical to treat any agent
116+
operating outside of your direct control as a potentially untrusted entity.
67117

68-
All data received from an external agent—including but not limited to its AgentCard, messages, artifacts, and task statuses—should be handled as untrusted input. For example, a malicious agent could provide an AgentCard containing crafted data in its fields (e.g., description, name, skills.description). If this data is used without sanitization to construct prompts for a Large Language Model (LLM), it could expose your application to prompt injection attacks. Failure to properly validate and sanitize this data before use can introduce security vulnerabilities into your application.
118+
All data received from an external agent—including but not limited to its AgentCard, messages,
119+
artifacts, and task statuses—should be handled as untrusted input. For example, a malicious agent
120+
could provide an AgentCard containing crafted data in its fields (e.g., description, name,
121+
skills.description). If this data is used without sanitization to construct prompts for a Large
122+
Language Model (LLM), it could expose your application to prompt injection attacks. Failure to
123+
properly validate and sanitize this data before use can introduce security vulnerabilities into
124+
your application.
69125

70-
Developers are responsible for implementing appropriate security measures, such as input validation and secure handling of credentials to protect their systems and users.
126+
> Developers are responsible for implementing appropriate security measures, such as input validation
127+
> and secure handling of credentials to protect their systems and users.

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = []
88

9+
[dependency-groups]
10+
dev = [
11+
"mypy>=1.19.1",
12+
"pyright>=1.1.409",
13+
"pytest>=9.0.2",
14+
]
15+
916
[tool.uv.workspace]
1017
members = [
1118
"samples/python/agents/crewai",

0 commit comments

Comments
 (0)