Skip to content

Commit 93e6d74

Browse files
committed
docs: update v1.0 migration guide
1 parent e7618d2 commit 93e6d74

1 file changed

Lines changed: 28 additions & 6 deletions

File tree

docs/migrations/v1_0/README.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ request_handler = DefaultRequestHandler(
230230

231231
## 4. Server: Application Setup
232232

233-
The wrapper classes (`A2AStarletteApplication`, `A2AFastApiApplication` and `A2ARESTFastApiApplication`) are now removed. The Server setup now uses Starlette route factory functions directly, giving you full control over the routing.
233+
The application wrapper classes (`A2AStarletteApplication`, `A2AFastApiApplication` and `A2ARESTFastApiApplication`) are now removed. The Server setup now uses Starlette route factory functions directly, giving you better control over the routing, middleware, authentication, logging and other aspects of the server.
234234

235235
**Before (v0.3):**
236236
```python
@@ -248,19 +248,28 @@ uvicorn.run(server.build(), host=host, port=port)
248248
```
249249

250250
**After (v1.0):**
251+
252+
Define routes for each supported transport as per AgentCard.
253+
251254
```python
252255
from a2a.server.routes import create_agent_card_routes, create_jsonrpc_routes
253-
from starlette.applications import Starlette
254-
import uvicorn
255-
256256

257257
# Define routes for transports as per AgentCard
258258
routes = []
259+
# A2A Agent Card routes
259260
routes.extend(create_agent_card_routes(agent_card))
261+
# JSON-RPC routes
260262
routes.extend(create_jsonrpc_routes(request_handler, rpc_url='/api/v1/jsonrpc/'))
261263

262-
# Optional: Add routes for other transports
264+
# Optional: Add routes for REST/HTTP transports
263265
# routes.extend(create_rest_routes(request_handler, path_prefix='/api/v1/rest/'))
266+
```
267+
268+
Add the routes to the application:
269+
270+
```python
271+
from starlette.applications import Starlette
272+
import uvicorn
264273

265274
# Create application using routes
266275
app = Starlette(routes=routes)
@@ -269,6 +278,19 @@ app = Starlette(routes=routes)
269278
uvicorn.run(app, host=host, port=port)
270279
```
271280

281+
If you prefer FastAPI for your server application:
282+
283+
```python
284+
from fastapi import FastAPI
285+
import uvicorn
286+
287+
# Create application using routes
288+
app = FastAPI(routes=routes)
289+
290+
# Start the server
291+
uvicorn.run(app, host=host, port=port)
292+
```
293+
272294
> **Example**: [`a2a-mcp-without-framework/server/__main__.py` in PR #509](https://github.com/a2aproject/a2a-samples/pull/509/files#diff-d15d39ae64c3d4e3a36cc6fb442302caf4e32a6dbd858792e7a4bed180a625ac)
273295
274296
---
@@ -407,7 +429,7 @@ To improve the developer experience, we have consolidated helper functions into
407429

408430
Example Usage:
409431

410-
**1. Create a user message**
432+
**1. Create text based message**
411433

412434
```python
413435
from a2a.helpers import new_text_message

0 commit comments

Comments
 (0)