@runtypelabs/a2a-aisdk-example 0.2.4 → 0.3.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.
- package/README.md +26 -18
- package/dist/{chunk-FTWT3LGM.js → chunk-EY4P4D5Y.js} +261 -149
- package/dist/chunk-EY4P4D5Y.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +114 -45
- package/dist/index.js +1 -1
- package/dist/vercel/index.d.ts +8 -7
- package/dist/vercel/index.js +165 -81
- package/dist/vercel/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-FTWT3LGM.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ npx @runtypelabs/a2a-aisdk-example serve --echo
|
|
|
24
24
|
|
|
25
25
|
This starts a server at:
|
|
26
26
|
|
|
27
|
-
- Agent Card: `http://localhost:9999/.well-known/agent.json`
|
|
27
|
+
- Agent Card: `http://localhost:9999/.well-known/agent-card.json`
|
|
28
28
|
- A2A Endpoint: `http://localhost:9999/a2a`
|
|
29
29
|
|
|
30
30
|
### Test a time skill
|
|
@@ -35,16 +35,20 @@ curl -X POST http://localhost:9999/a2a \
|
|
|
35
35
|
-d '{
|
|
36
36
|
"jsonrpc": "2.0",
|
|
37
37
|
"id": "1",
|
|
38
|
-
"method": "
|
|
38
|
+
"method": "message/send",
|
|
39
39
|
"params": {
|
|
40
|
-
"skill": "time/day_of_week",
|
|
41
40
|
"message": {
|
|
42
41
|
"role": "user",
|
|
43
|
-
"parts": [{"
|
|
44
|
-
}
|
|
42
|
+
"parts": [{"data": {"date": "2025-02-04"}}]
|
|
43
|
+
},
|
|
44
|
+
"metadata": { "skill": "time/day_of_week" }
|
|
45
45
|
}
|
|
46
46
|
}'
|
|
47
|
-
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
```bash
|
|
51
|
+
{ "result": { "day": "Tuesday", ... }, "computed": { "method": "deterministic" } }
|
|
48
52
|
```
|
|
49
53
|
|
|
50
54
|
### Run with LLM
|
|
@@ -66,7 +70,9 @@ The server must be running first. Use two terminals:
|
|
|
66
70
|
```bash
|
|
67
71
|
# Echo mode (no API key needed)
|
|
68
72
|
npx @runtypelabs/a2a-aisdk-example serve --echo
|
|
73
|
+
```
|
|
69
74
|
|
|
75
|
+
```bash
|
|
70
76
|
# Or with LLM (requires OPENAI_API_KEY or ANTHROPIC_API_KEY)
|
|
71
77
|
OPENAI_API_KEY=sk-xxx npx @runtypelabs/a2a-aisdk-example serve
|
|
72
78
|
```
|
|
@@ -143,7 +149,7 @@ npx @runtypelabs/a2a-aisdk-example test http://localhost:9999 \
|
|
|
143
149
|
- Go to your Product
|
|
144
150
|
- Click "Add Capability" > "Connect External"
|
|
145
151
|
- Enter:
|
|
146
|
-
- Agent Card URL: `http://localhost:9999/.well-known/agent.json`
|
|
152
|
+
- Agent Card URL: `http://localhost:9999/.well-known/agent-card.json`
|
|
147
153
|
- A2A Endpoint URL: `http://localhost:9999/a2a`
|
|
148
154
|
- Click "Connect & Add"
|
|
149
155
|
|
|
@@ -296,20 +302,22 @@ Options:
|
|
|
296
302
|
|
|
297
303
|
## A2A Protocol
|
|
298
304
|
|
|
299
|
-
This package implements [A2A Protocol v0.3](https://
|
|
305
|
+
This package implements [A2A Protocol v0.3](https://a2a-protocol.org/v0.3.0/specification/).
|
|
300
306
|
|
|
301
307
|
### Endpoints
|
|
302
308
|
|
|
303
|
-
- `GET /.well-known/agent.json` - Agent Card discovery
|
|
309
|
+
- `GET /.well-known/agent-card.json` - Agent Card discovery (also serves `/.well-known/agent.json` for backward compat)
|
|
304
310
|
- `POST /a2a` - JSON-RPC endpoint
|
|
305
311
|
|
|
306
312
|
### Supported Methods
|
|
307
313
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
| Spec Method (preferred) | Legacy Alias | Description |
|
|
315
|
+
| --- | --- | --- |
|
|
316
|
+
| `message/send` | `tasks/send`, `SendMessage` | Send a message (synchronous) |
|
|
317
|
+
| `message/stream` | `tasks/sendSubscribe`, `SendStreamingMessage` | Send a message with SSE streaming |
|
|
318
|
+
| `GetTask` | `tasks/get` | Get task status |
|
|
319
|
+
| `CancelTask` | `tasks/cancel` | Cancel a running task |
|
|
320
|
+
| `ping` | | Health check |
|
|
313
321
|
|
|
314
322
|
## Vercel Deployment
|
|
315
323
|
|
|
@@ -337,7 +345,7 @@ export const POST = createA2AHandler({
|
|
|
337
345
|
llmConfig: { provider: 'openai', model: 'gpt-4o-mini' },
|
|
338
346
|
})
|
|
339
347
|
|
|
340
|
-
// app/.well-known/agent.json/route.ts
|
|
348
|
+
// app/.well-known/agent-card.json/route.ts
|
|
341
349
|
import { createAgentCardHandler } from '@runtypelabs/a2a-aisdk-example/vercel'
|
|
342
350
|
|
|
343
351
|
export const GET = createAgentCardHandler({
|
|
@@ -350,9 +358,9 @@ export const GET = createAgentCardHandler({
|
|
|
350
358
|
|
|
351
359
|
Since Vercel functions are stateless:
|
|
352
360
|
|
|
353
|
-
- `
|
|
354
|
-
- `
|
|
355
|
-
- Use `
|
|
361
|
+
- `GetTask` returns "not available" (no task storage)
|
|
362
|
+
- `CancelTask` returns "not available" (can't cancel in-flight tasks)
|
|
363
|
+
- Use `message/stream` for streaming responses
|
|
356
364
|
|
|
357
365
|
## Development
|
|
358
366
|
|