a2a-rails 0.3.0 → 0.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -1
- data/README.md +153 -86
- data/app/controllers/a2a/rails/requests_controller.rb +37 -6
- data/lib/a2a/rails/client.rb +2 -1
- data/lib/a2a/rails/configuration.rb +8 -4
- data/lib/a2a/rails/dispatcher.rb +13 -0
- data/lib/a2a/rails/errors.rb +14 -0
- data/lib/a2a/rails/input_required.rb +50 -0
- data/lib/a2a/rails/protocol/agent2agent_adapter.rb +23 -2
- data/lib/a2a/rails/protocol/part_data.rb +89 -0
- data/lib/a2a/rails/protocol/request_handler.rb +115 -36
- data/lib/a2a/rails/protocol/task_mapper.rb +16 -5
- data/lib/a2a/rails/skill.rb +2 -0
- data/lib/a2a/rails/task/active_record_store.rb +96 -12
- data/lib/a2a/rails/task/lifecycle.rb +33 -12
- data/lib/a2a/rails/task/memory_store.rb +42 -6
- data/lib/a2a/rails/task/store.rb +77 -0
- data/lib/a2a/rails/task.rb +1 -1
- data/lib/a2a/rails/task_execution_arguments.rb +8 -3
- data/lib/a2a/rails/task_execution_job.rb +47 -12
- data/lib/a2a/rails/version.rb +1 -1
- data/lib/a2a-rails.rb +1 -0
- data/lib/generators/a2a/rails/task_continuation_generator.rb +25 -0
- data/lib/generators/a2a/rails/task_store_generator.rb +7 -0
- data/lib/generators/a2a/rails/templates/add_execution_to_a2a_rails_tasks.rb.tt +7 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 993ce769bed1adf194df40417b0cab2a8e1effe6a768d079d2bc50174d602f19
|
|
4
|
+
data.tar.gz: 4bf6a8d6cd821f91cc1ed6fdec80f82f609fe6bebdd3d43fe195213c7ac8dfc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6cd29f40af80464051ab232fb3404789d12511d26dacf758c73573fd5e0fb2e418dc22408175e9f8beb7c3fe329c76e61ce289cfab94e462677f0b6b4c2659dc
|
|
7
|
+
data.tar.gz: cdcb58cc19447f3a3054b070ff3da36507023dcff7b06111fcc2c07173ef626e2f65d767d5b010b70f551d87f42a5e99b4786de32c625422813b049c874d40df
|
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased — 0.5.0 stable preparation
|
|
4
|
+
|
|
5
|
+
- Explicit SDK-independent `InputRequired` Handler result and same-Task continuation,
|
|
6
|
+
stable Agent/Skill routing, question history and current-turn context.
|
|
7
|
+
- Atomic reply acceptance and per-turn Job/outcome fencing in both built-in Stores;
|
|
8
|
+
bounded messageId deduplication and additive durable execution metadata.
|
|
9
|
+
- Upgrade/recovery guide, SDK boundary review policy and real multi-turn validation.
|
|
10
|
+
- Request-local Rails log redaction for A2A parameter bodies, including denied requests,
|
|
11
|
+
without changing host filter settings or real input.
|
|
12
|
+
- Not yet published. See [stable preparation](docs/release/v0.5.0-preparation.md)
|
|
13
|
+
for the approval gates and exact-artifact release procedure.
|
|
14
|
+
|
|
3
15
|
All notable changes to this project will be documented in this file.
|
|
4
16
|
|
|
5
17
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
18
|
|
|
7
|
-
## [0.
|
|
19
|
+
## [0.4.0] - 2026-11-15 (published stable release)
|
|
20
|
+
|
|
21
|
+
> [RubyGems a2a-rails 0.4.0](https://rubygems.org/gems/a2a-rails/versions/0.4.0) · [verified package and source provenance](docs/release/v0.4.0-publication-record.md).
|
|
22
|
+
|
|
23
|
+
- Add opt-in inbound JSON object Data Parts on Skills declaring
|
|
24
|
+
`application/json`; the input contract is enforced after Routing and before
|
|
25
|
+
Handler execution or Task admission.
|
|
26
|
+
- Preserve nested JSON nulls and exact application keys through SDK
|
|
27
|
+
serialization, Task history and results. No database migration or SDK
|
|
28
|
+
dependency change. Existing text, Task and direct Message flows remain.
|
|
29
|
+
- Keep Hash and Array Data output; the Rails Client now reads both. Object-only
|
|
30
|
+
is a Rails Server **input** restriction, not an output restriction.
|
|
31
|
+
- See the [structured Data guide](docs/guides/structured-data.md) for the
|
|
32
|
+
normalized MIME type, accepted values and rollout instructions.
|
|
33
|
+
|
|
34
|
+
## [0.3.0] - 2026-10-10 (published stable release)
|
|
35
|
+
|
|
36
|
+
> **Published after explicit maintainer GO.** [GitHub Release v0.3.0](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0) · [RubyGems a2a-rails 0.3.0](https://rubygems.org/gems/a2a-rails/versions/0.3.0). Immutable annotated tag targets commit `772f63fc814123f39b40bafd7403f3ef9a59788e`; the Gem SHA256 is `90a7d8d32bdd19ebc97046a3307c483cc0798b06afcd79df4931cfc5a4ead40f`. Exact final-main CI **49/49 jobs passed**. Gem uploaded without rebuilding; original RubyGems package was fetched and matched. [Step 31-6 publication record](docs/release/v0.3.0-publication-record.md).
|
|
8
37
|
|
|
9
38
|
`0.3.0` advances the outbound A2A Client tested in `0.3.0.rc1` while retaining the existing Rails A2A Server default. [Release verification record](docs/release/v0.3.0-stable-candidate-record.md) and [Step 31 tracking issue](https://github.com/cuichangquan/a2a-rails/issues/120) contain the dated CI/provenance history. Consult [GitHub Releases](https://github.com/cuichangquan/a2a-rails/releases) or [RubyGems versions](https://rubygems.org/gems/a2a-rails/versions) for actual publication status; source versions and CI artifacts alone are not public releases.
|
|
10
39
|
|
data/README.md
CHANGED
|
@@ -1,81 +1,24 @@
|
|
|
1
1
|
# a2a-rails
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<img src="docs/assets/a2a-rails-infographics.png">
|
|
5
|
-
<br/>
|
|
6
|
-
<br/>
|
|
7
|
-
<img src="docs/assets/a2a-rails-infographics-en.png">
|
|
3
|
+
Rails-native A2A v1.0 integration: expose Rails business logic as an Agent, call remote Agents, or do both. Application handlers use Ruby Hashes rather than SDK request objects.
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
> **Latest stable release (2026-11-15): [a2a-rails 0.4.0 is published on RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.4.0).** It adds opt-in JSON object input for Rails Skills while keeping existing text and outbound Client flows. See the [Data guide](docs/guides/structured-data.md) and [publication & SHA-256 record](docs/release/v0.4.0-publication-record.md). **Gem publication is not approval to run an anonymous/public production Agent; deployment #11 remains separate.**
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
## Choose your starting point
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
| Goal | Setup | Next step |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Expose a Rails Agent | Server enabled by default | [Server Quick Start](#server-quick-start-local-development) |
|
|
12
|
+
| Call an external Agent only | Set `server_enabled = false`; no Agent scaffold | [Client-only Quick Start](#client-only-quick-start) |
|
|
13
|
+
| Serve and call Agents | Keep Server enabled and construct a Client | Server setup plus [Client guide](docs/guides/outbound-a2a-client.md) |
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
- Published version list: https://rubygems.org/gems/a2a-rails/versions
|
|
17
|
-
- Earlier stable release `0.2.0`: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.2.0
|
|
18
|
-
- Previous stable release: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.1.0
|
|
19
|
-
- Changelog: [CHANGELOG.md](CHANGELOG.md)
|
|
20
|
-
- Release record: [v0.2.0 publication record](docs/release/v0.2.0-publication-record.md)
|
|
21
|
-
- **Security policy / 脆弱性報告:** [SECURITY.md](SECURITY.md) — confidential vulnerability reporting, current assurance boundaries and production responsibilities.
|
|
22
|
-
- **v0.3.x prerelease policy:** [Risk-based release gates](docs/release/step-29-5u-risk-based-oss-release-policy.md) — independently commissioned external audit is **recommended but optional**, not a known vulnerability or RubyGems requirement. Technical security checks, no known unresolved Critical/High findings, exact Gem provenance and explicit maintainer release approval remain mandatory; [optional community review #113](https://github.com/cuichangquan/a2a-rails/issues/113). **Check the published-version list for the current stable version; package publication and public-production deployment are separate decisions.**
|
|
23
|
-
- **Release evidence & upgrading:** [Step 31 release-readiness record](docs/release/v0.3.0-stable-readiness.md) · [RC1 feedback snapshot](docs/release/v0.3.0-rc1-feedback-and-upgrade-readiness.md) · [v0.2.0 → v0.3.0 upgrade guide](docs/release/upgrading-v0.2.0-to-v0.3.md) · [v0.1.0 → v0.2.0 guide](docs/release/upgrading-v0.1.0-to-v0.2.md). Check [RubyGems](https://rubygems.org/gems/a2a-rails/versions) for availability. Gem distribution does **not** authorize public Agent exposure.
|
|
24
|
-
- **Roadmap / 次にやること:** [ROADMAP.md](ROADMAP.md) · [Step 31 / Issue #120](https://github.com/cuichangquan/a2a-rails/issues/120) for the `0.3.0` release-evaluation and publication decisions. [Issue #11](https://github.com/cuichangquan/a2a-rails/issues/11) still governs public-production deployment; the [historical `0.2.0` release record](docs/release/v0.2.0-stable-readiness.md) is separate.
|
|
25
|
-
- **Official A2A TCK results:** [Pinned JSON-RPC MUST report and reproduction](docs/testing/official-a2a-tck.md) — after Step 17-4: **63 passed / 1 failed / 171 skipped / 30 deselected** (pytest). The remaining `CORE-SEND-003` mismatch is tracked [upstream in #202](https://github.com/a2aproject/a2a-tck/issues/202). The TCK workflow is informational, **not** an A2A conformance certificate.
|
|
15
|
+
The current stable line includes the outbound Client (0.3.0), optional ActiveRecord Task storage and ActiveJob execution (since 0.2.0). Execution is synchronous and Task storage is process-local by default. Streaming, push notifications and gRPC are unsupported.
|
|
26
16
|
|
|
27
|
-
|
|
28
|
-
- [A2A at a glance (English, A4 one-page PDF)](docs/guides/a2a-protocol-overview-en.pdf) — Roles, workflow, key terms, and how MCP fits.
|
|
17
|
+
## Host and security responsibilities
|
|
29
18
|
|
|
30
|
-
|
|
19
|
+
The Server Quick Start is for local development/test. Outside those environments, the Server fails closed without a host authenticator. The host must supply credential verification, business authorization, TLS/proxy restrictions, rate limits and execution budgets. Multi-worker Task access needs a shared durable Task store; async production execution also needs a durable queue. See [authentication](docs/guides/authentication.md), [production security](docs/guides/production-security.md) and [SECURITY.md](SECURITY.md).
|
|
31
20
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Run a complete standalone Rails Agent using the **published RubyGems `a2a-rails = 0.2.0`** (not a Git source checkout). The separate Demo covers Agent Card discovery, JSON-RPC v1.0 SendMessage **Task and direct Message**, GetTask, ListTasks and error handling.
|
|
35
|
-
|
|
36
|
-
- [Demo Quick Start, code and example curl requests](https://github.com/cuichangquan/a2a-rails-demo#quick-start).
|
|
37
|
-
- [Demo GitHub Actions smoke](https://github.com/cuichangquan/a2a-rails-demo/actions/workflows/smoke.yml) — independent Rails 8.1.0 / Ruby 3.4.10 HTTP smoke **16/16 checks passed** against published Gem `0.2.0` ([Step 28 Demo PR #2, merged](https://github.com/cuichangquan/a2a-rails-demo/pull/2), [passing PR CI](https://github.com/cuichangquan/a2a-rails-demo/actions/runs/37736426834)). The CI also confirms `A2A::Rails::VERSION == "0.2.0"`, RubyGems as the dependency source, and the demo's production-startup refusal.
|
|
38
|
-
- **Local-only development/test** demo: no trusted verifier or durable Task store, **not** an internet-facing production template. See [production security](docs/guides/production-security.md).
|
|
39
|
-
|
|
40
|
-
### Outbound Client-only Rails Demo / 外部A2A Agentを呼び出すサンプル
|
|
41
|
-
|
|
42
|
-
**[a2a-rails-client-demo — standalone Rails 8 Client](https://github.com/cuichangquan/a2a-rails-client-demo)**
|
|
43
|
-
|
|
44
|
-
Independent Rails application using **published RubyGems `a2a-rails = 0.3.0.rc1`** with `server_enabled = false`. Demonstrates Agent Card discovery, SendMessage **Task or direct Message**, GetTask and ListTasks with exact HTTPS origin allowlisting. [Client-only CI PASS](https://github.com/cuichangquan/a2a-rails-client-demo/actions/runs/38048228531) and [independent Rails-to-Rails pinned-TLS CI PASS](https://github.com/cuichangquan/a2a-rails-client-demo/actions/runs/38048228488): the published RC1 Client calls an independently installed **published 0.2.0 Server** over real TLS using a **loopback-only test bridge and test-only pinned policy override**, including actual Echo business logic. This is **not** a public-DNS/public-CA, no-injection or production deployment test. The existing Server demo and shipped security policy remain unchanged; see [Step 30 #117](https://github.com/cuichangquan/a2a-rails/issues/117).
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## What is a2a-rails?
|
|
48
|
-
|
|
49
|
-
`a2a-rails` lets a Rails application expose an A2A-compatible Agent without making application code depend directly on SDK-specific request and response objects.
|
|
50
|
-
|
|
51
|
-
```text
|
|
52
|
-
A2A Protocol
|
|
53
|
-
↓
|
|
54
|
-
Ruby A2A SDK
|
|
55
|
-
↓
|
|
56
|
-
a2a-rails
|
|
57
|
-
↓
|
|
58
|
-
Rails Application
|
|
59
|
-
↓
|
|
60
|
-
Business Logic
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
The Gem provides:
|
|
64
|
-
|
|
65
|
-
- a Rails-native Agent / Skill DSL;
|
|
66
|
-
- A2A Agent Card generation;
|
|
67
|
-
- automatically mounted A2A HTTP endpoints;
|
|
68
|
-
- synchronous Task execution by default, plus opt-in ActiveJob-backed async Task execution in published `0.2.0`;
|
|
69
|
-
- SDK-independent Handler inputs;
|
|
70
|
-
- a process-local MemoryStore by default, plus an optional durable ActiveRecordStore in `0.2.0`;
|
|
71
|
-
- Rails generators for initial setup;
|
|
72
|
-
- an internal Protocol Adapter boundary around the upstream SDK;
|
|
73
|
-
- **in 0.3.x**, a Rails outbound `A2A::Rails::Client` with strict HTTPS Agent Card discovery, A2A v1.0 JSON-RPC communication and optional Client-only mode.
|
|
74
|
-
|
|
75
|
-
v0.1 is intentionally **server-first** and **non-streaming**.
|
|
76
|
-
|
|
77
|
-
> [!WARNING]
|
|
78
|
-
> **Versioned security note:** The original **v0.1.0** did not implement per-caller Task authorization. **0.2.0 and the subsequent 0.3.x line** include a host-owned authentication hook, principal-scoped Task operations and fail-closed non-development/test behavior. **Neither version supplies your identity provider or business authorization, and publication does not approve an anonymously exposed production endpoint.** See [SECURITY.md](SECURITY.md), [authentication guide](docs/guides/authentication.md) and [deployment #11](https://github.com/cuichangquan/a2a-rails/issues/11).
|
|
21
|
+
The outbound Client requires explicitly approved HTTPS origins and public IPv4 destinations. The host supplies origin-scoped credentials, safe logging and reconciliation after ambiguous timeouts. Never weaken SSRF/TLS policy to connect this Client to the localhost Server example. See [Client security and limitations](docs/guides/outbound-a2a-client.md).
|
|
79
22
|
|
|
80
23
|
## Requirements
|
|
81
24
|
|
|
@@ -91,24 +34,53 @@ The original v0.1.0 baseline was verified against:
|
|
|
91
34
|
|
|
92
35
|
## Installation
|
|
93
36
|
|
|
94
|
-
|
|
37
|
+
In an existing Rails application, pin the published stable Gem:
|
|
95
38
|
|
|
96
39
|
```bash
|
|
97
|
-
bundle add a2a-rails
|
|
40
|
+
bundle add a2a-rails --version '= 0.4.0'
|
|
98
41
|
```
|
|
99
42
|
|
|
100
|
-
|
|
43
|
+
If you need a fresh app first (with a supported Rails installed):
|
|
101
44
|
|
|
102
45
|
```bash
|
|
103
|
-
|
|
104
|
-
|
|
46
|
+
rails new echo_app --minimal --skip-active-record
|
|
47
|
+
cd echo_app
|
|
48
|
+
bundle add a2a-rails --version '= 0.4.0'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Then choose Server or Client-only setup below. No explicit Engine mount is needed.
|
|
52
|
+
|
|
53
|
+
## Client-only Quick Start
|
|
54
|
+
|
|
55
|
+
Create `config/initializers/a2a_rails.rb` before booting Rails:
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
A2A::Rails.configure do |config|
|
|
59
|
+
config.server_enabled = false
|
|
60
|
+
end
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
No Agent or Handler is required; both inbound A2A paths remain unmounted. Restart Rails after changing this setting. In `bin/rails console`, construct a Client for an Agent you are authorized to call:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
client = A2A::Rails::Client.new(
|
|
67
|
+
agent_card_url: "https://your-agent.example/.well-known/agent-card.json",
|
|
68
|
+
allowed_origins: ["https://your-agent.example"]
|
|
69
|
+
)
|
|
70
|
+
card = client.agent_card
|
|
71
|
+
result = client.send_message(message: {
|
|
72
|
+
message_id: SecureRandom.uuid,
|
|
73
|
+
role: "ROLE_USER",
|
|
74
|
+
parts: [{ text: "Hello" }]
|
|
75
|
+
})
|
|
76
|
+
result.kind # => :task or :message
|
|
105
77
|
```
|
|
106
78
|
|
|
107
|
-
|
|
79
|
+
Replace the placeholder with a real approved HTTPS Agent. For an authenticated Agent, configure credential callbacks bound to the exact receiving origin; see the [Client guide](docs/guides/outbound-a2a-client.md) for credentials, Task operations, errors and timeout handling. See the [existing Client demo](https://github.com/cuichangquan/a2a-rails-client-demo) for isolated TLS verification.
|
|
108
80
|
|
|
109
|
-
## Quick Start
|
|
81
|
+
## Server Quick Start (local development)
|
|
110
82
|
|
|
111
|
-
|
|
83
|
+
Use the published `a2a-rails 0.4.0` Gem installed above in development. The Echo flow uses synchronous execution and MemoryStore; no database or queue is required. If you previously selected Client-only mode, remove `server_enabled = false` and restart Rails.
|
|
112
84
|
|
|
113
85
|
### 1. Generate the setup
|
|
114
86
|
|
|
@@ -189,7 +161,7 @@ The Agent class name remains a String until an A2A endpoint resolves it, preserv
|
|
|
189
161
|
Start Rails:
|
|
190
162
|
|
|
191
163
|
```bash
|
|
192
|
-
bin/rails server
|
|
164
|
+
bin/rails server -b 127.0.0.1
|
|
193
165
|
```
|
|
194
166
|
|
|
195
167
|
Then request the Agent Card:
|
|
@@ -233,7 +205,56 @@ result.task.status.state == TASK_STATE_COMPLETED
|
|
|
233
205
|
Artifact Text Part == "Echo: Hello"
|
|
234
206
|
```
|
|
235
207
|
|
|
236
|
-
See [
|
|
208
|
+
See the [historical v0.1 Quick Start design](docs/design/quick-start.md) for the original generator contract. For a complete working app, use the [existing Rails demo](https://github.com/cuichangquan/a2a-rails-demo).
|
|
209
|
+
|
|
210
|
+
## Runnable Rails Demo / 実際に動くサンプル ⭐
|
|
211
|
+
|
|
212
|
+
**[a2a-rails-demo — independent Rails 8 Echo Agent](https://github.com/cuichangquan/a2a-rails-demo)**
|
|
213
|
+
|
|
214
|
+
Run a complete standalone Rails Agent using the published RubyGems package (not a Git source checkout). See the demo README for its exact pin. The separate Demo covers Agent Card discovery, JSON-RPC v1.0 SendMessage **Task and direct Message**, GetTask, ListTasks and error handling.
|
|
215
|
+
|
|
216
|
+
- [Demo Quick Start, code and example curl requests](https://github.com/cuichangquan/a2a-rails-demo#quick-start).
|
|
217
|
+
- [Demo GitHub Actions smoke](https://github.com/cuichangquan/a2a-rails-demo/actions/workflows/smoke.yml) — independent Rails 8.1.4 / Ruby 3.4.10 HTTP smoke against published stable Gem `0.3.0` ([Step 32 Server PR #3, merged](https://github.com/cuichangquan/a2a-rails-demo/pull/3), [passing CI](https://github.com/cuichangquan/a2a-rails-demo/actions/runs/38097407649)). Verifies the actual published Gem and dependency versions, Task/direct Message/GetTask/ListTasks/CancelTask and refusal to boot in production. The historical [Step 28 v0.2.0 smoke](https://github.com/cuichangquan/a2a-rails-demo/actions/runs/37736426834) is preserved separately.
|
|
218
|
+
- **Local-only development/test** demo: no trusted verifier or durable Task store, **not** an internet-facing production template. See [production security](docs/guides/production-security.md).
|
|
219
|
+
|
|
220
|
+
### Outbound Client-only Rails Demo / 外部A2A Agentを呼び出すサンプル
|
|
221
|
+
|
|
222
|
+
**[a2a-rails-client-demo — standalone Rails 8 Client](https://github.com/cuichangquan/a2a-rails-client-demo)**
|
|
223
|
+
|
|
224
|
+
Independent Client-only Rails application with `server_enabled = false`. See the demo README for its exact RubyGems pin. It discovers Agent Cards and calls SendMessage (Task/direct Message), GetTask and ListTasks using exact HTTPS origin allowlisting. [Stable Client CI PASS](https://github.com/cuichangquan/a2a-rails-client-demo/actions/runs/38097502077) and [independent Rails-to-Rails pinned-TLS CI PASS](https://github.com/cuichangquan/a2a-rails-client-demo/actions/runs/38097502218) use **published stable 0.3.0 on both Rails sides** and actual Server Echo business logic ([Step 32 Client PR #3](https://github.com/cuichangquan/a2a-rails-client-demo/pull/3)). The loopback-only bridge uses an ephemeral test CA and isolated test-only policy override; production Client SSRF/TLS protections are not relaxed. This is **not** a direct public-DNS/public-CA or production deployment test. Historical RC1 Client ↔ 0.2.0 Server evidence remains [in Step 30](https://github.com/cuichangquan/a2a-rails/issues/117).
|
|
225
|
+
|
|
226
|
+
## What is a2a-rails?
|
|
227
|
+
|
|
228
|
+
`a2a-rails` provides inbound Server and outbound Client APIs for Rails applications.
|
|
229
|
+
|
|
230
|
+
```text
|
|
231
|
+
A2A Protocol
|
|
232
|
+
↓
|
|
233
|
+
Ruby A2A SDK
|
|
234
|
+
↓
|
|
235
|
+
a2a-rails
|
|
236
|
+
↓
|
|
237
|
+
Rails Application
|
|
238
|
+
↓
|
|
239
|
+
Business Logic
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The Gem provides:
|
|
243
|
+
|
|
244
|
+
- a Rails-native Agent / Skill DSL;
|
|
245
|
+
- A2A Agent Card generation;
|
|
246
|
+
- automatically mounted A2A HTTP endpoints;
|
|
247
|
+
- synchronous Task execution by default, plus opt-in ActiveJob-backed async Task execution in published `0.2.0`;
|
|
248
|
+
- SDK-independent Handler inputs;
|
|
249
|
+
- a process-local MemoryStore by default, plus an optional durable ActiveRecordStore in `0.2.0`;
|
|
250
|
+
- Rails generators for initial setup;
|
|
251
|
+
- an internal Protocol Adapter boundary around the upstream SDK;
|
|
252
|
+
- **in 0.3.x**, a Rails outbound `A2A::Rails::Client` with strict HTTPS Agent Card discovery, A2A v1.0 JSON-RPC communication and optional Client-only mode.
|
|
253
|
+
|
|
254
|
+
The current release supports Server and Client use and remains **non-streaming**.
|
|
255
|
+
|
|
256
|
+
> [!WARNING]
|
|
257
|
+
> **Versioned security note:** The original **v0.1.0** did not implement per-caller Task authorization. **0.2.0 and the subsequent 0.3.x line** include a host-owned authentication hook, principal-scoped Task operations and fail-closed non-development/test behavior. **Neither version supplies your identity provider or business authorization, and publication does not approve an anonymously exposed production endpoint.** See [SECURITY.md](SECURITY.md), [authentication guide](docs/guides/authentication.md) and [deployment #11](https://github.com/cuichangquan/a2a-rails/issues/11).
|
|
237
258
|
|
|
238
259
|
## Public Rails API
|
|
239
260
|
|
|
@@ -277,7 +298,7 @@ For multiple Skills, the application supplies a Router. The Router receives `ski
|
|
|
277
298
|
|
|
278
299
|
## HTTP Endpoints
|
|
279
300
|
|
|
280
|
-
|
|
301
|
+
With Server enabled (the default), the Gem automatically exposes:
|
|
281
302
|
|
|
282
303
|
```text
|
|
283
304
|
GET /.well-known/agent-card.json
|
|
@@ -307,7 +328,6 @@ Rate limiting, application-specific authorization and production deployment safe
|
|
|
307
328
|
|
|
308
329
|
Do **not** interpret successful source-tree CI or a merge to `main` as publication of a new RubyGems release.
|
|
309
330
|
|
|
310
|
-
|
|
311
331
|
## Agent Card
|
|
312
332
|
|
|
313
333
|
Agent Cards are generated from the Agent / Skill DSL.
|
|
@@ -322,6 +342,17 @@ Behavior in v0.1:
|
|
|
322
342
|
- Streaming, Push Notifications, and Extended Agent Cards are disabled;
|
|
323
343
|
- generated Cards pass the `agent2agent 2.0.0` Agent Card schema.
|
|
324
344
|
|
|
345
|
+
### Structured Data input (since 0.4.0)
|
|
346
|
+
|
|
347
|
+
Declare `input_modes: ["application/json"]` on each Skill that accepts Data.
|
|
348
|
+
The selected Skill receives a normal Ruby Hash containing the JSON object, with
|
|
349
|
+
its original string keys and nested values intact. A Router selects a Skill
|
|
350
|
+
before this opt-in is checked; sending Data alone does not select a Skill
|
|
351
|
+
automatically. Legacy text-only handlers do not receive Data. See the
|
|
352
|
+
[structured Data guide](docs/guides/structured-data.md) for a complete Handler,
|
|
353
|
+
Client call, storage behavior and limits. Published 0.3.0 does not accept
|
|
354
|
+
inbound Data.
|
|
355
|
+
|
|
325
356
|
## Task Lifecycle
|
|
326
357
|
|
|
327
358
|
Internally, `a2a-rails` keeps SDK-independent Task states:
|
|
@@ -430,7 +461,7 @@ lib/generators/a2a/rails/
|
|
|
430
461
|
└── templates/
|
|
431
462
|
```
|
|
432
463
|
|
|
433
|
-
## v0.1
|
|
464
|
+
## Historical v0.1 scope
|
|
434
465
|
|
|
435
466
|
Included:
|
|
436
467
|
|
|
@@ -467,7 +498,7 @@ Not included in v0.1:
|
|
|
467
498
|
- LLM Agent Framework
|
|
468
499
|
- Orchestration Framework
|
|
469
500
|
|
|
470
|
-
##
|
|
501
|
+
## Historical v0.1.0 verification
|
|
471
502
|
|
|
472
503
|
The v0.1.0 release candidate completed:
|
|
473
504
|
|
|
@@ -531,12 +562,33 @@ The CI matrix covers:
|
|
|
531
562
|
|
|
532
563
|
Known warning-enabled output from upstream `agent2agent 2.0.0` can include circular-require, indentation, and URI-parser warnings. Those warnings are distinct from the Rack-environment INFO logging that `a2a-rails` suppresses at the Rails-facing adapter boundary.
|
|
533
564
|
|
|
534
|
-
## Release
|
|
565
|
+
## Release history and evidence
|
|
566
|
+
|
|
567
|
+
> **Historical v0.3.0.rc1 pre-release (2026-10-10):** `0.3.0.rc1` is published on [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.3.0.rc1) and as a [GitHub Pre-release](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0-rc1). It adds the outbound Rails Client and Client-only mode. Stable `0.2.0` remains available. RC1 is not stable `0.3.0`, an independent audit, or public-production approval; see the [publication record](docs/release/v0.3.0-rc1-publication-record.md) and [Client guide](docs/guides/outbound-a2a-client.md).
|
|
568
|
+
|
|
569
|
+
> **Release status (2026-10-08):** **`0.2.0` is published as a stable release** on [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.2.0) and [GitHub](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.2.0). It includes the Rails/Zeitwerk and migration-generator fixes after rc2. The public Gem matches the verified artifact byte-for-byte; see the [publication record](docs/release/v0.2.0-publication-record.md).
|
|
570
|
+
|
|
571
|
+
- RubyGems: https://rubygems.org/gems/a2a-rails
|
|
572
|
+
- **Previous stable `0.3.0`:** [GitHub Release](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0) · [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.3.0) · [exact public SHA256 and provenance](docs/release/v0.3.0-publication-record.md)
|
|
573
|
+
- Published version list: https://rubygems.org/gems/a2a-rails/versions
|
|
574
|
+
- Earlier stable release `0.2.0`: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.2.0
|
|
575
|
+
- Previous stable release: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.1.0
|
|
576
|
+
- Changelog: [CHANGELOG.md](CHANGELOG.md)
|
|
577
|
+
- Release record: [v0.3.0 publication record](docs/release/v0.3.0-publication-record.md) · [historical v0.2.0 publication record](docs/release/v0.2.0-publication-record.md)
|
|
578
|
+
- **Security policy / 脆弱性報告:** [SECURITY.md](SECURITY.md) — confidential vulnerability reporting, current assurance boundaries and production responsibilities.
|
|
579
|
+
- **v0.3.x prerelease policy:** [Risk-based release gates](docs/release/step-29-5u-risk-based-oss-release-policy.md) — independently commissioned external audit is **recommended but optional**, not a known vulnerability or RubyGems requirement. Technical security checks, no known unresolved Critical/High findings, exact Gem provenance and explicit maintainer release approval remain mandatory; [optional community review #113](https://github.com/cuichangquan/a2a-rails/issues/113). **Check the published-version list for the current stable version; package publication and public-production deployment are separate decisions.**
|
|
580
|
+
- **Release evidence & upgrading:** [Step 31 release-readiness record](docs/release/v0.3.0-stable-readiness.md) · [RC1 feedback snapshot](docs/release/v0.3.0-rc1-feedback-and-upgrade-readiness.md) · [v0.2.0 → v0.3.0 upgrade guide](docs/release/upgrading-v0.2.0-to-v0.3.md) · [v0.1.0 → v0.2.0 guide](docs/release/upgrading-v0.1.0-to-v0.2.md). Check [RubyGems](https://rubygems.org/gems/a2a-rails/versions) for availability. Gem distribution does **not** authorize public Agent exposure.
|
|
581
|
+
- **低コスト検証 / Cost-efficient verification:** [Step 33 validation levels, offline decision helper and read-only GCP inventory](docs/testing/cost-efficient-validation.md) — reuse existing CI before new billable infrastructure; cloud operations require separate approval.
|
|
582
|
+
- **Roadmap / 次にやること:** [ROADMAP.md](ROADMAP.md) · [Step 31 / Issue #120](https://github.com/cuichangquan/a2a-rails/issues/120) for the `0.3.0` release-evaluation and publication decisions. [Issue #11](https://github.com/cuichangquan/a2a-rails/issues/11) still governs public-production deployment; the [historical `0.2.0` release record](docs/release/v0.2.0-stable-readiness.md) is separate.
|
|
583
|
+
- **Official A2A TCK results:** [Pinned JSON-RPC MUST report and reproduction](docs/testing/official-a2a-tck.md) — after Step 17-4: **63 passed / 1 failed / 171 skipped / 30 deselected** (pytest). The remaining `CORE-SEND-003` mismatch is tracked [upstream in #202](https://github.com/a2aproject/a2a-tck/issues/202). The TCK workflow is informational, **not** an A2A conformance certificate.
|
|
584
|
+
|
|
585
|
+
- [A2Aの全体像(日本語・A4 1枚PDF)](docs/guides/a2a-protocol-overview-ja.pdf) — 登場人物・依頼の流れ・主要用語・MCPとの違いをまとめた学習資料。
|
|
586
|
+
- [A2A at a glance (English, A4 one-page PDF)](docs/guides/a2a-protocol-overview-en.pdf) — Roles, workflow, key terms, and how MCP fits.
|
|
535
587
|
|
|
536
588
|
- [CHANGELOG](CHANGELOG.md)
|
|
537
|
-
- [
|
|
589
|
+
- [Historical 0.3.0 pre-publication readiness](docs/release/v0.3.0-stable-readiness.md)
|
|
538
590
|
- [Step 31-4 RC1 feedback evidence and risks](docs/release/v0.3.0-rc1-feedback-and-upgrade-readiness.md)
|
|
539
|
-
- [Upgrading from v0.2.0 to
|
|
591
|
+
- [Upgrading from v0.2.0 to v0.3.0](docs/release/upgrading-v0.2.0-to-v0.3.md)
|
|
540
592
|
- [RC1 feedback / bug report template](https://github.com/cuichangquan/a2a-rails/issues/new?template=rc1-feedback.md)
|
|
541
593
|
- [v0.1.0 Release Notes](docs/release/v0.1.0.md)
|
|
542
594
|
- [v0.1.0 Release Checklist](docs/release/v0.1.0-checklist.md)
|
|
@@ -554,6 +606,13 @@ Known warning-enabled output from upstream `agent2agent 2.0.0` can include circu
|
|
|
554
606
|
|
|
555
607
|
The Gem is available as open source under the terms of the MIT License. See [LICENSE](LICENSE).
|
|
556
608
|
|
|
609
|
+
## Protocol illustrations
|
|
610
|
+
|
|
611
|
+
<img src="docs/assets/a2a-rails-infographics.png">
|
|
612
|
+
<br/>
|
|
613
|
+
<br/>
|
|
614
|
+
<img src="docs/assets/a2a-rails-infographics-en.png">
|
|
615
|
+
|
|
557
616
|
## Official A2A Resources / A2A公式資料
|
|
558
617
|
|
|
559
618
|
- [A2A Protocol overview / A2Aの全体像(日本語・A4 1枚PDF)](docs/guides/a2a-protocol-overview-ja.pdf) — 公式資料をもとに作成した学習資料(2026-10-07)。
|
|
@@ -574,3 +633,11 @@ The Gem is available as open source under the terms of the MIT License. See [LIC
|
|
|
574
633
|
### Community submissions / コミュニティへの投稿
|
|
575
634
|
|
|
576
635
|
- [awesome-a2a: Resource suggestion #190 / 掲載提案](https://github.com/ai-boost/awesome-a2a/issues/190)
|
|
636
|
+
|
|
637
|
+
## 0.5.0 continuation candidate (not published)
|
|
638
|
+
|
|
639
|
+
Handlers can explicitly return `A2A::Rails::InputRequired.new("Which department?")`
|
|
640
|
+
to ask a question, then accept a reply through SendMessage on the same Task.
|
|
641
|
+
See [usage](docs/guides/task-continuation.md), [design](docs/design/task-continuation.md),
|
|
642
|
+
[SDK boundary rules](docs/design/sdk-boundary.md), and [upgrade/recovery](docs/release/upgrading-v0.4.0-to-v0.5.md).
|
|
643
|
+
Candidate verification and review remain required; this is not a release notice.
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
module A2A
|
|
4
4
|
module Rails
|
|
5
5
|
class RequestsController < ApplicationController
|
|
6
|
+
# JSON-RPC reads its raw envelope; Rails model parameter wrapping is unused
|
|
7
|
+
# and would eagerly parse/log malformed bodies before the SDK boundary.
|
|
8
|
+
wrap_parameters false
|
|
6
9
|
def create
|
|
7
10
|
response.set_header("Cache-Control", "no-store")
|
|
8
11
|
return unless validate_a2a_request_body
|
|
@@ -20,6 +23,34 @@ module A2A
|
|
|
20
23
|
|
|
21
24
|
private
|
|
22
25
|
|
|
26
|
+
# Run before Rails Instrumentation builds its start_processing payload.
|
|
27
|
+
# Host filter configuration is not mutated; only this A2A request is affected.
|
|
28
|
+
def process_action(*)
|
|
29
|
+
filters = Array(request.get_header("action_dispatch.parameter_filter"))
|
|
30
|
+
request.set_header("action_dispatch.parameter_filter", filters + [/\Aparams\z/])
|
|
31
|
+
# Earlier middleware may have memoized a filtered view. Invalidate only
|
|
32
|
+
# request-local Rails filter caches, never the actual parameters/body.
|
|
33
|
+
%i[@parameter_filter @filtered_env @filtered_path].each do |name|
|
|
34
|
+
request.instance_variable_set(name, nil)
|
|
35
|
+
end
|
|
36
|
+
# Do not ask Rails to parse the RPC body for logging: its malformed-JSON
|
|
37
|
+
# diagnostic can print raw_post before parameter filtering takes effect.
|
|
38
|
+
# Runtime/SDK still receive the original body after request validation.
|
|
39
|
+
request.instance_variable_set(:@filtered_parameters, { "params" => "[FILTERED]" })
|
|
40
|
+
# This endpoint is JSON-RPC only. Rails format negotiation otherwise
|
|
41
|
+
# parses body parameters again while constructing instrumentation data.
|
|
42
|
+
request.set_header("action_dispatch.request.formats", [::Mime[:json]])
|
|
43
|
+
super
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def render_a2a_error(message, status:)
|
|
47
|
+
# `render json:` negotiates Vary through parsed request parameters,
|
|
48
|
+
# which can log an invalid raw body even after RequestGuard rejects it.
|
|
49
|
+
self.status = status
|
|
50
|
+
self.content_type = "application/json"
|
|
51
|
+
self.response_body = JSON.generate(error: message)
|
|
52
|
+
end
|
|
53
|
+
|
|
23
54
|
def validate_a2a_request_body
|
|
24
55
|
RequestGuard.enforce!(
|
|
25
56
|
env: request.env,
|
|
@@ -27,7 +58,7 @@ module A2A
|
|
|
27
58
|
)
|
|
28
59
|
true
|
|
29
60
|
rescue RequestGuard::PayloadTooLarge
|
|
30
|
-
|
|
61
|
+
render_a2a_error("Payload too large", status: 413)
|
|
31
62
|
false
|
|
32
63
|
rescue RequestGuard::UnsupportedMediaType
|
|
33
64
|
# This is an HTTP boundary rejection before JSON-RPC parsing (and
|
|
@@ -37,11 +68,11 @@ module A2A
|
|
|
37
68
|
head :unsupported_media_type
|
|
38
69
|
false
|
|
39
70
|
rescue RequestGuard::InvalidBody
|
|
40
|
-
|
|
71
|
+
render_a2a_error("Invalid request body", status: 400)
|
|
41
72
|
false
|
|
42
73
|
rescue RequestGuard::InvalidConfiguration
|
|
43
74
|
A2A::Rails.configuration.logger&.error("[a2a-rails] invalid request size configuration")
|
|
44
|
-
|
|
75
|
+
render_a2a_error("Request validation unavailable", status: 500)
|
|
45
76
|
false
|
|
46
77
|
end
|
|
47
78
|
|
|
@@ -54,16 +85,16 @@ module A2A
|
|
|
54
85
|
true
|
|
55
86
|
rescue Authentication::Unauthorized
|
|
56
87
|
response.set_header("WWW-Authenticate", A2A::Rails.configuration.authentication_challenge)
|
|
57
|
-
|
|
88
|
+
render_a2a_error("Unauthorized", status: :unauthorized)
|
|
58
89
|
false
|
|
59
90
|
rescue Authentication::Forbidden
|
|
60
|
-
|
|
91
|
+
render_a2a_error("Forbidden", status: :forbidden)
|
|
61
92
|
false
|
|
62
93
|
rescue StandardError => error
|
|
63
94
|
# The exception message may contain credentials supplied by host code.
|
|
64
95
|
# Log the class only; never echo verifier failures into the response.
|
|
65
96
|
A2A::Rails.configuration.logger&.error("[a2a-rails] authentication unavailable: #{error.class}")
|
|
66
|
-
|
|
97
|
+
render_a2a_error("Authentication unavailable", status: :internal_server_error)
|
|
67
98
|
false
|
|
68
99
|
end
|
|
69
100
|
end
|
data/lib/a2a/rails/client.rb
CHANGED
|
@@ -183,7 +183,8 @@ module A2A
|
|
|
183
183
|
end
|
|
184
184
|
validate_remote_protocol_keys!(part, operation)
|
|
185
185
|
type = kinds.find { |key| part.key?(key) }
|
|
186
|
-
|
|
186
|
+
value = part[type]
|
|
187
|
+
valid_value = type == "data" ? value.is_a?(Hash) || value.is_a?(Array) : value.is_a?(String)
|
|
187
188
|
unless valid_value
|
|
188
189
|
raise InvalidResponseError.new(:invalid_message_part, operation: operation)
|
|
189
190
|
end
|
|
@@ -6,7 +6,7 @@ require "uri"
|
|
|
6
6
|
module A2A
|
|
7
7
|
module Rails
|
|
8
8
|
class Configuration
|
|
9
|
-
TASK_STORE_METHODS = %i[save find transition cancel list].freeze
|
|
9
|
+
TASK_STORE_METHODS = %i[save find transition cancel list claim_execution configure_execution resume].freeze
|
|
10
10
|
TASK_EXECUTION_MODES = %i[sync async].freeze
|
|
11
11
|
DEFAULT_TASK_RETENTION_SECONDS = 30 * 24 * 60 * 60
|
|
12
12
|
DEFAULT_TASK_PRUNE_BATCH_SIZE = 1_000
|
|
@@ -16,7 +16,7 @@ module A2A
|
|
|
16
16
|
|
|
17
17
|
attr_accessor :agent, :public_base_url, :authenticate_request, :authentication_challenge,
|
|
18
18
|
:max_request_bytes, :security_schemes, :security_requirements,
|
|
19
|
-
:task_store, :task_page_token_secret, :task_retention,
|
|
19
|
+
:task_store, :task_page_token_secret, :task_retention, :task_input_required_retention,
|
|
20
20
|
:task_prune_batch_size, :max_tasks_per_owner,
|
|
21
21
|
:max_task_history_entries, :max_task_artifacts,
|
|
22
22
|
:task_execution_mode, :server_enabled
|
|
@@ -32,6 +32,7 @@ module A2A
|
|
|
32
32
|
@task_store = :memory
|
|
33
33
|
@task_page_token_secret = nil
|
|
34
34
|
@task_retention = DEFAULT_TASK_RETENTION_SECONDS
|
|
35
|
+
@task_input_required_retention = nil
|
|
35
36
|
@task_prune_batch_size = DEFAULT_TASK_PRUNE_BATCH_SIZE
|
|
36
37
|
@max_tasks_per_owner = DEFAULT_MAX_TASKS_PER_OWNER
|
|
37
38
|
@max_task_history_entries = DEFAULT_MAX_TASK_HISTORY_ENTRIES
|
|
@@ -93,7 +94,7 @@ module A2A
|
|
|
93
94
|
def resolve_task_store
|
|
94
95
|
case @task_store
|
|
95
96
|
when nil, :memory
|
|
96
|
-
Task::MemoryStore.new
|
|
97
|
+
Task::MemoryStore.new(max_history_entries: @max_task_history_entries)
|
|
97
98
|
when :active_record
|
|
98
99
|
resolve_active_record_store
|
|
99
100
|
else
|
|
@@ -115,6 +116,7 @@ module A2A
|
|
|
115
116
|
Task::ActiveRecordStore.new(
|
|
116
117
|
cursor_secret: task_cursor_secret,
|
|
117
118
|
retention: @task_retention,
|
|
119
|
+
input_required_retention: @task_input_required_retention,
|
|
118
120
|
prune_batch_size: @task_prune_batch_size,
|
|
119
121
|
max_tasks_per_owner: @max_tasks_per_owner,
|
|
120
122
|
max_history_entries: @max_task_history_entries,
|
|
@@ -144,7 +146,9 @@ module A2A
|
|
|
144
146
|
end
|
|
145
147
|
|
|
146
148
|
def validate_task_store!(store)
|
|
147
|
-
missing = TASK_STORE_METHODS.reject
|
|
149
|
+
missing = TASK_STORE_METHODS.reject do |method_name|
|
|
150
|
+
store.respond_to?(method_name) && store.method(method_name).owner != Task::Store
|
|
151
|
+
end
|
|
148
152
|
unless missing.empty?
|
|
149
153
|
raise ConfigurationError, "config.task_store is missing methods: #{missing.join(", ")}"
|
|
150
154
|
end
|
data/lib/a2a/rails/dispatcher.rb
CHANGED
|
@@ -27,6 +27,7 @@ module A2A
|
|
|
27
27
|
def plan(message:, context:)
|
|
28
28
|
validate!
|
|
29
29
|
skill = select_skill(message: message, context: context)
|
|
30
|
+
verify_skill_input!(skill, message)
|
|
30
31
|
|
|
31
32
|
ExecutionPlan.new(
|
|
32
33
|
agent_class_name: @agent.name,
|
|
@@ -37,7 +38,11 @@ module A2A
|
|
|
37
38
|
|
|
38
39
|
def execute(plan:, message:, context:)
|
|
39
40
|
validate!
|
|
41
|
+
unless plan.agent_class_name.nil? || @agent.name == plan.agent_class_name
|
|
42
|
+
raise ConfigurationError, "Saved Agent no longer matches configured Agent"
|
|
43
|
+
end
|
|
40
44
|
skill = declared_skill(plan.skill_id)
|
|
45
|
+
verify_skill_input!(skill, message)
|
|
41
46
|
handler_context = context.merge(skill_id: skill.id)
|
|
42
47
|
|
|
43
48
|
skill.handler.call(message: message, context: handler_context)
|
|
@@ -64,6 +69,14 @@ module A2A
|
|
|
64
69
|
declared_skill(selected_id, selected)
|
|
65
70
|
end
|
|
66
71
|
|
|
72
|
+
def verify_skill_input!(skill, message)
|
|
73
|
+
parts = message[:parts] if message.is_a?(Hash)
|
|
74
|
+
return unless parts.is_a?(Array) && parts.any? { |part| part.is_a?(Hash) && part.key?(:data) }
|
|
75
|
+
return if skill.input_modes&.include?(Skill::DATA_INPUT_MODE)
|
|
76
|
+
|
|
77
|
+
raise UnsupportedSkillInputError, "Selected skill does not accept JSON Data Parts"
|
|
78
|
+
end
|
|
79
|
+
|
|
67
80
|
def declared_skill(skill_id, original = skill_id)
|
|
68
81
|
@agent.skills.find { |skill| skill.id == skill_id } ||
|
|
69
82
|
raise(UnknownSkillError, "Router selected unknown skill: #{original.inspect}")
|
data/lib/a2a/rails/errors.rb
CHANGED
|
@@ -9,9 +9,11 @@ module A2A
|
|
|
9
9
|
class UnknownSkillError < ConfigurationError; end
|
|
10
10
|
|
|
11
11
|
class RejectedTask < Error; end
|
|
12
|
+
class UnsupportedSkillInputError < RejectedTask; end
|
|
12
13
|
class ArtifactMappingError < Error; end
|
|
13
14
|
|
|
14
15
|
class ProtocolError < Error; end
|
|
16
|
+
class InvalidAgentResponseError < ProtocolError; end
|
|
15
17
|
class InvalidRequestError < ProtocolError; end
|
|
16
18
|
class ContentTypeNotSupportedError < ProtocolError; end
|
|
17
19
|
class TaskContinuationNotSupportedError < ProtocolError; end
|
|
@@ -36,6 +38,18 @@ module A2A
|
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
|
|
41
|
+
class TaskNotResumableError < TaskError
|
|
42
|
+
attr_reader :task_id, :state
|
|
43
|
+
|
|
44
|
+
def initialize(task_id, state:)
|
|
45
|
+
@task_id, @state = task_id, state
|
|
46
|
+
super("Task is not awaiting input")
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
class TaskContextMismatchError < InvalidRequestError; end
|
|
50
|
+
class TaskMessageConflictError < InvalidRequestError; end
|
|
51
|
+
class TaskContinuationUnavailableError < ConfigurationError; end
|
|
52
|
+
|
|
39
53
|
class InvalidTaskQueryError < TaskError; end
|
|
40
54
|
class InvalidTaskStateError < TaskError; end
|
|
41
55
|
class TaskStoreUnavailableError < TaskError; end
|