A2aAgentServer
autogen.a2a.A2aAgentServer #
A2aAgentServer(agent, *, url='http://localhost:8000', agent_card=None, card_modifier=None, extended_agent_card=None, extended_card_modifier=None)
A server wrapper for running an AG2 agent via the A2A protocol.
This class provides functionality to wrap an AG2 ConversableAgent into an A2A server that can be used to interact with the agent through A2A requests.
Initialize the A2aAgentServer.
| PARAMETER | DESCRIPTION |
|---|---|
agent | The Autogen ConversableAgent to serve. TYPE: |
url | The base URL for the A2A server. TYPE: |
agent_card | Configuration for the base agent card. TYPE: |
card_modifier | Function to modify the base agent card. TYPE: |
extended_agent_card | Configuration for the extended agent card. TYPE: |
extended_card_modifier | Function to modify the extended agent card. TYPE: |
Source code in autogen/a2a/server.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
card instance-attribute #
card = model_validate({'name': name, 'description': description, 'url': url, 'supports_authenticated_extended_card': extended_agent_card is not None, None: model_dump(exclude_none=True)})
executor property #
Get the A2A agent executor.
Auto-detects A2UIAgent and returns an A2UIAgentExecutor that preserves A2UI DataParts in responses and handles extension negotiation.
add_middleware #
build_request_handler #
build_request_handler(*, task_store=None, queue_manager=None, push_config_store=None, push_sender=None, request_context_builder=None)
Build a request handler for A2A application.
| PARAMETER | DESCRIPTION |
|---|---|
task_store | The task store to use. TYPE: |
queue_manager | The queue manager to use. TYPE: |
push_config_store | The push notification config store to use. TYPE: |
push_sender | The push notification sender to use. TYPE: |
request_context_builder | The request context builder to use. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
RequestHandler | A configured RequestHandler instance. |
Source code in autogen/a2a/server.py
build_starlette_app #
Build a Starlette A2A application for ASGI server.
| PARAMETER | DESCRIPTION |
|---|---|
request_handler | The request handler to use. TYPE: |
context_builder | The context builder to use. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Starlette | A configured Starlette application instance. |