Files
eliasecchig f3f466fe29 Add ambient agents documentation (#1630)
* Add ambient agents documentation

Document how to build event-driven ambient agents using ADK trigger
endpoints and the /run endpoint. Covers Pub/Sub, Eventarc (Standard
and Advanced), Cloud Scheduler, concurrency control, retry logic,
session lifecycle, and deployment to Cloud Run.

* Address reviewer feedback: clarify event processing flow

- Move "How events are processed" higher, right after trigger endpoints
  intro, so the mental model comes before setup instructions
- Reword step 5: explicitly describe status code behavior (200 = ack,
  500 = retry) instead of vague "determines whether to retry"
- Clarify that trigger endpoints auto-create sessions without needing
  the --auto_create_session flag
- Restructure heading hierarchy under "Using trigger endpoints"

* Address reviewer feedback from koverholt

- Use named sections (--8<-- [start/end]) in code snippets to hide
  license headers in doc embeds
- Change model to gemini-flash-latest alias
- Restructure: show example agent first, then enable instructions,
  then "Try it locally" with step-by-step commands and curl test
- Fix port consistency (curl uses 8000 matching adk api_server default)
- Add curl example for /run endpoint

---------

Co-authored-by: Kristopher Overholt <koverholt@google.com>
2026-04-15 09:26:16 -05:00

32 lines
977 B
Python

# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# --8<-- [start:triggers]
import os
import uvicorn
from google.adk.cli.fast_api import get_fast_api_app
AGENT_DIR = os.path.dirname(os.path.abspath(__file__))
app = get_fast_api_app(
agents_dir=AGENT_DIR,
web=False,
trigger_sources=["pubsub", "eventarc"],
)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 8000)))
# --8<-- [end:triggers]