Skip to content

Commit e8e16c9

Browse files
authored
Merge pull request #1114 from emmanuelallen/feat-a2a-task
Add new `a2a` call task to the specification and schema
2 parents 41be80b + e0ea69f commit e8e16c9

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

dsl-reference.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
+ [gRPC](#grpc-call)
1515
+ [HTTP](#http-call)
1616
+ [OpenAPI](#openapi-call)
17+
+ [A2A](#a2a-call)
1718
- [Do](#do)
1819
- [Emit](#emit)
1920
- [For](#for)
@@ -320,6 +321,7 @@ Serverless Workflow defines several default functions that **MUST** be supported
320321
- [gRPC](#grpc-call)
321322
- [HTTP](#http-call)
322323
- [OpenAPI](#openapi-call)
324+
- [A2A](#a2a-call)
323325

324326
##### AsyncAPI Call
325327

@@ -483,6 +485,48 @@ do:
483485
status: available
484486
```
485487

488+
##### A2A Call
489+
490+
The [A2A Call](#a2a-call) enables workflows to interact with AI agents described by [A2A](https://a2a-protocol.org/).
491+
492+
###### Properties
493+
494+
| Name | Type | Required | Description|
495+
|:--|:---:|:---:|:---|
496+
| method | `string` | `yes` | The A2A JSON-RPC method to send.<br>*Supported values are: `message/send`, `message/stream`, `tasks/get`, `tasks/list`, `tasks/cancel`, `tasks/resubscribe`, `tasks/pushNotificationConfig/set`, `tasks/pushNotificationConfig/get`, `tasks/pushNotificationConfig/list`, `tasks/pushNotificationConfig/delete`, and `agent/getAuthenticatedExtendedCard`* |
497+
| agentCard | [`externalResource`](#external-resource) | `no` | The AgentCard resource that describes the agent to call.<br>*Required if `server` has not been set.* |
498+
| server | `string`\|[`endpoint`](#endpoint) | `no` | An URI or an object that describes the A2A server to call.<br>*Required if `agentCard` has not been set, otherwise ignored* |
499+
| parameters | `map` <br> `string` | `no` | The parameters for the A2A RPC method. For the `message/send` and `message/stream` methods, runtimes must default `message.messageId` to a uuid and `message.role` to `user`.<br>*Can be an object or a direct runtime expression.* |
500+
501+
> [!NOTE]
502+
> The `security` and `securitySchemes` fields of the AgentCard contain authentication requirements and schemes for when communicating with the agent.
503+
>
504+
> On success the output is the JSON-RPC result. On failure runtimes must raise an error with type [https://serverlessworkflow.io/spec/1.0.0/errors/runtime](https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#standard-error-types).
505+
>
506+
> For `message/stream` and `tasks/resubscribe` methods the output is a sequentially ordered array of all the result objects.
507+
508+
###### Examples
509+
510+
```yaml
511+
document:
512+
dsl: '1.0.0'
513+
namespace: test
514+
name: a2a-example
515+
version: '0.1.0'
516+
do:
517+
- GenerateReport:
518+
call: a2a
519+
with:
520+
method: message/send
521+
agentCard:
522+
endpoint: https://example.com/.well-known/agent-card.json
523+
parameters:
524+
message:
525+
parts:
526+
- kind: text
527+
text: Generate the Q1 sales report.
528+
```
529+
486530
#### Do
487531

488532
Serves as a fundamental building block within workflows, enabling the sequential execution of multiple subtasks. By defining a series of subtasks to perform in sequence, the Do task facilitates the efficient execution of complex operations, ensuring that each subtask is completed before the next one begins.

dsl.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ Serverless Workflow DSL is designed to seamlessly interact with a variety of ser
596596
- [**gRPC**](dsl-reference.md#grpc-call): Supports Remote Procedure Call (RPC) using gRPC, a high-performance, open-source universal RPC framework. This is suitable for connecting to services that require low-latency and high-throughput communication.
597597
- [**AsyncAPI**](dsl-reference.md#asyncapi-call): Facilitates interaction with asynchronous messaging protocols. AsyncAPI is designed for event-driven architectures, allowing workflows to publish and subscribe to events.
598598
- [**OpenAPI**](dsl-reference.md#openapi-call): Enables communication with services that provide OpenAPI specifications, which is useful for defining and consuming RESTful APIs.
599+
- [**A2A**](dsl-reference.md#a2a-call): Enables interaction with A2A servers (agents described by A2A).
599600

600601
Runtimes **must** raise an error with type `https://serverlessworkflow.io/spec/1.0.0/errors/communication` if and when a problem occurs during a call.
601602

schema/workflow.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,44 @@ $defs:
430430
description: Specifies whether redirection status codes (`300–399`) should be treated as errors.
431431
required: [ document, operationId ]
432432
unevaluatedProperties: false
433+
- title: CallA2A
434+
description: Defines the A2A call to perform.
435+
$ref: '#/$defs/taskBase'
436+
type: object
437+
unevaluatedProperties: false
438+
required: [ call, with ]
439+
properties:
440+
call:
441+
type: string
442+
const: a2a
443+
with:
444+
type: object
445+
title: A2AArguments
446+
description: The A2A call arguments.
447+
properties:
448+
agentCard:
449+
$ref: '#/$defs/externalResource'
450+
title: WithA2AAgentCard
451+
description: The Agent Card that defines the agent to call.
452+
server:
453+
title: A2AServer
454+
description: The server endpoint to send the request to.
455+
$ref: '#/$defs/endpoint'
456+
method:
457+
type: string
458+
title: WithA2AMethod
459+
description: The A2A method to send.
460+
enum: [ 'message/send', 'message/stream', 'tasks/get', 'tasks/list', 'tasks/cancel', 'tasks/resubscribe', 'tasks/pushNotificationConfig/set', 'tasks/pushNotificationConfig/get', 'tasks/pushNotificationConfig/list', 'tasks/pushNotificationConfig/delete', 'agent/getAuthenticatedExtendedCard' ]
461+
parameters:
462+
oneOf:
463+
- type: object
464+
minProperties: 1
465+
additionalProperties: true
466+
- type: string
467+
title: WithA2AParameters
468+
description: The parameters object to send with the A2A method.
469+
required: [ method ]
470+
unevaluatedProperties: false
433471
- title: CallFunction
434472
description: Defines the function call to perform.
435473
$ref: '#/$defs/taskBase'
@@ -440,7 +478,7 @@ $defs:
440478
call:
441479
type: string
442480
not:
443-
enum: ["asyncapi", "grpc", "http", "openapi"]
481+
enum: ["asyncapi", "grpc", "http", "openapi", "a2a"]
444482
description: The name of the function to call.
445483
with:
446484
type: object

0 commit comments

Comments
 (0)