Skip to content

Conversation

@w21n8n96
Copy link

@w21n8n96 w21n8n96 commented Jun 1, 2025

This commit introduces an example AI agent with a simple 'echo' capability.

Key changes:

  • I created src/a2a/example_agent/ for the agent code.
  • I implemented ExampleAgent in src/a2a/example_agent/agent.py.
  • I added src/a2a/example_agent/__init__.py.
  • I exposed ExampleAgent in src/a2a/__init__.py.
  • I added tests for the agent in tests/server/agent_execution/test_example_agent.py.

During development, the base classes Agent, AgentCapability, TaskCompleter, and TaskParameters were not found within the existing SDK codebase. To proceed, I created placeholder versions of these classes directly within src/a2a/example_agent/agent.py. These placeholders will need to be replaced with the actual SDK components when they become available or their correct location is identified. The tests were written to use these placeholder classes and are currently passing.

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

Fixes #<issue_number_goes_here> 🦕

This commit introduces an example AI agent with a simple 'echo' capability.

Key changes:
- I created `src/a2a/example_agent/` for the agent code.
- I implemented `ExampleAgent` in `src/a2a/example_agent/agent.py`.
- I added `src/a2a/example_agent/__init__.py`.
- I exposed `ExampleAgent` in `src/a2a/__init__.py`.
- I added tests for the agent in `tests/server/agent_execution/test_example_agent.py`.

During development, the base classes `Agent`, `AgentCapability`, `TaskCompleter`,
and `TaskParameters` were not found within the existing SDK codebase.
To proceed, I created placeholder versions of these classes directly within
`src/a2a/example_agent/agent.py`. These placeholders will need to be replaced
with the actual SDK components when they become available or their correct
location is identified. The tests were written to use these placeholder classes
and are currently passing.
@w21n8n96 w21n8n96 requested a review from a team as a code owner June 1, 2025 13:12
@google-cla
Copy link

google-cla bot commented Jun 1, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

This commit introduces a new example AI agent capable of generating blog posts
by leveraging the Gemini API.

Key changes include:
- Installed the `google-generativeai` library.
- Enhanced `src/a2a/example_agent/agent.py`:
    - Integrated Gemini API for content generation.
    - Added new capabilities: `generate_blog_topic`, `generate_blog_outline`,
      `write_blog_section`, and `assemble_blog_post`.
    - Reads Gemini API key from the `GEMINI_API_KEY` environment variable.
- Updated tests in `tests/server/agent_execution/test_example_agent.py`:
    - Added tests for the new blog generation capabilities.
    - Mocked Gemini API calls to ensure tests are isolated and reproducible.
- Created `examples/run_blog_generator.py`:
    - A new script to demonstrate the end-to-end flow of generating a blog post.
    - Requires `GEMINI_API_KEY` in a `.env` file.
    - Saves the output to `generated_blog_post.md`.
- Added `.env.example` to the repository root.
- Updated `README.md` with instructions on how to set up and run the
  new blog post generation example.

The agent continues to use placeholder classes for core A2A SDK components
(`Agent`, `AgentCapability`, etc.) as their definitive source within the SDK
was not identified. This example provides a more complex, real-world use case
for an A2A agent.
@w21n8n96 w21n8n96 closed this by deleting the head repository Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant