-
Notifications
You must be signed in to change notification settings - Fork 36
Add Python LangChain sample agent #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Yogeshp-MSFT
wants to merge
6
commits into
microsoft:main
Choose a base branch
from
Yogeshp-MSFT:LangchainNew-sample
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3beb9f4
feat: Add sample LangChain agent(Python) with Microsoft A365 integration
Yogeshp-MSFT b04a785
fix: improve error handling and logging in agent message processing
Yogeshp-MSFT c2c43f8
Update python/langchain/sample-agent/agent_interface.py
Yogeshp-MSFT e3f1c6b
Update python/langchain/sample-agent/README.md
Yogeshp-MSFT 954d146
Update python/langchain/sample-agent/README.md
Yogeshp-MSFT deb115c
feat: Enhance observability integration with token caching and error …
Yogeshp-MSFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # ============================================================================= | ||
| # LangChain Sample Agent — Environment Configuration | ||
| # ============================================================================= | ||
| # Copy this file to .env and fill in your values: | ||
| # cp .env.template .env | ||
| # | ||
| # All values marked <<...>> MUST be replaced before the agent will work. | ||
| # Run `a365 config init` first — it generates the config files referenced below. | ||
| # ============================================================================= | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Azure OpenAI Configuration (preferred) | ||
| # ----------------------------------------------------------------------------- | ||
| AZURE_OPENAI_API_KEY=<<YOUR_AZURE_OPENAI_API_KEY>> | ||
| AZURE_OPENAI_ENDPOINT=<<YOUR_AZURE_OPENAI_ENDPOINT>> | ||
| AZURE_OPENAI_DEPLOYMENT=<<YOUR_AZURE_OPENAI_DEPLOYMENT>> | ||
| AZURE_OPENAI_API_VERSION=2024-12-01-preview | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # OpenAI Configuration (alternative — used if Azure OpenAI is not configured) | ||
| # ----------------------------------------------------------------------------- | ||
| # OPENAI_API_KEY=<<YOUR_OPENAI_API_KEY>> | ||
| # OPENAI_MODEL=gpt-4o | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Agent365 Service Connection (OAuth client credentials) | ||
| # ----------------------------------------------------------------------------- | ||
| # These values authenticate your agent with the Bot Framework and Agent 365. | ||
| # | ||
| # Where to find them (after running `a365 config init`): | ||
| # CLIENTID => a365.generated.config.json → agentBlueprintId | ||
| # CLIENTSECRET => a365.generated.config.json → agentBlueprintClientSecret | ||
| # TENANTID => a365.config.json → tenantId | ||
| # | ||
| # IMPORTANT — Client Secret: | ||
| # The a365.generated.config.json stores the secret encrypted with Windows DPAPI. | ||
| # Use `a365 config display -g` to view the decrypted secret, and copy it here. | ||
| # | ||
| # IMPORTANT — Client ID and JWT Audience: | ||
| # CLIENTID is the blueprint/app-registration ID. Bot Framework tokens are issued | ||
| # with aud=CLIENTID, so this value is also used for JWT audience validation. | ||
| CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTID=<<YOUR_BLUEPRINT_ID>> | ||
| CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTSECRET=<<YOUR_PLAINTEXT_CLIENT_SECRET>> | ||
| CONNECTIONS__SERVICE_CONNECTION__SETTINGS__TENANTID=<<YOUR_TENANT_ID>> | ||
| CONNECTIONS__SERVICE_CONNECTION__SETTINGS__SCOPES=5a807f24-c9de-44ee-a3a7-329e88a00ffc/.default | ||
|
|
||
| # Agentic user-authorization handler settings (do not change these defaults) | ||
| AGENTAPPLICATION__USERAUTHORIZATION__HANDLERS__AGENTIC__SETTINGS__TYPE=AgenticUserAuthorization | ||
| AGENTAPPLICATION__USERAUTHORIZATION__HANDLERS__AGENTIC__SETTINGS__SCOPES=https://graph.microsoft.com/.default | ||
| AGENTAPPLICATION__USERAUTHORIZATION__HANDLERS__AGENTIC__SETTINGS__ALTERNATEBLUEPRINTCONNECTIONNAME=https://graph.microsoft.com/.default | ||
|
|
||
| # Connection map (do not change) | ||
| CONNECTIONSMAP__0__SERVICEURL=* | ||
| CONNECTIONSMAP__0__CONNECTION=SERVICE_CONNECTION | ||
|
|
||
| # Auth handler name — set to "AGENTIC" for production (enables OBO token flow for MCP tools) | ||
| # Leave empty for Agents Playground / local dev without auth. | ||
| AUTH_HANDLER_NAME=AGENTIC | ||
Yogeshp-MSFT marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Bearer Token (optional — local dev only) | ||
| # ----------------------------------------------------------------------------- | ||
| # For local development without an auth handler, paste a fresh token here to | ||
| # enable MCP tool access. Get one with: a365 develop get-token -o raw | ||
| # The token expires in ~90 minutes; the agent detects expiry automatically. | ||
| BEARER_TOKEN=<paste token here> | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Observability (optional) | ||
| # ----------------------------------------------------------------------------- | ||
| ENABLE_OBSERVABILITY=true | ||
| ENABLE_A365_OBSERVABILITY_EXPORTER=false | ||
| OBSERVABILITY_SERVICE_NAME=LangChainSampleAgent | ||
| OBSERVABILITY_SERVICE_NAMESPACE=LangChainTesting | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Logging (optional) | ||
| # ----------------------------------------------------------------------------- | ||
| LOG_LEVEL=INFO | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # A365 deploy artifacts — generated by `a365 deploy` / `a365 develop` | ||
| a365.config.json | ||
| a365.generated.config.json | ||
| app.zip | ||
| publish/ | ||
|
|
||
| # Manifest folder — generated during deploy | ||
| manifest/ | ||
|
|
||
| # Python virtual environment and caches | ||
| .venv/ | ||
| venv/ | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *.egg-info/ | ||
| dist/ | ||
| build/ | ||
| uv.lock | ||
|
|
||
| # Environment — contains secrets | ||
| .env |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.