Skip to content
Open
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
38 changes: 25 additions & 13 deletions src/a2a/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,30 @@ class AgentExtension(A2ABaseModel):
"""


class TransportProtocol(str, Enum):
"""
Supported A2A transport protocols.
"""

JSONRPC = 'JSONRPC'
GRPC = 'GRPC'
HTTP_JSON = 'HTTP+JSON'


class AgentInterface(A2ABaseModel):
"""
Declares a combination of a target URL and a transport protocol for interacting with the agent.
This allows agents to expose the same functionality over multiple transport mechanisms.
"""

transport: str = Field(..., examples=['JSONRPC', 'GRPC', 'HTTP+JSON'])
transport: TransportProtocol = Field(
...,
examples=[
TransportProtocol.JSONRPC,
TransportProtocol.GRPC,
TransportProtocol.HTTP_JSON,
],
)
"""
The transport protocol supported at this URL.
"""
Expand Down Expand Up @@ -1021,16 +1038,6 @@ class TextPart(A2ABaseModel):
"""


class TransportProtocol(str, Enum):
"""
Supported A2A transport protocols.
"""

jsonrpc = 'JSONRPC'
grpc = 'GRPC'
http_json = 'HTTP+JSON'


class UnsupportedOperationError(A2ABaseModel):
"""
An A2A-specific error indicating that the requested operation is not supported by the agent.
Expand Down Expand Up @@ -1774,8 +1781,13 @@ class AgentCard(A2ABaseModel):
"""
A human-readable name for the agent.
"""
preferred_transport: str | None = Field(
default='JSONRPC', examples=['JSONRPC', 'GRPC', 'HTTP+JSON']
preferred_transport: TransportProtocol | None = Field(
default=TransportProtocol.JSONRPC,
examples=[
TransportProtocol.JSONRPC,
TransportProtocol.GRPC,
TransportProtocol.HTTP_JSON,
],
)
"""
The transport protocol for the preferred endpoint (the main 'url' field).
Expand Down
Loading