Skip to content

Fixing issue with test sample for FastAPI - #458

Merged
Rodrigo Brandão (rodrigobr-msft) merged 2 commits into
mainfrom
users/robrandao/fastapi-sample-fix
Jul 15, 2026
Merged

Fixing issue with test sample for FastAPI#458
Rodrigo Brandão (rodrigobr-msft) merged 2 commits into
mainfrom
users/robrandao/fastapi-sample-fix

Conversation

@rodrigobr-msft

Copy link
Copy Markdown
Contributor

This pull request refactors the FastAPI sample agent to improve configuration management, authentication, and application setup. The main changes include loading configuration from environment variables, integrating MSAL-based authentication, and updating how the agent application and FastAPI app are initialized.

Configuration and Authentication Improvements:

  • Added dotenv integration and load_configuration_from_env to load agent configuration from environment variables, making the setup more flexible and secure.
  • Introduced MsalConnectionManager and updated the agent to use MSAL-based authentication, enabling better support for secure connections.
  • Added Authorization and JwtAuthorizationMiddleware to the FastAPI app for improved authorization handling. [1] [2]

Application Initialization Updates:

  • Refactored agent and adapter initialization to use the loaded configuration and new authentication components.
  • Updated the main entry point to add the authorization middleware and set up the agent configuration on app startup.

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

This PR refactors the FastAPI “empty agent” test sample to initialize the agent using environment-based configuration and MSAL authentication, and to wire JWT-based authorization into the FastAPI host so requests can be authorized consistently.

Changes:

  • Load agent configuration from environment variables (with dotenv support) and construct shared SDK components (storage, MSAL connection manager, adapter, authorization).
  • Update AgentApplication initialization to use the new configuration/authentication components.
  • Add/update JWT authorization middleware wiring and app configuration setup for FastAPI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test_samples/fastapi/empty_agent.py
Comment thread test_samples/fastapi/empty_agent.py
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) marked this pull request as ready for review July 15, 2026 21:19
Copilot AI review requested due to automatic review settings July 15, 2026 21:21
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) merged commit 80f44cd into main Jul 15, 2026
10 of 11 checks passed
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) deleted the users/robrandao/fastapi-sample-fix branch July 15, 2026 21:23

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 1 out of 1 changed files in this pull request and generated no new comments.

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.

Running the fastapi/empty_agent.py sample results in a 500 error

3 participants