Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
AError
ARequest
AStarlette
adk
genai
inmemory
langgraph
lifecycles
oauthoidc
opensource
socio
sse
5 changes: 1 addition & 4 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"ignore": [
"**/.github/**",
"**/.git/**"
],
"ignore": ["**/.github/**", "**/.git/**", "**/tests/**"],
"threshold": 3,
"reporters": ["html", "markdown"]
}
5 changes: 1 addition & 4 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ name: Lint Code Base
# Start the job on all push #
#############################
on:
push:
branches-ignore: [main]
# Remove the line above to run when pushing to main
pull_request:
branches: [main]

Expand All @@ -31,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
# if on repo to avoid failing runs on forks
if: |
github.repository == 'google/A2A'
github.repository == 'google/a2a-python'
##################
# Load all steps #
Expand Down
65 changes: 2 additions & 63 deletions .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,6 @@
name: Check Spelling

# Comment management is handled through a secondary job, for details see:
# https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Restricted-Permissions
#
# `jobs.comment-push` runs when a push is made to a repository and the `jobs.spelling` job needs to make a comment
# (in odd cases, it might actually run just to collapse a comment, but that's fairly rare)
# it needs `contents: write` in order to add a comment.
#
# `jobs.comment-pr` runs when a pull_request is made to a repository and the `jobs.spelling` job needs to make a comment
# or collapse a comment (in the case where it had previously made a comment and now no longer needs to show a comment)
# it needs `pull-requests: write` in order to manipulate those comments.

# Updating pull request branches is managed via comment handling.
# For details, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-expect-list
#
# These elements work together to make it happen:
#
# `on.issue_comment`
# This event listens to comments by users asking to update the metadata.
#
# `jobs.update`
# This job runs in response to an issue_comment and will push a new commit
# to update the spelling metadata.
#
# `with.experimental_apply_changes_via_bot`
# Tells the action to support and generate messages that enable it
# to make a commit to update the spelling metadata.
#
# `with.ssh_key`
# In order to trigger workflows when the commit is made, you can provide a
# secret (typically, a write-enabled github deploy key).
#
# For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key

# Sarif reporting
#
# Access to Sarif reports is generally restricted (by GitHub) to members of the repository.
#
# Requires enabling `security-events: write`
# and configuring the action with `use_sarif: 1`
#
# For information on the feature, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Sarif-output

# Minimal workflow structure:
#
# on:
# push:
# ...
# pull_request_target:
# ...
# jobs:
# # you only want the spelling job, all others should be omitted
# spelling:
# # remove `security-events: write` and `use_sarif: 1`
# # remove `experimental_apply_changes_via_bot: 1`
# ... otherwise adjust the `with:` as you wish

on:
push:
branches:
- "**"
tags-ignore:
- "**"
pull_request:
branches:
- "**"
Expand All @@ -85,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
# if on repo to avoid failing runs on forks
if: |
github.repository == 'google/A2A'
github.repository == 'google/a2a-python'
&& (contains(github.event_name, 'pull_request') || github.event_name == 'push')
concurrency:
group: spelling-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -141,6 +80,6 @@ jobs:
cspell:sql/src/tsql.txt
cspell:terraform/dict/terraform.txt
cspell:typescript/dict/typescript.txt
check_extra_dictionaries: ''
check_extra_dictionaries: ""
only_check_changed_files: true
longest_word: "10"
70 changes: 30 additions & 40 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,31 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug HelloWorld Agent",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/examples/helloworld/__main__.py",
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONPATH": "${workspaceFolder}",
},
"cwd": "${workspaceFolder}/examples/helloworld",
"args": [
"--host",
"localhost",
"--port",
"9999"
]
},
{
"name": "Debug Currency Agent",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/examples/langgraph/__main__.py",
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONPATH": "${workspaceFolder}",
},
"cwd": "${workspaceFolder}/examples/langgraph",
"args": [
"--host",
"localhost",
"--port",
"10000"
]
}
]
}
"version": "0.2.0",
"configurations": [
{
"name": "Debug HelloWorld Agent",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/examples/helloworld/__main__.py",
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}/examples/helloworld",
"args": ["--host", "localhost", "--port", "9999"]
},
{
"name": "Debug Currency Agent",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/examples/langgraph/__main__.py",
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}/examples/langgraph",
"args": ["--host", "localhost", "--port", "10000"]
}
]
}
26 changes: 12 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
},
},
"ruff.importStrategy": "fromEnvironment"
}
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
},
"ruff.importStrategy": "fromEnvironment"
}
33 changes: 16 additions & 17 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Code of Conduct

## Our Pledge
Expand All @@ -15,22 +14,22 @@ race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Expand Down Expand Up @@ -61,7 +60,7 @@ negative impact on the project or its community.

We do not believe that all conflict is bad; healthy debate and disagreement
often yield positive results. However, it is never okay to be disrespectful or
to engage in behavior that violates the projects code of conduct.
to engage in behavior that violates the project's code of conduct.

If you see someone violating the code of conduct, you are encouraged to address
the behavior directly with those involved. Many issues can be resolved quickly
Expand All @@ -70,8 +69,8 @@ dispute. If you are unable to resolve the matter for any reason, or if the
behavior is threatening or harassing, report it. We are dedicated to providing
an environment where participants feel welcome and safe.

Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the
Project Steward(s) for *[PROJECT NAME]*. It is the Project Stewards duty to
Reports should be directed to _[PROJECT STEWARD NAME(s) AND EMAIL(s)]_, the
Project Steward(s) for _[PROJECT NAME]_. It is the Project Steward's duty to
receive and address reported violations of the code of conduct. They will then
work with a committee consisting of representatives from the Open Source
Programs Office and the Google Open Source Strategy team. If for any reason you
Expand Down
4 changes: 2 additions & 2 deletions examples/google_adk/calendar_agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This example shows how to create an A2A Server that uses an ADK-based Agent that
- [UV](https://docs.astral.sh/uv/)
- A Gemini API Key
- A [Google OAuth Client](https://developers.google.com/identity/openid-connect/openid-connect#getcredentials)
- Configure your OAuth client to handle redirect URLs at `localhost:10007/authenticate`
- Configure your OAuth client to handle redirect URLs at `localhost:10007/authenticate`

## Running the example

Expand All @@ -24,4 +24,4 @@ echo "GOOGLE_CLIENT_SECRET=your_client_secret_here" >> .env

```
uv run .
```
```
37 changes: 20 additions & 17 deletions examples/google_adk/calendar_agent/__main__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import logging
import os
import sys

import click
import uvicorn

from adk_agent_executor import ADKAgentExecutor
from adk_agent import create_agent
from adk_agent_executor import ADKAgentExecutor
from dotenv import load_dotenv
from google.adk.artifacts import InMemoryArtifactService
from google.adk.memory.in_memory_memory_service import InMemoryMemoryService
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import PlainTextResponse
from starlette.routing import Route

from a2a.server.tasks import InMemoryTaskStore
from a2a.server.apps import A2AStarletteApplication
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.tasks import InMemoryTaskStore
from a2a.types import (
AgentAuthentication,
AgentCapabilities,
AgentCard,
AgentSkill,
)
from google.adk.artifacts import InMemoryArtifactService
from google.adk.memory.in_memory_memory_service import InMemoryMemoryService
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from starlette.applications import Starlette
from starlette.routing import Route
from starlette.requests import Request
from starlette.responses import PlainTextResponse


load_dotenv()

Expand All @@ -36,12 +36,15 @@
@click.option('--host', 'host', default='localhost')
@click.option('--port', 'port', default=10007)
def main(host: str, port: int):
# Verify an API key is set. Not required if using Vertex AI APIs, since those can use gcloud credentials.
if not os.getenv('GOOGLE_GENAI_USE_VERTEXAI') == 'TRUE':
if not os.getenv('GOOGLE_API_KEY'):
raise Exception(
'GOOGLE_API_KEY environment variable not set and GOOGLE_GENAI_USE_VERTEXAI is not TRUE.'
)
# Verify an API key is set.
# Not required if using Vertex AI APIs.
if os.getenv('GOOGLE_GENAI_USE_VERTEXAI') != 'TRUE' and not os.getenv(
'GOOGLE_API_KEY'
):
raise ValueError(
'GOOGLE_API_KEY environment variable not set and '
'GOOGLE_GENAI_USE_VERTEXAI is not TRUE.'
)

skill = AgentSkill(
id='check_availability',
Expand Down
Loading