-
Notifications
You must be signed in to change notification settings - Fork 158
feat: integrate Agent SDK into kernel, migrate to GlobalStandard model types, remove Greeting function, and update Orchestrator to handle greetings #613
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
Changes from all commits
37fe076
7e0dc8b
17719fe
587d902
1ac5db0
50dd6f3
f8f77c5
e695659
496dc3e
15ce8aa
f3a14eb
71c4df6
161bfb4
829b643
f670185
a582bfe
5893ea4
f0d0cda
9b5931e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| [← Back to *DEPLOYMENT* guide](/docs/DeploymentGuide.md#deployment-options--steps) | ||
|
|
||
| # Reusing an Existing Log Analytics Workspace | ||
| To configure your environment to use an existing Log Analytics Workspace, follow these steps: | ||
| --- | ||
| ### 1. Go to Azure Portal | ||
| Go to https://portal.azure.com | ||
|
|
||
| ### 2. Search for Log Analytics | ||
| In the search bar at the top, type "Log Analytics workspaces" and click on it and click on the workspace you want to use. | ||
|
|
||
|  | ||
|
|
||
| ### 3. Copy Resource ID | ||
| In the Overview pane, Click on JSON View | ||
|
|
||
|  | ||
|
|
||
| Copy Resource ID that is your Workspace ID | ||
|
|
||
|  | ||
|
|
||
| ### 4. Set the Workspace ID in Your Environment | ||
| Run the following command in your terminal | ||
| ```bash | ||
| azd env set AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID '<Existing Log Analytics Workspace Id>' | ||
| ``` | ||
| Replace `<Existing Log Analytics Workspace Id>` with the value obtained from Step 3. | ||
|
|
||
| ### 5. Continue Deployment | ||
| Proceed with the next steps in the [deployment guide](/docs/DeploymentGuide.md#deployment-options--steps). |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,8 @@ async def get_wealth_advisor_agent(cls): | |||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| agent_name = "WealthAdvisor" | ||||||||||||||||||||||||||||||||||||||||
| agent_instructions = "You are a helpful assistant to a Wealth Advisor." | ||||||||||||||||||||||||||||||||||||||||
| agent_instructions = '''You are a helpful assistant to a Wealth Advisor. | ||||||||||||||||||||||||||||||||||||||||
| If the question is unrelated to data but is conversational (e.g., greetings or follow-ups), respond appropriately using context, do not use external tools or perform any web searches for these conversational inputs.''' | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| agent_definition = await client.agents.create_agent( | ||||||||||||||||||||||||||||||||||||||||
| model=ai_agent_settings.model_deployment_name, | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -105,3 +106,46 @@ async def delete_all_agent_instance(cls): | |||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||
| cls._search_agent["client"].close() | ||||||||||||||||||||||||||||||||||||||||
| cls._search_agent = None | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| @classmethod | ||||||||||||||||||||||||||||||||||||||||
| async def get_sql_agent(cls) -> dict: | ||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||
| Get or create a singleton SQLQueryGenerator AzureAIAgent instance. | ||||||||||||||||||||||||||||||||||||||||
| This agent is used to generate T-SQL queries from natural language input. | ||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||
| async with cls._lock: | ||||||||||||||||||||||||||||||||||||||||
| if not hasattr(cls, "_sql_agent") or cls._sql_agent is None: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| agent_instructions = config.SQL_SYSTEM_PROMPT or """ | ||||||||||||||||||||||||||||||||||||||||
| You are an expert assistant in generating T-SQL queries based on user questions. | ||||||||||||||||||||||||||||||||||||||||
| Always use the following schema: | ||||||||||||||||||||||||||||||||||||||||
| 1. Table: Clients (ClientId, Client, Email, Occupation, MaritalStatus, Dependents) | ||||||||||||||||||||||||||||||||||||||||
| 2. Table: InvestmentGoals (ClientId, InvestmentGoal) | ||||||||||||||||||||||||||||||||||||||||
| 3. Table: Assets (ClientId, AssetDate, Investment, ROI, Revenue, AssetType) | ||||||||||||||||||||||||||||||||||||||||
| 4. Table: ClientSummaries (ClientId, ClientSummary) | ||||||||||||||||||||||||||||||||||||||||
| 5. Table: InvestmentGoalsDetails (ClientId, InvestmentGoal, TargetAmount, Contribution) | ||||||||||||||||||||||||||||||||||||||||
| 6. Table: Retirement (ClientId, StatusDate, RetirementGoalProgress, EducationGoalProgress) | ||||||||||||||||||||||||||||||||||||||||
| 7. Table: ClientMeetings (ClientId, ConversationId, Title, StartTime, EndTime, Advisor, ClientEmail) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Rules: | ||||||||||||||||||||||||||||||||||||||||
| - Always filter by ClientId = <provided> | ||||||||||||||||||||||||||||||||||||||||
| - Do not use client name for filtering | ||||||||||||||||||||||||||||||||||||||||
| - Assets table contains snapshots by date; do not sum values across dates | ||||||||||||||||||||||||||||||||||||||||
| - Use StartTime for time-based filtering (meetings) | ||||||||||||||||||||||||||||||||||||||||
| - Only return the raw T-SQL query. No explanations or comments. | ||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+119
to
+137
|
||||||||||||||||||||||||||||||||||||||||
| agent_instructions = config.SQL_SYSTEM_PROMPT or """ | |
| You are an expert assistant in generating T-SQL queries based on user questions. | |
| Always use the following schema: | |
| 1. Table: Clients (ClientId, Client, Email, Occupation, MaritalStatus, Dependents) | |
| 2. Table: InvestmentGoals (ClientId, InvestmentGoal) | |
| 3. Table: Assets (ClientId, AssetDate, Investment, ROI, Revenue, AssetType) | |
| 4. Table: ClientSummaries (ClientId, ClientSummary) | |
| 5. Table: InvestmentGoalsDetails (ClientId, InvestmentGoal, TargetAmount, Contribution) | |
| 6. Table: Retirement (ClientId, StatusDate, RetirementGoalProgress, EducationGoalProgress) | |
| 7. Table: ClientMeetings (ClientId, ConversationId, Title, StartTime, EndTime, Advisor, ClientEmail) | |
| Rules: | |
| - Always filter by ClientId = <provided> | |
| - Do not use client name for filtering | |
| - Assets table contains snapshots by date; do not sum values across dates | |
| - Use StartTime for time-based filtering (meetings) | |
| - Only return the raw T-SQL query. No explanations or comments. | |
| """ | |
| agent_instructions = config.SQL_SYSTEM_PROMPT or SQL_AGENT_FALLBACK_PROMPT |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The singleton pattern implementation lacks proper cleanup. Consider adding a cleanup method similar to delete_all_agent_instance for the SQL agent to prevent resource leaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The retry logic duplicates the same code block twice with only minor variations. Consider extracting this into a reusable function to reduce code duplication.