Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f3ac8e9
feat: Add client and server agents
batprem May 19, 2025
7ad9f52
refactor: Format with nox
batprem May 20, 2025
09686c7
refactor: Comment unused variable
batprem May 20, 2025
31e33b1
fix: Remove unused noxfile
batprem May 20, 2025
eb2ce8c
feat: Add client and server agents
batprem May 19, 2025
7a7c999
refactor: Format with nox
batprem May 20, 2025
ad32721
refactor: Comment unused variable
batprem May 20, 2025
8a4a3ae
fix: Remove unused noxfile
batprem May 20, 2025
6536899
Merge branch 'docs/add-new-example-mcp-without-llm-framework' of http…
batprem May 20, 2025
da47c5c
fix: Remove local .gitignore
batprem May 20, 2025
9bf0aca
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
holtskinner May 20, 2025
dab3656
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 21, 2025
2692d67
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 21, 2025
4e0a2ff
feat: Add client and server agents
batprem May 19, 2025
580c7e5
refactor: Format with nox
batprem May 20, 2025
2893347
refactor: Comment unused variable
batprem May 20, 2025
15adb5c
fix: Remove unused noxfile
batprem May 20, 2025
28fd453
refactor: Format with nox
batprem May 20, 2025
2af8cc9
fix: Remove unused noxfile
batprem May 20, 2025
a3db5de
fix: Remove local .gitignore
batprem May 20, 2025
066b2e8
Merge branch 'docs/add-new-example-mcp-without-llm-framework' of http…
batprem May 21, 2025
1ab6803
feat: Finish client
batprem May 21, 2025
04f6250
doc: Add README.MD
batprem May 21, 2025
ebd2f6c
build: Use SDK from Pypi instead
batprem May 21, 2025
4ea93b1
build: Add spell allow lists
batprem May 21, 2025
3447ce2
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 22, 2025
717c0d4
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 22, 2025
3d2e0f0
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 23, 2025
a4c25a2
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 23, 2025
ac8408f
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 24, 2025
0127c25
Merge branch 'main' into docs/add-new-example-mcp-without-llm-framework
batprem May 27, 2025
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
16 changes: 16 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@
sse
tagwords
vulnz
asyncclick
CLIs
crewai
detial
Genkit
gitmcp
googleblog
gweb
JWKS
llm
llms
markdow
mcp
multiagent
protoc
TMDB

Check warning on line 55 in .github/actions/spelling/allow.txt

View workflow job for this annotation

GitHub Actions / Check Spelling

Missing newline at eof. (no-newline-at-eof)
1 change: 1 addition & 0 deletions examples/no-llm-framework/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
129 changes: 129 additions & 0 deletions examples/no-llm-framework/.ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#################################################################################
#
# Ruff linter and code formatter for A2A
#
# This file follows the standards in Google Python Style Guide
# https://google.github.io/styleguide/pyguide.html
#

line-length = 80 # Google Style Guide §3.2: 80 columns
indent-width = 4 # Google Style Guide §3.4: 4 spaces

target-version = "py310" # Minimum Python version

[lint]
ignore = [
"I001",
"COM812",
"FBT001",
"FBT002",
"D203",
"D213",
"ANN001",
"ANN201",
"ANN204",
"D100", # Ignore Missing docstring in public module (often desired at top level __init__.py)
"D102", # Ignore return type annotation in public method
"D104", # Ignore Missing docstring in public package (often desired at top level __init__.py)
"D107", # Ignore Missing docstring in __init__ (use class docstring)
"TD002", # Ignore Missing author in TODOs (often not required)
"TD003", # Ignore Missing issue link in TODOs (often not required/available)
"T201", # Ignore print presence
"RUF012", # Ignore Mutable class attributes should be annotated with `typing.ClassVar`
"RUF013", # Ignore implicit optional
]

select = [
"E", # pycodestyle errors (PEP 8)
"W", # pycodestyle warnings (PEP 8)
"F", # Pyflakes (logical errors, unused imports/variables)
"I", # isort (import sorting - Google Style §3.1.2)
"D", # pydocstyle (docstring conventions - Google Style §3.8)
"N", # pep8-naming (naming conventions - Google Style §3.16)
"UP", # pyupgrade (use modern Python syntax)
"ANN",# flake8-annotations (type hint usage/style - Google Style §2.22)
"A", # flake8-builtins (avoid shadowing builtins)
"B", # flake8-bugbear (potential logic errors & style issues - incl. mutable defaults B006, B008)
"C4", # flake8-comprehensions (unnecessary list/set/dict comprehensions)
"ISC",# flake8-implicit-str-concat (disallow implicit string concatenation across lines)
"T20",# flake8-print (discourage `print` - prefer logging)
"SIM",# flake8-simplify (simplify code, e.g., `if cond: return True else: return False`)
"PTH",# flake8-use-pathlib (use pathlib instead of os.path where possible)
"PL", # Pylint rules ported to Ruff (PLC, PLE, PLR, PLW)
"PIE",# flake8-pie (misc code improvements, e.g., no-unnecessary-pass)
"RUF",# Ruff-specific rules (e.g., RUF001-003 ambiguous unicode)
"RET",# flake8-return (consistency in return statements)
"SLF",# flake8-self (check for private member access via `self`)
"TID",# flake8-tidy-imports (relative imports, banned imports - configure if needed)
"YTT",# flake8-boolean-trap (checks for boolean positional arguments, truthiness tests - Google Style §3.10)
"TD", # flake8-todos (check TODO format - Google Style §3.7)
]

exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"*/migrations/*",
"test_*",
]

[lint.isort]
#force-sort-within-sections = true
#combine-as-imports = true
case-sensitive = true
#force-single-line = false
#known-first-party = []
#known-third-party = []
lines-after-imports = 2
lines-between-types = 1
#no-lines-before = ["LOCALFOLDER"]
#required-imports = []
#section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]

[lint.pydocstyle]
convention = "google"

[lint.flake8-annotations]
mypy-init-return = true
allow-star-arg-any = true

[lint.pep8-naming]
ignore-names = ["test_*", "setUp", "tearDown", "mock_*"]
classmethod-decorators = ["classmethod", "pydantic.validator", "pydantic.root_validator"]
staticmethod-decorators = ["staticmethod"]

[lint.flake8-tidy-imports]
ban-relative-imports = "all" # Google generally prefers absolute imports (§3.1.2)

[lint.flake8-quotes]
docstring-quotes = "double"
inline-quotes = "single"

[lint.per-file-ignores]
"__init__.py" = ["F401"] # Ignore unused imports in __init__.py
"*_test.py" = ["D", "ANN"] # Ignore docstring and annotation issues in test files
"test_*.py" = ["D", "ANN"] # Ignore docstring and annotation issues in test files
"types.py" = ["D", "E501", "N815"] # Ignore docstring and annotation issues in types.py

[format]
docstring-code-format = true
docstring-code-line-length = "dynamic" # Or set to 80
quote-style = "single"
indent-style = "space"
72 changes: 72 additions & 0 deletions examples/no-llm-framework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Example: Using a2a-python SDK Without an LLM Framework

This repository demonstrates how to set up and use the [a2a-python SDK](https://github.com/google/a2a-python) to create a simple server and client, without relying on any large language model (LLM) framework.

## Overview

- **A2A (Agent-to-Agent):** A protocol and SDK for building interoperable AI agents.
- **This Example:** Shows how to run a basic A2A server and client, exchange messages, and view the response.

## Prerequisites

- Python 3.13+
- [uv](https://github.com/astral-sh/uv) (for fast dependency management and running)
- An API key for Gemini (set as `GEMINI_API_KEY`)

## Installation

1. **Clone the repository:**
```bash
git clone <this-repo-url>
cd <repo-directory>
```

2. **Install dependencies:**
```bash
uv pip install -e .
```

3. **Set environment variables:**
```bash
export GEMINI_API_KEY=your-gemini-api-key
```

Or create a `.env` file with:
```
GEMINI_API_KEY=your-gemini-api-key
```

## Running the Example

### 1. Start the Server

```bash
uv run --env-file .env python -m src.no_llm_framework.server.__main__
```
- The server will start on port 9999.

### 2. Run the Client

In a new terminal:

```bash
uv run --env-file .env python -m src.no_llm_framework.client --question "What is A2A protocol?"
```

- The client will connect to the server and send a request.

### 3. View the Response

- The response from the client will be saved to [response.xml](./response.xml).

## File Structure

- `src/no_llm_framework/server/`: Server implementation.
- `src/no_llm_framework/client/`: Client implementation.
- `response.xml`: Example response from the client.

## Troubleshooting

- **Missing dependencies:** Make sure you have `uv` installed.
- **API key errors:** Ensure `GEMINI_API_KEY` is set correctly.
- **Port conflicts:** Make sure port 9999 is free.
23 changes: 23 additions & 0 deletions examples/no-llm-framework/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[project]
name = "no-llm-framework"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [{ name = "prem", email = "prem.ch@ku.th" }]
requires-python = ">=3.13"
dependencies = [
"a2a-sdk>=0.2.3",
"asyncclick>=8.1.8",
"colorama>=0.4.6",
"fastmcp>=2.3.4",
"google-generativeai>=0.8.5",
"jinja2>=3.1.6",
"rich>=14.0.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project.scripts]
a2a-server = "no_llm_framework.server.__main__:main"
a2a-client = "no_llm_framework.client.__main__:main"
Loading
Loading