feat: Implement a new modular FastAPI server for ADK agents with cust… #808
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR: Example FastAPI Modular Server Usage
📖 Overview
This PR adds a reference implementation showcasing how to extend the newly modularized
adk_web_server.py(introduced in v1.9.0) into a production-ready FastAPI server.🎯 Motivation
Release v1.9.0 introduced the following change:
This PR provides a concrete template that leverages those changes, making it easier for teams to:
📚 What’s Included
fastapi_modular_server/) with routers, agents, config, and core utilities.MINIMAL,BALANCED,FULL_COMPAT).📝 Notes
v1.9.0.✅ Checklist
v1.14.0📖 Proposal for Python Docs
We should extend the ADK Python documentation with a new section.
Suggested Doc Location:
docs/runtime/fastapi_server_extensions.mdProposed Section Outline:
Why Modularization?
fast_api.pyrefactor in v1.9.0Building a Custom Server
Overriding Built-in Routes
Optimizing Streaming (straightforward example)
SSEEventMapperThis way, the docs PR will complement this usage example, turning it into a reusable guide for the community.
🔗 Associated Issue
Closes #618
🧪 Testing Plan
The server was tested locally by running it and issuing a streaming request via
fetchin the browser console:✅ The SSE stream responded successfully with generated content.
📸 Screenshot of the running server:
📖 Proposal for Python Docs
We should extend the ADK Python documentation with a new section.
Suggested Doc Location:
docs/runtime/fastapi_server_extensions.mdProposed Section Outline:
Why Modularization?
fast_api.pyrefactor in v1.9.0Building a Custom Server
Overriding Built-in Routes
Optimizing Streaming (straightforward example)
SSEEventMapperThis way, the docs PR will complement this usage example, turning it into a reusable guide for the community.