Skip to content

python/google-adk: Migrate to Microsoft OpenTelemetry Distro, GA SDK 1.0.0, and align docs with production#317

Open
Yogeshp-MSFT wants to merge 3 commits into
microsoft:mainfrom
Yogeshp-MSFT:Google-ADK-Python
Open

python/google-adk: Migrate to Microsoft OpenTelemetry Distro, GA SDK 1.0.0, and align docs with production#317
Yogeshp-MSFT wants to merge 3 commits into
microsoft:mainfrom
Yogeshp-MSFT:Google-ADK-Python

Conversation

@Yogeshp-MSFT

Copy link
Copy Markdown

Summary

Upgrades the Google ADK sample agent to the Microsoft OpenTelemetry Distro (microsoft-opentelemetry),
bumps all A365 SDK packages to GA 1.0.0, removes otel version pinning workarounds, and aligns all
documentation with the current codebase and production webapp configuration.

Code changes

agent.py

  • Migrated BaggageBuilder import from microsoft_agents_a365.observability.core.middleware.baggage_builder
    to microsoft.opentelemetry.a365.core (new distro path)
  • Fixed observability identity: changed from agentic_user_id to agentic_app_id for agent_id in
    baggage — the observability backend requires agent_id on the route, token azp, and span
    gen_ai.agent.id to all match the app instance ID
  • Added diagnostic logging for observability identity source (activity vs env fallback)

main.py

  • Replaced standalone configure() from microsoft_agents_a365.observability.core.config with
    use_microsoft_opentelemetry() from the new microsoft.opentelemetry distro
  • The distro handles FIC token resolution automatically via A365_AGENT_APP_INSTANCE_ID /
    A365_AGENTIC_USER_ID env vars and CONNECTIONS__SERVICE_CONNECTION__SETTINGS__*

hosting.py

  • Added AGENT_LIFECYCLE notification handler — lifecycle notifications (onboarding, etc.) don't
    support replies; previously caused errors when the agent tried to reply

pyproject.toml

  • Bumped google-adk from >=1.18.0 to >=1.32.0,<2 (1.32+ lifted the otel<1.39 constraint)
  • Bumped A365 SDK packages from >= 0.1.0 to >= 1.0.0 (GA release)
  • Removed all override-dependencies for otel version pinning — no longer needed with google-adk 1.32+

Documentation changes

.env.template

  • Added Vertex AI configuration section (GOOGLE_APPLICATION_CREDENTIALS, GOOGLE_CLOUD_PROJECT,
    GOOGLE_CLOUD_LOCATION) with inline docs for both Vertex AI and public Gemini API modes
  • Added A365_AGENT_APP_INSTANCE_ID and A365_AGENTIC_USER_ID platform fallback vars
  • Added full A365 Observability Exporter configuration block (AGENT365OBSERVABILITY__* vars)
  • Added AGENT_ID, ALT_BLUEPRINT_NAME, ENABLE_KAIRO_EXPORTER, PYTHON_ENVIRONMENT
  • Fixed GOOGLE_GENAI_USE_VERTEXAI — removed duplicate declaration, defaults to FALSE for Quick Start

README.md

  • Updated CLI commands to use --agent-name and --aiteammate flags (current CLI syntax)
  • Fixed CONNECTIONS__SERVICE_CONNECTION__SETTINGS__SCOPES value from <blueprintId>/.default to
    correct 5a807f24-c9de-44ee-a3a7-329e88a00ffc/.default (Messaging Bot API)
  • Fixed AGENTIC_APP_ID source — was incorrectly listed as blueprint ID; now correctly documents it
    as the agent instance app ID from Copilot instance creation
  • Rewrote "Create agent instance" step to describe actual Copilot-based flow (not Teams App Store)
  • Rewrote "Update AGENTIC_USER_ID" step — values come from Entra ID after instance creation, not from
    a365.generated.config.json (which is often null for --aiteammate agents)
  • Added all production env vars to both config tables: AGENT365OBSERVABILITY__*,
    A365_AGENT_APP_INSTANCE_ID, A365_AGENTIC_USER_ID, ENABLE_KAIRO_EXPORTER, PYTHON_ENVIRONMENT,
    GOOGLE_CLOUD_*, GOOGLE_APPLICATION_CREDENTIALS, CONNECTIONSMAP__*, SCM_DO_BUILD_DURING_DEPLOYMENT
  • Added note clarifying AGENTIC_* env vars are fallbacks — production gets identity per-message
    via activity.recipient

AGENT-CODE-WALKTHROUGH.md

  • Step 1: Updated BaggageBuilder import path to microsoft.opentelemetry.a365.core
  • Step 2: Updated default model from gemini-2.0-flash to gemini-2.5-flash
  • Step 3: Replaced old configure() with use_microsoft_opentelemetry() and updated explanation
  • Step 5: Fixed observability scope to use agentic_app_id instead of agentic_user_id
  • Step 7: Updated main.py code block from configure()/run_http_app() to
    use_microsoft_opentelemetry()/start_server()

docs/design.md (full rewrite — was completely outdated)

  • Architecture diagram: start_with_generic_host.py/GenericAgentHostmain.py/MyAgent/hosting.py
  • Added all four key components with descriptions
  • Code samples: old google.generativeai API → current google.adk.agents.Agent/Runner pattern
  • Config section: matches actual production webapp env vars
  • Dependencies: matches current pyproject.toml (GA 1.0.0 packages)
  • Message flow: updated to include JWT validation, typing indicators, baggage, cleanup
  • Run command: uv run python start_with_generic_host.pypython main.py

Testing

  • Verified deploy.zip contents match current working code (all 7 files identical)
  • Production webapp env vars cross-referenced against .env.template and README config tables
  • Local dev (Playground) and production (Azure App Service) configurations both documented

Copilot AI review requested due to automatic review settings June 3, 2026 06:23
@Yogeshp-MSFT Yogeshp-MSFT requested a review from a team as a code owner June 3, 2026 06:23
@Yogeshp-MSFT

Copy link
Copy Markdown
Author

Hi @biswapm can you review this pr?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

python/google-adk/sample-agent/pyproject.toml:17

  • main.py and agent.py now import from microsoft.opentelemetry, but pyproject.toml does not list microsoft-opentelemetry as an explicit dependency. If it isn't a guaranteed transitive dependency of the listed packages, installs via pip install . / uv sync can fail at runtime with ModuleNotFoundError. Add microsoft-opentelemetry to [project].dependencies (with an appropriate version constraint consistent with the sample).
    # Google ADK -- official package (1.32+ lifted the otel<1.39 constraint)
    "google-adk>=1.32.0,<2",

    # Microsoft Agents SDK - Official packages for hosting and integration
    "microsoft-agents-hosting-aiohttp",
    "microsoft-agents-hosting-core",
    "microsoft-agents-authentication-msal",
    "microsoft-agents-activity",

Comment thread python/google-adk/sample-agent/pyproject.toml
Comment thread python/google-adk/sample-agent/requirements.txt
Comment thread python/google-adk/sample-agent/agent.py Outdated
Comment thread python/google-adk/sample-agent/README.md
@Yogeshp-MSFT

Copy link
Copy Markdown
Author

Hi @biswapm @microsoft/agent365-approvers can you review this pr?

Comment thread python/google-adk/sample-agent/.env.template Outdated
Comment thread python/google-adk/sample-agent/requirements.txt
@Yogeshp-MSFT Yogeshp-MSFT force-pushed the Google-ADK-Python branch 2 times, most recently from c741e0f to c61436e Compare June 22, 2026 04:34
…ps, redact identity logs

- pyproject.toml: add microsoft-opentelemetry, microsoft-agents-a365-observability-hosting, and microsoft-agents-a365-runtime to [project].dependencies (previously imported but undeclared); align minimum version constraints with requirements.txt so pip install . / uv sync produce consistent graphs

- agent.py: downgrade observability identity log from INFO to DEBUG and mask agent_id / tenant_id to last 4 chars to avoid leaking sensitive identifiers in production logs (source label retained for diagnostics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants