Skip to content

Add new a2a call task to the specification and schema #1114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
+ [gRPC](#grpc-call)
+ [HTTP](#http-call)
+ [OpenAPI](#openapi-call)
+ [A2A](#a2a-call)
- [Do](#do)
- [Emit](#emit)
- [For](#for)
Expand Down Expand Up @@ -320,6 +321,7 @@ Serverless Workflow defines several default functions that **MUST** be supported
- [gRPC](#grpc-call)
- [HTTP](#http-call)
- [OpenAPI](#openapi-call)
- [A2A](#a2a-call)

##### AsyncAPI Call

Expand Down Expand Up @@ -483,6 +485,48 @@ do:
status: available
```

##### A2A Call

The [A2A Call](#a2a-call) enables workflows to interact with AI agents described by [A2A](https://a2a-protocol.org/).

###### Properties

| Name | Type | Required | Description|
|:--|:---:|:---:|:---|
| method | `string` | `yes` | The A2A JSON-RPC method to send. |
| agentCard | [`externalResource`](#external-resource) | `yes` | The AgentCard resource that describes the agent to call. |
| parameters | `any` | `no` | The parameters for the A2A rpc method. For the `message/send` and `message/stream` methods the parameters `message.messageId` and `message.role` must be automatically set if missing. |

> [!NOTE]
> The `security` and `securitySchemes` fields of the AgentCard contain authentication requirements and schemes for when communicating with the agent.

> [!NOTE]
> On success the output is the JSON-RPC result. On failure runtimes must raise an error.

> [!NOTE]
> For `message/stream` and `tasks/resubscribe` methods the output is a sequentially ordered array of all the result objects.

###### Examples

```yaml
document:
dsl: '1.0.0'
namespace: test
name: a2a-example
version: '0.1.0'
do:
- GenerateReport:
call: a2a
with:
method: message/send
agentCard: https://example.com/.well-known/agent-card.json
parameters:
message:
parts:
- kind: text
text: Generate the Q1 sales report.
```

#### Do

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.
Expand Down
1 change: 1 addition & 0 deletions dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ Serverless Workflow DSL is designed to seamlessly interact with a variety of ser
- [**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.
- [**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.
- [**OpenAPI**](dsl-reference.md#openapi-call): Enables communication with services that provide OpenAPI specifications, which is useful for defining and consuming RESTful APIs.
- [**A2A**](dsl-reference.md#a2a-call): Enables interaction with A2A servers (agents described by A2A).

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.

Expand Down
32 changes: 31 additions & 1 deletion schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,36 @@ $defs:
description: Specifies whether redirection status codes (`300–399`) should be treated as errors.
required: [ document, operationId ]
unevaluatedProperties: false
- title: CallA2A
description: Defines the A2A call to perform.
$ref: '#/$defs/taskBase'
type: object
unevaluatedProperties: false
required: [ call, with ]
properties:
call:
type: string
const: a2a
with:
type: object
title: A2AArguments
description: The A2A call arguments.
properties:
agentCard:
$ref: '#/$defs/externalResource'
title: WithA2AAgentCard
description: The Agent Card that defines the agent to call.
method:
type: string
title: WithA2AMethod
description: The A2A method to send.
parameters:
type: object
title: WithA2AParameters
description: The parameters object to send with the A2A method.
additionalProperties: true
required: [ agentCard, method ]
unevaluatedProperties: false
- title: CallFunction
description: Defines the function call to perform.
$ref: '#/$defs/taskBase'
Expand All @@ -440,7 +470,7 @@ $defs:
call:
type: string
not:
enum: ["asyncapi", "grpc", "http", "openapi"]
enum: ["asyncapi", "grpc", "http", "openapi", "a2a"]
description: The name of the function to call.
with:
type: object
Expand Down
Loading