Skip to content

Python: Add Container Apps Dynamic Sessions sample - #9114

Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:contrib/6863-python-sessions
Draft

Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:contrib/6863-python-sessions

Conversation

@1aifanatic

Copy link
Copy Markdown
Contributor

Motivation & Context

Agent Framework needs a Python example that runs agent-generated code in an Azure Container Apps Dynamic Sessions pool.

Description & Review Guide

  • What are the major changes? Add a function-tool sample using existing HTTP and identity libraries, with application-owned session IDs, bounded execution/output, and setup guidance.
  • What is the impact of these changes? The configured cloud pool executes code. Each program run owns a separate session, reuses it across tool calls, and obtains fresh tokens. The sample validates endpoints and surfaces HTTP errors.
  • What do you want reviewers to focus on? Ruff and Pyright pass. HTTP mock checks cover the request contract, tokens, same-run reuse, cross-run isolation, endpoint rejection, and HTTP errors. Live Azure pool/model execution was not run.

Related Issue

Addresses the Python portion of #6863. The .NET contribution remains in #9009; the two PRs are separate language implementations, following the maintainer's request there.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 11:53
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Oct 6, 2026

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 review overview

🔵 Needs a closer look

The preview REST contract and live Azure integration still need independent verification.

Review effort: Balanced
Findings: None

What changed in this PR

Adds an Agent Framework Python example for executing agent-generated code in Azure Container Apps Dynamic Sessions, addressing the Python portion of #6863.

Changes:

  • Adds a function tool with per-run session ownership, fresh authentication tokens, execution/output limits, and HTTP error handling.
  • Documents setup requirements and links the sample from the tools index.
File Description
python/​samples/​02-agents/​tools/​README.md Adds the sample link.
python/​samples/​02-agents/​tools/​container_apps_dynamic_sessions.py Implements the cloud execution tool and documents setup and safety considerations.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@1aifanatic

Copy link
Copy Markdown
Contributor Author

The request contract was rechecked against Microsoft's 2025-10-02-preview Execute reference: the execution route/query, synchronous inline request fields, token scope, and response structure match the sample. The local HTTP mock verifies the client request and session/error behavior. Live pool/model execution has not been run and remains an integration-validation limitation, as stated in the PR description.

This branch was previously deployed

1 inactive deployment
github-app-auth — 66b21828 Deployed Oct 6, 2026 by 1aifanatic via team_check #6147
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants