Skip to content
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
30 changes: 20 additions & 10 deletions lib/a2a/agent_card.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ defmodule A2A.AgentCard do
"""

@type skill :: %{
id: String.t(),
name: String.t(),
description: String.t(),
tags: [String.t()]
required(:id) => String.t(),
required(:name) => String.t(),
required(:description) => String.t(),
required(:tags) => [String.t()],
optional(:examples) => [String.t()],
optional(:input_modes) => [String.t()],
optional(:output_modes) => [String.t()],
optional(:security_requirements) => [map()]
}

@type capabilities :: %{
optional(:streaming) => boolean(),
optional(:push_notifications) => boolean(),
optional(:state_transition_history) => boolean(),
optional(:extended_agent_card) => boolean()
optional(:extended_agent_card) => boolean(),
optional(:extensions) => [A2A.AgentExtension.t()]
}

@type provider :: %{
Expand All @@ -33,9 +38,10 @@ defmodule A2A.AgentCard do
}

@type supported_interface :: %{
url: String.t(),
protocol_binding: String.t(),
protocol_version: String.t()
required(:url) => String.t(),
required(:protocol_binding) => String.t(),
required(:protocol_version) => String.t(),
optional(:tenant) => String.t()
}

@type t :: %__MODULE__{
Expand All @@ -53,7 +59,9 @@ defmodule A2A.AgentCard do
protocol_version: String.t() | nil,
supported_interfaces: [supported_interface()],
security_schemes: %{String.t() => A2A.SecurityScheme.t()},
security: [%{String.t() => [String.t()]}]
security: [%{String.t() => [String.t()]}],
signatures: [A2A.AgentCardSignature.t()],
security_requirements: [map()]
}

@enforce_keys [:name, :description, :url, :version, :skills]
Expand All @@ -72,6 +80,8 @@ defmodule A2A.AgentCard do
default_output_modes: ["text/plain"],
supported_interfaces: [],
security_schemes: %{},
security: []
security: [],
signatures: [],
security_requirements: []
]
end
22 changes: 22 additions & 0 deletions lib/a2a/agent_card_signature.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule A2A.AgentCardSignature do
@moduledoc """
A JWS signature of an AgentCard (RFC 7515).

## Proto Reference

message AgentCardSignature {
string protected = 1; // base64url-encoded JSON header
string signature = 2; // base64url-encoded signature
google.protobuf.Struct header = 3; // unprotected header
}
"""

@type t :: %__MODULE__{
protected: String.t(),
signature: String.t(),
header: map() | nil
}

@enforce_keys [:protected, :signature]
defstruct [:protected, :signature, :header]
end
24 changes: 24 additions & 0 deletions lib/a2a/agent_extension.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
defmodule A2A.AgentExtension do
@moduledoc """
A declaration of a protocol extension supported by an Agent.

## Proto Reference

message AgentExtension {
string uri = 1;
string description = 2;
bool required = 3;
google.protobuf.Struct params = 4;
}
"""

@type t :: %__MODULE__{
uri: String.t(),
description: String.t() | nil,
required: boolean(),
params: map() | nil
}

@enforce_keys [:uri]
defstruct [:uri, :description, :params, required: false]
end
6 changes: 4 additions & 2 deletions lib/a2a/artifact.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ defmodule A2A.Artifact do
name: String.t() | nil,
description: String.t() | nil,
parts: [A2A.Part.t()],
metadata: map()
metadata: map(),
extensions: [String.t()]
}

@enforce_keys [:parts]
Expand All @@ -19,7 +20,8 @@ defmodule A2A.Artifact do
:name,
:description,
parts: [],
metadata: %{}
metadata: %{},
extensions: []
]

@doc """
Expand Down
22 changes: 22 additions & 0 deletions lib/a2a/authentication_info.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule A2A.AuthenticationInfo do
@moduledoc """
Authentication details used for push notifications.

Contains an HTTP authentication scheme and optional credentials.

## Proto Reference

message AuthenticationInfo {
string scheme = 1; // e.g. "Bearer", "Basic"
string credentials = 2;
}
"""

@type t :: %__MODULE__{
scheme: String.t(),
credentials: String.t() | nil
}

@enforce_keys [:scheme]
defstruct [:scheme, :credentials]
end
Loading
Loading