a2a-agent-checker 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ """Check an A2A Agent Card against the v1.0 specification."""
2
+ from .card import Finding, validate
3
+ from .check import Report, check
4
+
5
+ __all__ = ["Finding", "Report", "check", "validate"]
6
+ __version__ = "0.4.0"
@@ -0,0 +1,194 @@
1
+ """Validating an Agent Card against A2A v1.0.
2
+
3
+ Pure and offline: `validate(card, card_url)` takes parsed JSON and returns
4
+ findings. Nothing here touches the network, so every rule is testable against
5
+ a fixture.
6
+
7
+ Three levels, and the line between them is the point:
8
+
9
+ * **fail** - a v1.0 client cannot use the card (a required field missing or
10
+ the wrong type).
11
+ * **warn** - usable, but something a client or a person will trip on: a
12
+ 0.3-era field, an interface on another host, a duplicate skill id.
13
+ * **info** - true and worth saying, and not a fault: a signature present
14
+ an optional field absent. Signatures are verified in `signatures.py`,
15
+ which needs the network to fetch the key.
16
+ """
17
+ from __future__ import annotations
18
+
19
+ import re
20
+ from dataclasses import dataclass
21
+ from urllib.parse import urlsplit
22
+
23
+ PROTOCOL_VERSION = "1.0"
24
+ BINDINGS = {"JSONRPC", "GRPC", "HTTP+JSON"}
25
+ REQUIRED = ("name", "description", "supportedInterfaces", "version",
26
+ "capabilities", "defaultInputModes", "defaultOutputModes", "skills")
27
+ # Fields a 0.3 card carried at the top level and v1.0 moved into
28
+ # supportedInterfaces. Their presence is how an older card is recognised.
29
+ LEGACY_FIELDS = ("url", "preferredTransport", "additionalInterfaces", "protocolVersion")
30
+ SNAKE = re.compile(r"^[a-z]+(_[a-z0-9]+)+$")
31
+ MEDIA_TYPE = re.compile(r"^[\w.+-]+/[\w.+-]+$")
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ class Finding:
36
+ level: str # fail | warn | info
37
+ code: str
38
+ message: str
39
+
40
+ def as_dict(self) -> dict:
41
+ return {"level": self.level, "code": self.code, "message": self.message}
42
+
43
+
44
+ def _is_text(v) -> bool:
45
+ return isinstance(v, str) and v.strip() != ""
46
+
47
+
48
+ def _string_list(v) -> bool:
49
+ return isinstance(v, list) and len(v) > 0 and all(_is_text(x) for x in v)
50
+
51
+
52
+ def _snake_keys(obj, path="") -> list[str]:
53
+ found = []
54
+ if isinstance(obj, dict):
55
+ for k, v in obj.items():
56
+ if SNAKE.match(k):
57
+ found.append(path + k)
58
+ found += _snake_keys(v, f"{path}{k}.")
59
+ elif isinstance(obj, list):
60
+ for i, v in enumerate(obj):
61
+ found += _snake_keys(v, f"{path}[{i}].")
62
+ return found
63
+
64
+
65
+ VERSIONED = re.compile(r"/v\d+(\.\d+)*/?$")
66
+
67
+
68
+ def _extensions(exts, warn, info) -> None:
69
+ """Spec 4.6: each declaration names its extension by URI, and a breaking
70
+ change must get a new URI, so the version belongs in it (4.6.3)."""
71
+ if not isinstance(exts, list):
72
+ warn("extension-malformed", "'capabilities.extensions' must be a list")
73
+ return
74
+ for i, ext in enumerate(exts, 1):
75
+ if not isinstance(ext, dict):
76
+ warn("extension-malformed", f"extension {i} is not an object")
77
+ continue
78
+ uri = ext.get("uri")
79
+ p = urlsplit(uri) if isinstance(uri, str) else None
80
+ if not p or not p.scheme or not (p.netloc or p.scheme == "urn"):
81
+ warn("extension-malformed", f"extension {i} has no absolute 'uri'")
82
+ continue
83
+ if "required" in ext and not isinstance(ext["required"], bool):
84
+ warn("extension-malformed", f"{uri}: 'required' must be true or false")
85
+ if not VERSIONED.search(p.path or ""):
86
+ info("extension-unversioned", f"{uri} carries no version in its path; "
87
+ "a breaking change then has no new URI to move to (4.6.3)")
88
+ req = " (required)" if ext.get("required") is True else ""
89
+ info("extension", f"declares {uri}{req}")
90
+
91
+
92
+ def validate(card, card_url: str | None = None) -> list[Finding]:
93
+ out: list[Finding] = []
94
+ fail = lambda c, m: out.append(Finding("fail", c, m))
95
+ warn = lambda c, m: out.append(Finding("warn", c, m))
96
+ info = lambda c, m: out.append(Finding("info", c, m))
97
+
98
+ if not isinstance(card, dict):
99
+ fail("not-an-object", "the Agent Card is not a JSON object")
100
+ return out
101
+
102
+ missing = [k for k in REQUIRED if k not in card]
103
+ for k in missing:
104
+ fail("missing-field", f"required field '{k}' is missing")
105
+
106
+ legacy = [k for k in LEGACY_FIELDS if k in card]
107
+ if legacy:
108
+ (fail if "supportedInterfaces" in missing else warn)(
109
+ "legacy-card",
110
+ "looks like an A2A 0.3 card (top-level " + ", ".join(legacy)
111
+ + "); v1.0 lists endpoints in 'supportedInterfaces'")
112
+
113
+ for k in ("name", "description", "version"):
114
+ if k in card and not _is_text(card[k]):
115
+ fail("bad-type", f"'{k}' must be a non-empty string")
116
+
117
+ if "capabilities" in card and not isinstance(card["capabilities"], dict):
118
+ fail("bad-type", "'capabilities' must be an object")
119
+ elif isinstance(card.get("capabilities"), dict) and "extensions" in card["capabilities"]:
120
+ _extensions(card["capabilities"]["extensions"], warn, info)
121
+
122
+ for k in ("defaultInputModes", "defaultOutputModes"):
123
+ if k in card:
124
+ if not _string_list(card[k]):
125
+ fail("bad-type", f"'{k}' must be a non-empty list of media types")
126
+ else:
127
+ odd = [m for m in card[k] if not MEDIA_TYPE.match(m)]
128
+ if odd:
129
+ warn("media-type", f"'{k}' has values that are not media types: {odd}")
130
+
131
+ host = (urlsplit(card_url).hostname or "").lower() if card_url else ""
132
+ ifaces = card.get("supportedInterfaces")
133
+ if "supportedInterfaces" in card:
134
+ if not isinstance(ifaces, list) or not ifaces:
135
+ fail("bad-type", "'supportedInterfaces' must be a non-empty list")
136
+ ifaces = []
137
+ for i, iface in enumerate(ifaces):
138
+ where = f"supportedInterfaces[{i}]"
139
+ if not isinstance(iface, dict):
140
+ fail("bad-type", f"{where} must be an object")
141
+ continue
142
+ url = iface.get("url")
143
+ if not _is_text(url):
144
+ fail("missing-field", f"{where}.url is missing")
145
+ else:
146
+ parts = urlsplit(url)
147
+ if parts.scheme != "https":
148
+ fail("insecure-url", f"{where}.url is not https: {url}")
149
+ elif host and (parts.hostname or "").lower() != host:
150
+ warn("other-host", f"{where}.url is on {parts.hostname}, not {host}"
151
+ " - fine if intended, but a client cannot tell it apart from a"
152
+ " card pointing somewhere it should not")
153
+ binding = iface.get("protocolBinding")
154
+ if binding not in BINDINGS:
155
+ fail("bad-binding", f"{where}.protocolBinding is {binding!r}; expected one of "
156
+ + ", ".join(sorted(BINDINGS)))
157
+ version = iface.get("protocolVersion")
158
+ if not _is_text(version):
159
+ fail("missing-field", f"{where}.protocolVersion is missing")
160
+ elif version.split(".")[0] != PROTOCOL_VERSION.split(".")[0]:
161
+ warn("old-version", f"{where}.protocolVersion is {version}; current is {PROTOCOL_VERSION}")
162
+
163
+ skills = card.get("skills")
164
+ if "skills" in card:
165
+ if not isinstance(skills, list) or not skills:
166
+ fail("bad-type", "'skills' must be a non-empty list")
167
+ skills = []
168
+ ids = []
169
+ for i, skill in enumerate(skills):
170
+ where = f"skills[{i}]"
171
+ if not isinstance(skill, dict):
172
+ fail("bad-type", f"{where} must be an object")
173
+ continue
174
+ for k in ("id", "name", "description"):
175
+ if not _is_text(skill.get(k)):
176
+ fail("missing-field", f"{where}.{k} is missing or empty")
177
+ if not isinstance(skill.get("tags"), list):
178
+ fail("missing-field", f"{where}.tags must be a list")
179
+ if _is_text(skill.get("id")):
180
+ ids.append(skill["id"])
181
+ dupes = sorted({s for s in ids if ids.count(s) > 1})
182
+ if dupes:
183
+ warn("duplicate-skill", f"skill ids appear more than once: {dupes}")
184
+
185
+ snake = _snake_keys(card)
186
+ if snake:
187
+ warn("snake-case", "v1.0 JSON uses camelCase; these keys are snake_case: "
188
+ + ", ".join(snake[:6]) + (" ..." if len(snake) > 6 else ""))
189
+
190
+ if "provider" not in card:
191
+ info("no-provider", "no 'provider' - nothing says who operates this agent")
192
+ if "documentationUrl" not in card:
193
+ info("no-docs", "no 'documentationUrl'")
194
+ return out
@@ -0,0 +1,206 @@
1
+ """Check one domain: fetch its Agent Card, validate it, optionally probe it.
2
+
3
+ The probe is deliberately the most harmless call A2A defines: `GetTask` for
4
+ a random task id nobody holds. Nothing is created, sent or run on the other
5
+ side. A `SendMessage` would prove more and could make somebody's agent do
6
+ work, so this checker never sends one.
7
+
8
+ Two bindings are probed, and each has its own correct answer:
9
+
10
+ * **JSONRPC** - POST a `GetTask` request; expect error -32001.
11
+ * **HTTP+JSON** - `GET {url}[/{tenant}]/tasks/{id}`; expect HTTP 404 carrying
12
+ a `google.rpc.Status` body whose `ErrorInfo.reason` is `TASK_NOT_FOUND`.
13
+ The body is what matters: a bare 404 is also what a server says when the
14
+ route does not exist at all, so it cannot tell "no such task" from "no
15
+ such endpoint". The path, the tenant prefix and the reason string follow
16
+ the official a2a-sdk (1.2), which is the reference this was checked
17
+ against.
18
+
19
+ GRPC is not probed: it needs an HTTP/2 gRPC client, which this checker does
20
+ not carry.
21
+ """
22
+ from __future__ import annotations
23
+
24
+ import json
25
+ import uuid
26
+ from urllib.parse import quote
27
+ from dataclasses import dataclass, field
28
+ from urllib.parse import urlsplit
29
+
30
+ from . import card as cardmod
31
+ from . import signatures
32
+ from .card import Finding
33
+ from .fetch import FetchRefused, fetch
34
+
35
+ WELL_KNOWN = "/.well-known/agent-card.json"
36
+ TASK_NOT_FOUND = -32001
37
+ METHOD_NOT_FOUND = -32601
38
+ ERROR_INFO_TYPE = "type.googleapis.com/google.rpc.ErrorInfo"
39
+ REST_TASK_NOT_FOUND = "TASK_NOT_FOUND"
40
+ PROBED = ("JSONRPC", "HTTP+JSON")
41
+
42
+
43
+ @dataclass
44
+ class Report:
45
+ domain: str
46
+ card_url: str
47
+ card: dict | None = None
48
+ findings: list[Finding] = field(default_factory=list)
49
+
50
+ @property
51
+ def verdict(self) -> str:
52
+ levels = {f.level for f in self.findings}
53
+ return "fail" if "fail" in levels else "warn" if "warn" in levels else "pass"
54
+
55
+ def as_dict(self) -> dict:
56
+ return {"domain": self.domain, "card_url": self.card_url, "verdict": self.verdict,
57
+ # A card that parsed as a list or a string has no name; `.get`
58
+ # on it would crash the --json output for every target.
59
+ "agent": self.card.get("name") if isinstance(self.card, dict)
60
+ and isinstance(self.card.get("name"), str) else None,
61
+ "findings": [f.as_dict() for f in self.findings]}
62
+
63
+
64
+ def card_url_for(target: str) -> str:
65
+ """Accept a bare domain or a full https URL; return the card URL to fetch."""
66
+ target = target.strip()
67
+ if "://" not in target:
68
+ return f"https://{target.strip('/').lower()}{WELL_KNOWN}"
69
+ return target
70
+
71
+
72
+ def _task_id() -> str:
73
+ return f"a2a-agent-checker-{uuid.uuid4()}"
74
+
75
+
76
+ def _probe_jsonrpc(iface: dict, fetcher) -> list[Finding]:
77
+ url, version = iface.get("url"), iface.get("protocolVersion") or ""
78
+ body = json.dumps({"jsonrpc": "2.0", "id": 1, "method": "GetTask",
79
+ "params": {"id": _task_id()}}).encode()
80
+ try:
81
+ r = fetcher(url, method="POST", content=body,
82
+ headers={"Content-Type": "application/json", "A2A-Version": version})
83
+ except FetchRefused as e:
84
+ return [Finding("fail", "probe-unreachable", f"endpoint {url}: {e}")]
85
+ if r.status in (401, 403):
86
+ return [Finding("info", "probe-auth", f"endpoint {url} requires authentication"
87
+ f" (HTTP {r.status}); not probed further")]
88
+ if r.status != 200:
89
+ return [Finding("fail", "probe-http", f"endpoint {url} answered HTTP {r.status} to JSON-RPC")]
90
+ try:
91
+ answer = json.loads(r.body)
92
+ except ValueError:
93
+ return [Finding("fail", "probe-not-json", f"endpoint {url} did not answer with JSON")]
94
+ if not isinstance(answer, dict) or answer.get("jsonrpc") != "2.0":
95
+ return [Finding("fail", "probe-not-jsonrpc", f"endpoint {url} did not answer JSON-RPC 2.0")]
96
+ code = (answer.get("error") or {}).get("code")
97
+ if code == TASK_NOT_FOUND:
98
+ return [Finding("info", "probe-ok", f"endpoint {url} answers JSON-RPC and reports an"
99
+ " unknown task correctly (-32001)")]
100
+ if code == METHOD_NOT_FOUND:
101
+ return [Finding("warn", "probe-no-gettask", f"endpoint {url} does not implement GetTask,"
102
+ " which v1.0 requires")]
103
+ if "result" in answer:
104
+ return [Finding("warn", "probe-found-task", f"endpoint {url} returned a task for an id"
105
+ " that cannot exist")]
106
+ return [Finding("warn", "probe-odd-error", f"endpoint {url} answered GetTask with error {code}"
107
+ f" ({(answer.get('error') or {}).get('message', '')!s:.80}); expected -32001")]
108
+
109
+
110
+ def _rest_reason(answer) -> str | None:
111
+ """The ErrorInfo reason in a google.rpc.Status body, or None."""
112
+ if not isinstance(answer, dict) or not isinstance(answer.get("error"), dict):
113
+ return None
114
+ details = answer["error"].get("details")
115
+ for d in details if isinstance(details, list) else []:
116
+ if isinstance(d, dict) and d.get("@type") == ERROR_INFO_TYPE:
117
+ return d.get("reason")
118
+ return None
119
+
120
+
121
+ def _probe_rest(iface: dict, fetcher) -> list[Finding]:
122
+ base, version = iface["url"].rstrip("/"), iface.get("protocolVersion") or ""
123
+ tenant = iface.get("tenant") or ""
124
+ path = (f"/{quote(tenant, safe='')}" if tenant else "") + f"/tasks/{_task_id()}"
125
+ url = base + path
126
+ try:
127
+ r = fetcher(url, method="GET", headers={"Accept": "application/json",
128
+ "A2A-Version": version})
129
+ except FetchRefused as e:
130
+ return [Finding("fail", "probe-unreachable", f"endpoint {base}: {e}")]
131
+ try:
132
+ answer = json.loads(r.body) if r.body else None
133
+ except ValueError:
134
+ answer = None
135
+ reason = _rest_reason(answer)
136
+ if r.status == 404 and reason == REST_TASK_NOT_FOUND:
137
+ return [Finding("info", "probe-ok", f"endpoint {base} answers HTTP+JSON and reports an"
138
+ " unknown task correctly (404, TASK_NOT_FOUND)")]
139
+ if r.status == 404:
140
+ return [Finding("warn", "probe-bare-404", f"endpoint {base} answered GET .../tasks/{{id}}"
141
+ " with 404 but no TASK_NOT_FOUND error body, so a client cannot tell a"
142
+ " missing task from a missing route")]
143
+ if r.status == 200:
144
+ return [Finding("warn", "probe-found-task", f"endpoint {base} returned 200 for a task id"
145
+ " that cannot exist")]
146
+ if r.status in (401, 403):
147
+ return [Finding("info", "probe-auth", f"endpoint {base} requires authentication"
148
+ f" (HTTP {r.status}); not probed further")]
149
+ if r.status == 405:
150
+ return [Finding("warn", "probe-no-gettask", f"endpoint {base} does not allow GET on"
151
+ " /tasks/{id}, which v1.0 requires")]
152
+ detail = f" ({reason})" if reason else ""
153
+ return [Finding("warn", "probe-odd-error", f"endpoint {base} answered GET .../tasks/{{id}}"
154
+ f" with HTTP {r.status}{detail}; expected 404 with TASK_NOT_FOUND")]
155
+
156
+
157
+ PROBES = {"JSONRPC": _probe_jsonrpc, "HTTP+JSON": _probe_rest}
158
+
159
+
160
+ def check(target: str, *, probe: bool = False, fetcher=fetch) -> Report:
161
+ url = card_url_for(target)
162
+ report = Report(domain=target, card_url=url)
163
+ try:
164
+ r = fetcher(url)
165
+ except FetchRefused as e:
166
+ report.findings.append(Finding("fail", "unreachable", str(e)))
167
+ return report
168
+ if r.redirects:
169
+ report.findings.append(Finding("warn", "redirected",
170
+ f"the card is only reachable through {len(r.redirects)} redirect(s); it is served at {r.url}"))
171
+ if r.status == 404:
172
+ report.findings.append(Finding("fail", "no-card", f"no Agent Card at {url} (HTTP 404)"))
173
+ return report
174
+ if r.status != 200:
175
+ report.findings.append(Finding("fail", "http-status", f"{url} answered HTTP {r.status}"))
176
+ return report
177
+ ctype = r.headers.get("content-type", "")
178
+ if "json" not in ctype:
179
+ report.findings.append(Finding("warn", "content-type",
180
+ f"served as {ctype or 'no content type'}, not application/json"))
181
+ try:
182
+ report.card = json.loads(r.body)
183
+ except ValueError as e:
184
+ report.findings.append(Finding("fail", "not-json", f"the card is not valid JSON ({e})"))
185
+ return report
186
+ report.findings += cardmod.validate(report.card, r.url)
187
+ if isinstance(report.card, dict):
188
+ report.findings += signatures.verify(report.card, r.url, fetcher)
189
+ if probe and isinstance(report.card, dict):
190
+ ifaces = [i for i in report.card.get("supportedInterfaces") or []
191
+ if isinstance(i, dict) and isinstance(i.get("url"), str)
192
+ and i.get("protocolBinding") in PROBED]
193
+ if not ifaces:
194
+ report.findings.append(Finding("info", "probe-skipped",
195
+ "no JSONRPC or HTTP+JSON interface to probe"))
196
+ card_host = (urlsplit(r.url).hostname or "").lower()
197
+ for iface in ifaces:
198
+ # A card can name any URL as its endpoint, so probing it blindly
199
+ # would let whoever writes a card make this checker POST to a
200
+ # third party. Only the card's own host is probed.
201
+ if (urlsplit(iface["url"]).hostname or "").lower() != card_host:
202
+ report.findings.append(Finding("info", "probe-skipped",
203
+ f"not probing {iface['url']}: it is not on {card_host}"))
204
+ continue
205
+ report.findings += PROBES[iface["protocolBinding"]](iface, fetcher)
206
+ return report
@@ -0,0 +1,54 @@
1
+ """a2a-check DOMAIN [DOMAIN ...] [--probe] [--json]
2
+ a2a-check --schema
3
+
4
+ Exit status: 0 if every domain passes or only warns, 1 if any fails,
5
+ 2 for a usage error.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import argparse
10
+ import json
11
+ import sys
12
+
13
+ from .check import check
14
+
15
+ def schema_text() -> str:
16
+ from importlib.resources import files
17
+ return files("a2a_agent_checker").joinpath("report.schema.json").read_text()
18
+
19
+
20
+ MARK = {"fail": "FAIL", "warn": "warn", "info": "info"}
21
+
22
+
23
+ def main(argv=None) -> int:
24
+ p = argparse.ArgumentParser(prog="a2a-check",
25
+ description="Check a domain's A2A Agent Card against v1.0.")
26
+ p.add_argument("targets", nargs="*", help="a domain (example.com) or a full card URL")
27
+ p.add_argument("--probe", action="store_true",
28
+ help="also call GetTask for a random id on each JSONRPC endpoint (read-only)")
29
+ p.add_argument("--json", action="store_true", help="print JSON instead of text")
30
+ p.add_argument("--schema", action="store_true",
31
+ help="print the JSON Schema of the --json output and exit")
32
+ args = p.parse_args(argv)
33
+ if args.schema:
34
+ print(schema_text())
35
+ return 0
36
+ if not args.targets:
37
+ p.error("give at least one domain or card URL")
38
+
39
+ reports = [check(t, probe=args.probe) for t in args.targets]
40
+ if args.json:
41
+ print(json.dumps([r.as_dict() for r in reports], indent=2))
42
+ else:
43
+ for r in reports:
44
+ name = (r.card or {}).get("name") if isinstance(r.card, dict) else None
45
+ print(f"{r.domain}: {r.verdict.upper()}" + (f" ({name})" if name else ""))
46
+ print(f" {r.card_url}")
47
+ for f in r.findings:
48
+ print(f" {MARK[f.level]:4} {f.message}")
49
+ print()
50
+ return 1 if any(r.verdict == "fail" for r in reports) else 0
51
+
52
+
53
+ if __name__ == "__main__":
54
+ sys.exit(main())
@@ -0,0 +1,143 @@
1
+ """Fetching a URL somebody else typed in, safely.
2
+
3
+ The checker is meant to run behind a public web page, so every address it is
4
+ handed is untrusted. Three rules, all enforced here rather than by the caller:
5
+
6
+ * **HTTPS only**, on the default port. An Agent Card on plain HTTP is a
7
+ finding, not something to fetch.
8
+ * **Public addresses only, checked on the address actually connected to.**
9
+ The host is resolved once, every result must be a public unicast address,
10
+ and the connection goes to that resolved IP with the original name kept for
11
+ SNI and certificate checks. Checking a name and then letting the HTTP client
12
+ resolve it again is the DNS-rebinding hole: the second answer can be
13
+ 127.0.0.1.
14
+ * **Bounded**: a timeout per request, a byte cap read in a stream, and
15
+ redirects followed by hand (each hop re-checked) up to a small limit.
16
+ """
17
+ from __future__ import annotations
18
+
19
+ import ipaddress
20
+ import socket
21
+ from dataclasses import dataclass, field
22
+ from urllib.parse import urljoin, urlsplit
23
+
24
+ import httpx
25
+
26
+ TIMEOUT_S = 10.0
27
+ MAX_BYTES = 256 * 1024
28
+ MAX_REDIRECTS = 3
29
+ USER_AGENT = "a2a-agent-checker/0.4.0 (+https://github.com/vix-io/a2a-agent-checker)"
30
+
31
+
32
+ class FetchRefused(Exception):
33
+ """The URL was not fetched because a safety rule refused it."""
34
+
35
+
36
+ @dataclass
37
+ class Response:
38
+ url: str
39
+ status: int
40
+ headers: dict[str, str]
41
+ body: bytes
42
+ redirects: list[str] = field(default_factory=list)
43
+
44
+
45
+ def _public_ips(host: str, resolver=socket.getaddrinfo) -> list[str]:
46
+ try:
47
+ infos = resolver(host, 443, type=socket.SOCK_STREAM)
48
+ except socket.gaierror as e:
49
+ raise FetchRefused(f"{host} does not resolve ({e})") from None
50
+ # IPv4 first: a host with both is reachable over v4 from almost anywhere,
51
+ # and a machine with no IPv6 route fails a v6-first connect outright.
52
+ ips = sorted({info[4][0] for info in infos}, key=lambda ip: (":" in ip, ip))
53
+ if not ips:
54
+ raise FetchRefused(f"{host} does not resolve")
55
+ for ip in ips:
56
+ addr = ipaddress.ip_address(ip.split("%")[0])
57
+ # Every address must be public: a name answering with one public and
58
+ # one private address is exactly the shape a rebinding attack takes.
59
+ if not addr.is_global or addr.is_multicast:
60
+ raise FetchRefused(f"{host} resolves to a non-public address ({ip})")
61
+ return ips
62
+
63
+
64
+ def check_url(url: str) -> tuple[str, str]:
65
+ """Return (host, path+query) for an acceptable URL, or raise FetchRefused."""
66
+ parts = urlsplit(url)
67
+ if parts.scheme != "https":
68
+ raise FetchRefused(f"only https:// is fetched, not {parts.scheme or 'no scheme'}")
69
+ if not parts.hostname:
70
+ raise FetchRefused("no host in URL")
71
+ if parts.port not in (None, 443):
72
+ raise FetchRefused(f"only the default https port is fetched, not {parts.port}")
73
+ if parts.username or parts.password:
74
+ raise FetchRefused("URLs carrying credentials are not fetched")
75
+ try:
76
+ ipaddress.ip_address(parts.hostname)
77
+ except ValueError:
78
+ pass
79
+ else:
80
+ raise FetchRefused("give a domain name, not an IP address")
81
+ path = parts.path or "/"
82
+ if parts.query:
83
+ path += "?" + parts.query
84
+ return parts.hostname.lower(), path
85
+
86
+
87
+ def _one(client: httpx.Client, method: str, url: str, *, headers, content,
88
+ resolver) -> Response:
89
+ host, path = check_url(url)
90
+ ips = _public_ips(host, resolver)
91
+ for n, ip in enumerate(ips):
92
+ target = f"https://{'[' + ip + ']' if ':' in ip else ip}{path}"
93
+ request = client.build_request(
94
+ method, target, content=content,
95
+ headers={"Host": host, "User-Agent": USER_AGENT, **(headers or {})},
96
+ extensions={"sni_hostname": host, "timeout": {
97
+ "connect": TIMEOUT_S, "read": TIMEOUT_S, "write": TIMEOUT_S, "pool": TIMEOUT_S}},
98
+ )
99
+ try:
100
+ response = client.send(request, stream=True)
101
+ break
102
+ except httpx.ConnectError:
103
+ # Only a failed connect moves on: nothing was sent, so trying the
104
+ # next of the host's own (already vetted) addresses is safe.
105
+ if n == len(ips) - 1:
106
+ raise
107
+ try:
108
+ body = bytearray()
109
+ for chunk in response.iter_bytes():
110
+ body += chunk
111
+ if len(body) > MAX_BYTES:
112
+ raise FetchRefused(f"response is larger than {MAX_BYTES // 1024} KB")
113
+ return Response(url, response.status_code,
114
+ {k.lower(): v for k, v in response.headers.items()}, bytes(body))
115
+ finally:
116
+ response.close()
117
+
118
+
119
+ def fetch(url: str, *, method: str = "GET", headers: dict | None = None,
120
+ content: bytes | None = None, client: httpx.Client | None = None,
121
+ resolver=socket.getaddrinfo) -> Response:
122
+ """Fetch `url` under the rules above. Redirects are followed only for GET."""
123
+ own = client is None
124
+ client = client or httpx.Client(follow_redirects=False, verify=True)
125
+ try:
126
+ seen: list[str] = []
127
+ current = url
128
+ while True:
129
+ response = _one(client, method, current, headers=headers,
130
+ content=content, resolver=resolver)
131
+ location = response.headers.get("location")
132
+ if method != "GET" or response.status not in (301, 302, 303, 307, 308) or not location:
133
+ response.redirects = seen
134
+ return response
135
+ if len(seen) >= MAX_REDIRECTS:
136
+ raise FetchRefused(f"more than {MAX_REDIRECTS} redirects")
137
+ seen.append(current)
138
+ current = urljoin(current, location)
139
+ except httpx.HTTPError as e:
140
+ raise FetchRefused(f"request failed: {type(e).__name__}: {e}") from None
141
+ finally:
142
+ if own:
143
+ client.close()
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/vix-io/a2a-agent-checker/blob/main/src/a2a_agent_checker/report.schema.json",
4
+ "title": "a2a-check --json output",
5
+ "description": "One report per target, in the order given. Finding codes are stable identifiers; new codes may be added in a minor release, so a consumer should treat an unknown code by its level.",
6
+ "type": "array",
7
+ "items": {
8
+ "type": "object",
9
+ "required": ["domain", "card_url", "verdict", "agent", "findings"],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "domain": {"type": "string", "description": "the target as given"},
13
+ "card_url": {"type": "string", "description": "the Agent Card URL that was fetched"},
14
+ "verdict": {"enum": ["pass", "warn", "fail"], "description": "fail if any finding fails, else warn if any warns, else pass"},
15
+ "agent": {"type": ["string", "null"], "description": "the card's name, or null when no card was read"},
16
+ "findings": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "object",
20
+ "required": ["level", "code", "message"],
21
+ "additionalProperties": false,
22
+ "properties": {
23
+ "level": {"enum": ["fail", "warn", "info"], "description": "fail: a v1.0 client cannot use the card; warn: usable but something will trip a client; info: true and not a fault"},
24
+ "code": {"type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"},
25
+ "message": {"type": "string"}
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,205 @@
1
+ """Verifying Agent Card signatures (A2A v1.0, section 8.4).
2
+
3
+ Each entry of `signatures` is a JWS (RFC 7515) over the card's RFC 8785
4
+ canonical form, with `signatures` itself excluded and empty repeated fields
5
+ omitted (8.4.1). The protected header names the key by `kid` and, optionally,
6
+ where to fetch it by `jku` (a JWKS). Every signature gets one of three
7
+ verdicts, and the line between them is the point:
8
+
9
+ * **valid** - the key was fetched and the signature checks out.
10
+ * **invalid** - the key was fetched and the signature does not match: the
11
+ card was changed after signing, or was signed over a different form.
12
+ * **unverifiable** - nothing could be checked: no `jku`, the JWKS could not
13
+ be read, no key with that `kid`, an algorithm this checker does not
14
+ implement, or `cryptography` not installed. Unverifiable is not invalid.
15
+
16
+ A valid signature says the card is unaltered since the holder of that key
17
+ signed it. When the JWKS sits on the card's own host it says nothing about
18
+ who that holder is; the finding says so rather than letting "valid" read as
19
+ an identity claim.
20
+
21
+ The JWKS is fetched through the same fetcher as the card, so it inherits
22
+ every safety rule (HTTPS, public addresses, size cap). One fetch per distinct
23
+ `jku` per check.
24
+ """
25
+ from __future__ import annotations
26
+
27
+ import base64
28
+ import json
29
+ from urllib.parse import urlsplit
30
+
31
+ from .card import Finding
32
+
33
+ try:
34
+ from cryptography.exceptions import InvalidSignature
35
+ from cryptography.hazmat.primitives import hashes
36
+ from cryptography.hazmat.primitives.asymmetric import ec, padding, rsa
37
+ from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
38
+ from cryptography.hazmat.primitives.asymmetric.utils import encode_dss_signature
39
+ HAVE_CRYPTO = True
40
+ except ImportError: # pragma: no cover - exercised by patching HAVE_CRYPTO
41
+ HAVE_CRYPTO = False
42
+
43
+ from .fetch import FetchRefused
44
+
45
+
46
+ def b64u_decode(text: str) -> bytes:
47
+ return base64.urlsafe_b64decode(text + "=" * (-len(text) % 4))
48
+
49
+
50
+ def b64u(data: bytes) -> str:
51
+ return base64.urlsafe_b64encode(data).rstrip(b"=").decode()
52
+
53
+
54
+ def _num(n) -> str:
55
+ # RFC 8785 numbers follow ECMAScript; an integral value has no fraction.
56
+ if isinstance(n, float) and n.is_integer() and abs(n) < 2 ** 53:
57
+ return str(int(n))
58
+ return json.dumps(n)
59
+
60
+
61
+ def jcs(value) -> str:
62
+ """RFC 8785: keys sorted by UTF-16 code unit, no insignificant whitespace,
63
+ strings escaped as `json.dumps` does (the same set JCS escapes)."""
64
+ if isinstance(value, dict):
65
+ items = sorted(value.items(), key=lambda kv: kv[0].encode("utf-16-be"))
66
+ return "{" + ",".join(json.dumps(k, ensure_ascii=False) + ":" + jcs(v)
67
+ for k, v in items) + "}"
68
+ if isinstance(value, list):
69
+ return "[" + ",".join(jcs(v) for v in value) + "]"
70
+ if isinstance(value, bool) or value is None or isinstance(value, str):
71
+ return json.dumps(value, ensure_ascii=False)
72
+ return _num(value)
73
+
74
+
75
+ def _drop_empty(value):
76
+ if isinstance(value, dict):
77
+ return {k: _drop_empty(v) for k, v in value.items() if v != [] and v != {}}
78
+ if isinstance(value, list):
79
+ return [_drop_empty(v) for v in value]
80
+ return value
81
+
82
+
83
+ def signing_payload(card: dict) -> bytes:
84
+ body = {k: v for k, v in card.items() if k != "signatures"}
85
+ return jcs(_drop_empty(body)).encode()
86
+
87
+
88
+ _HASH = {"256": "SHA256", "384": "SHA384", "512": "SHA512"}
89
+ _CURVE = {"ES256": ("P-256", 32), "ES384": ("P-384", 48), "ES512": ("P-521", 66)}
90
+ ALGORITHMS = ("EdDSA", "ES256", "ES384", "ES512", "RS256", "RS384", "RS512",
91
+ "PS256", "PS384", "PS512")
92
+
93
+
94
+ def _int(text: str) -> int:
95
+ return int.from_bytes(b64u_decode(text), "big")
96
+
97
+
98
+ def _verify(alg: str, jwk: dict, sig: bytes, data: bytes) -> None:
99
+ """Raise InvalidSignature, or ValueError for a key that does not fit."""
100
+ if alg == "EdDSA":
101
+ if jwk.get("kty") != "OKP" or jwk.get("crv") != "Ed25519":
102
+ raise ValueError("EdDSA needs an OKP Ed25519 key")
103
+ Ed25519PublicKey.from_public_bytes(b64u_decode(jwk["x"])).verify(sig, data)
104
+ elif alg in _CURVE:
105
+ crv, size = _CURVE[alg]
106
+ if jwk.get("kty") != "EC" or jwk.get("crv") != crv or len(sig) != 2 * size:
107
+ raise ValueError(f"{alg} needs an EC {crv} key and a {2 * size}-byte signature")
108
+ curve = {"P-256": ec.SECP256R1, "P-384": ec.SECP384R1, "P-521": ec.SECP521R1}[crv]()
109
+ key = ec.EllipticCurvePublicNumbers(_int(jwk["x"]), _int(jwk["y"]), curve).public_key()
110
+ der = encode_dss_signature(int.from_bytes(sig[:size], "big"),
111
+ int.from_bytes(sig[size:], "big"))
112
+ key.verify(der, data, ec.ECDSA(getattr(hashes, _HASH[alg[2:]])()))
113
+ else: # RS*/PS*
114
+ if jwk.get("kty") != "RSA":
115
+ raise ValueError(f"{alg} needs an RSA key")
116
+ key = rsa.RSAPublicNumbers(_int(jwk["e"]), _int(jwk["n"])).public_key()
117
+ h = getattr(hashes, _HASH[alg[2:]])()
118
+ pad = (padding.PKCS1v15() if alg.startswith("RS")
119
+ else padding.PSS(padding.MGF1(h), padding.PSS.DIGEST_LENGTH))
120
+ key.verify(sig, data, pad, h)
121
+
122
+
123
+ def verify(card: dict, card_url: str, fetcher) -> list[Finding]:
124
+ sigs = card.get("signatures")
125
+ if not sigs:
126
+ return []
127
+ out: list[Finding] = []
128
+ if not isinstance(sigs, list):
129
+ return [Finding("warn", "signature-malformed", "'signatures' is not a list")]
130
+ if not HAVE_CRYPTO:
131
+ return [Finding("info", "signature-unverifiable",
132
+ f"{len(sigs)} signature(s) present; install "
133
+ "a2a-agent-checker[signatures] to verify them")]
134
+ payload = b64u(signing_payload(card))
135
+ card_host = (urlsplit(card_url).hostname or "").lower()
136
+ jwks_cache: dict[str, list | str] = {}
137
+
138
+ def keys_at(jku: str):
139
+ if jku not in jwks_cache:
140
+ try:
141
+ r = fetcher(jku)
142
+ if r.status != 200:
143
+ jwks_cache[jku] = f"{jku} answered HTTP {r.status}"
144
+ else:
145
+ keys = json.loads(r.body).get("keys")
146
+ jwks_cache[jku] = keys if isinstance(keys, list) else f"{jku} has no 'keys' list"
147
+ except (FetchRefused, ValueError, AttributeError) as e:
148
+ jwks_cache[jku] = f"could not read {jku} ({e})"
149
+ return jwks_cache[jku]
150
+
151
+ for i, sig in enumerate(sigs, 1):
152
+ label = f"signature {i}"
153
+ if not (isinstance(sig, dict) and isinstance(sig.get("protected"), str)
154
+ and isinstance(sig.get("signature"), str)):
155
+ out.append(Finding("warn", "signature-malformed",
156
+ f"{label} needs string 'protected' and 'signature'"))
157
+ continue
158
+ try:
159
+ header = json.loads(b64u_decode(sig["protected"]))
160
+ raw_sig = b64u_decode(sig["signature"])
161
+ except ValueError:
162
+ out.append(Finding("warn", "signature-malformed",
163
+ f"{label}: 'protected' or 'signature' is not base64url JSON"))
164
+ continue
165
+ if not isinstance(header, dict):
166
+ out.append(Finding("warn", "signature-malformed", f"{label}: the header is not an object"))
167
+ continue
168
+ alg, kid, jku = header.get("alg"), header.get("kid"), header.get("jku")
169
+ label = f"signature {i} (kid {kid!r}, {alg})"
170
+
171
+ def unverifiable(why):
172
+ out.append(Finding("info", "signature-unverifiable", f"{label}: {why}"))
173
+
174
+ if alg not in ALGORITHMS:
175
+ unverifiable(f"algorithm {alg!r} is not one this checker verifies")
176
+ continue
177
+ if not kid:
178
+ out.append(Finding("warn", "signature-malformed", f"{label}: no 'kid' in the header (8.4.2)"))
179
+ if not isinstance(jku, str) or not jku.startswith("https://"):
180
+ unverifiable("no https 'jku' in the header, so there is no key to fetch")
181
+ continue
182
+ keys = keys_at(jku)
183
+ if isinstance(keys, str):
184
+ unverifiable(keys)
185
+ continue
186
+ jwk = next((k for k in keys if isinstance(k, dict) and k.get("kid") == kid), None)
187
+ if jwk is None:
188
+ unverifiable(f"{jku} lists no key with kid {kid!r}")
189
+ continue
190
+ try:
191
+ _verify(alg, jwk, raw_sig, f"{sig['protected']}.{payload}".encode())
192
+ except InvalidSignature:
193
+ out.append(Finding("warn", "signature-invalid",
194
+ f"{label} does not match this card: it was changed after "
195
+ "signing, or signed over a different canonical form"))
196
+ continue
197
+ except (ValueError, KeyError, TypeError) as e:
198
+ unverifiable(f"the key does not fit the algorithm ({e})")
199
+ continue
200
+ where = ((urlsplit(jku).hostname or "").lower())
201
+ note = ("the key is published on the card's own host, so this proves the card "
202
+ "is unaltered, not who signed it") if where == card_host else \
203
+ f"the key is published by {where}"
204
+ out.append(Finding("info", "signature-valid", f"{label} is valid; {note}"))
205
+ return out
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.4
2
+ Name: a2a-agent-checker
3
+ Version: 0.4.0
4
+ Summary: Check a domain's A2A Agent Card against the v1.0 specification.
5
+ Author: Viktor Lyaskov
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/vix-io/a2a-agent-checker
8
+ Project-URL: Online checker, https://stillopen.work/agents/check
9
+ Keywords: a2a,agent2agent,agent-card,ai-agents,validator
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Software Development :: Testing
13
+ Requires-Python: >=3.11
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: httpx>=0.27
17
+ Provides-Extra: signatures
18
+ Requires-Dist: cryptography>=42; extra == "signatures"
19
+ Dynamic: license-file
20
+
21
+ # a2a-agent-checker
22
+
23
+ [![test](https://github.com/vix-io/a2a-agent-checker/actions/workflows/test.yml/badge.svg)](https://github.com/vix-io/a2a-agent-checker/actions/workflows/test.yml)
24
+
25
+ Check a domain's [A2A](https://a2a-protocol.org) Agent Card against the v1.0
26
+ specification.
27
+
28
+ ```
29
+ $ a2a-check stillopen.work --probe
30
+ stillopen.work: PASS (StillOpen)
31
+ https://stillopen.work/.well-known/agent-card.json
32
+ info endpoint https://stillopen.work/api/v1/a2a answers JSON-RPC and reports an unknown task correctly (-32001)
33
+ ```
34
+
35
+ ## Install
36
+
37
+ ```
38
+ pip install a2a-agent-checker # card and endpoint checks
39
+ pip install "a2a-agent-checker[signatures]" # also verifies card signatures
40
+ ```
41
+
42
+ There is also an online version at https://stillopen.work/agents/check.
43
+
44
+ ## What it checks
45
+
46
+ - The card exists at `/.well-known/agent-card.json`, over HTTPS, as JSON.
47
+ - Every field v1.0 requires is present and the right type: `name`,
48
+ `description`, `supportedInterfaces`, `version`, `capabilities`,
49
+ `defaultInputModes`, `defaultOutputModes`, `skills`.
50
+ - Each interface is HTTPS, names a known binding (`JSONRPC`, `GRPC`,
51
+ `HTTP+JSON`) and a protocol version.
52
+ - Each skill has an `id`, `name`, `description` and `tags`; ids are unique.
53
+ - Common mistakes: a 0.3-era card (top-level `url`, `preferredTransport`),
54
+ snake_case keys, an endpoint on a different host from the card.
55
+
56
+ With `--probe` it also asks each endpoint on the card's own host for a task
57
+ that cannot exist (`GetTask` with a random id):
58
+
59
+ - **JSONRPC**: a conforming agent answers error `-32001` (TaskNotFound).
60
+ - **HTTP+JSON**: `GET {url}/tasks/{id}` (with the interface's `tenant`
61
+ prefixed when set); a conforming agent answers HTTP 404 with a
62
+ `google.rpc.Status` body whose `ErrorInfo.reason` is `TASK_NOT_FOUND`. A
63
+ bare 404 is reported as a warning, since it is also what a server returns
64
+ for a route that does not exist.
65
+ - **GRPC** is not probed.
66
+
67
+ This is the most harmless call A2A defines: nothing is created or run on the
68
+ other side. The checker never sends `SendMessage`, and never probes an
69
+ endpoint on a different host from the card.
70
+
71
+ Card signatures (spec 8.4) are verified when `cryptography` is installed
72
+ (`pip install "a2a-agent-checker[signatures]"`): the key is fetched from the
73
+ `jku` in each signature's header, and each signature is reported as valid,
74
+ invalid or unverifiable. EdDSA, ES256/384/512, RS256/384/512 and
75
+ PS256/384/512. A key published on the card's own host proves the card is
76
+ unaltered, not who signed it, and the finding says so.
77
+
78
+ Declared extensions (spec 4.6) are listed, and a declaration with no
79
+ absolute `uri`, or a non-boolean `required`, is a warning. A URI with no
80
+ version in its path is pointed out, since a breaking change then has no new
81
+ URI to move to.
82
+
83
+ ## Results
84
+
85
+ Each finding is `fail` (a v1.0 client cannot use the card), `warn` (usable,
86
+ but something will trip a client or a person) or `info`. The exit status is
87
+ 1 if any domain fails, otherwise 0. `--json` prints machine-readable output,
88
+ described by the JSON Schema that `a2a-check --schema` prints
89
+ (`src/a2a_agent_checker/report.schema.json`). Finding codes are stable
90
+ identifiers; new ones may appear in a minor release, so treat an unknown code
91
+ by its level.
92
+
93
+ ## Library
94
+
95
+ ```python
96
+ from a2a_agent_checker import check, validate
97
+
98
+ report = check("example.com", probe=True)
99
+ print(report.verdict, [f.message for f in report.findings])
100
+
101
+ findings = validate(card_dict, "https://example.com/.well-known/agent-card.json")
102
+ ```
103
+
104
+ ## Safe to run on untrusted input
105
+
106
+ The checker is built to sit behind a public web form, so every URL is
107
+ treated as hostile:
108
+
109
+ - HTTPS on port 443 only; no IP literals, no credentials in URLs.
110
+ - The name is resolved once, every address must be public, and the
111
+ connection goes to that checked address (the name is kept for TLS). This
112
+ closes the DNS-rebinding gap where a second lookup returns `127.0.0.1`.
113
+ - Redirects are followed by hand, each hop re-checked, at most 3.
114
+ - 10-second timeouts and a 256 KB response cap.
115
+
116
+ Rate-limiting visitors is the host application's job.
117
+
118
+ ## Licence
119
+
120
+ Apache 2.0.
@@ -0,0 +1,13 @@
1
+ a2a_agent_checker/__init__.py,sha256=7ZbClS8SkHH7_dw3Y-9WOaTa8IvyfaisMyUPuPskPdI,207
2
+ a2a_agent_checker/card.py,sha256=zAUXHu4Y5QASrd2vacMbNvqNK5JIa7fozXskUvYzOks,8286
3
+ a2a_agent_checker/check.py,sha256=XDXfrig7xgPdydoiUmX1C9fsg7twNnpUCWzLxr5zfwU,9671
4
+ a2a_agent_checker/cli.py,sha256=jq_8FGxJXoCfu-5LZ0AWzRrS8Pm4bl-wjTTStMB-UWA,1905
5
+ a2a_agent_checker/fetch.py,sha256=W-ai2LIIATiVbJvIjAWDbnO0mjQNAWKaGVhYy0I1Wts,5780
6
+ a2a_agent_checker/report.schema.json,sha256=OeEvjpDTiye4up2NNh_nix_3AJqsSH4MTA8g8aT8Os8,1562
7
+ a2a_agent_checker/signatures.py,sha256=I78kwGjxObVji82c5njv0sPxMWj0A52VhEP91NPJk_c,9153
8
+ a2a_agent_checker-0.4.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
9
+ a2a_agent_checker-0.4.0.dist-info/METADATA,sha256=nLecNOAAVTZWeVwCTPBMpB3qi6wLUNC5IlRQZIOHkEg,4835
10
+ a2a_agent_checker-0.4.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
11
+ a2a_agent_checker-0.4.0.dist-info/entry_points.txt,sha256=t-Zg0O5jiKgtBQvvHtFlGenMKO5reV6UdkkJo-eZ3Ow,57
12
+ a2a_agent_checker-0.4.0.dist-info/top_level.txt,sha256=48yaRzhfB2X-W7O_HA5teKUh9B4lNGSLwvAZe76f0uo,18
13
+ a2a_agent_checker-0.4.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ a2a-check = a2a_agent_checker.cli:main
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1 @@
1
+ a2a_agent_checker