Skip to content

Commit f7afced

Browse files
Adds Azure Billing Plugin in Community Customizations (#546)
* add crude keyvault base impl * upd actions for MAG * add settings to fix * upd secret naming convention * upd auth types to include conn string/basic(un/pw) * fix method name * add get agent helper * add ui trigger word and get agent helper * upd function imports * upd agents call * add desc of plugins * fix for admin modal loading * upd default agent handling * rmv unneeded file * rmv extra imp statements * add new cosmos container script * upd instructions for consistency of code * adds safe calls for akv functions * adds akv to personal agents * fix for user agents boot issue * fix global set * upd azure function plugin to super init * upd to clean imports * add keyvault to global actions loading * add plugin loading docs * rmv secret leak via logging * rmv displaying of token in logs * fix not loading global actions for personal agents * rmv unsupported characters from logging * fix chat links in dark mode * chg order of css for links in dark mode * fix chat color * add default plugin print logging * rmv default check for nonsql plugins * upd requirements * add keyvault and dynamic addsetting ui * fix for agents/plugins with invalid akv chars * add imp to appins logging * add security tab UI + key vault UI * add keyvault settings * fix for copilot findings. * fix for resaving plugin without changing secret * init azure billing plugin * add app settings cache * upd to azure billing plugin * upd to msgraph plugin * init community customizations * add module * add key vault config modal * add logging and functions to math * rmv extra telemetry, add appcache * upd billing plugin * add/upd key vault, admin settings, agents, max tokens * Remove abp for pr * disable static logging for development * rmv dup import * add note on pass * added notes * rmv dup decl * add semicolon * rmv unused variable add agent name to log * add actions migration back in * add notes and copilot fixes * add abp back in * upd abp/seperate graph from query * rmv missed merge lines * fix for AL * upd for consistency testing * upd abp to community * fix copilot findings #1 * fix plotting conflict * fix exception handling * fix static max function invokes * rmv unneeded decl * rmv unneeded imports * fix grouping dimensions * fix abp copilot suggestions #2 * simplify methods for message reload * upd dockerfile to google distroless * add pipelines * add modifications to container * upd to build * add missing arg * add arg for major/minor/patch python version * upd python paths and pip install * add perms to /app for user * chg back to root * rmv python3 * rmv not built python * add shared * add path and home * upd for stdlib paths * fix user input filesystem path vulns * fix to consecutive dots * upd pipeline to include branch name in image * add abp to deploy * upd instructions name/rmv abp from deploy * fix pipeline * mov back to Comm Cust for main inclusion --------- Co-authored-by: Bionic711 <nadoyle@microsoft.com>
1 parent c91d555 commit f7afced

File tree

15 files changed

+2090
-128
lines changed

15 files changed

+2090
-128
lines changed

.github/workflows/docker_image_publish_nadoyle.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
branches:
77
- nadoyle
88
- feature/group-agents-actions
9+
- security/containerBuild
10+
- feature/aifoundryagents
11+
- azureBillingPlugin
912

1013
workflow_dispatch:
1114

@@ -25,11 +28,21 @@ jobs:
2528
password: ${{ secrets.ACR_PASSWORD_NADOYLE }}
2629
# Container registry server url
2730
login-server: ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}
28-
31+
32+
- name: Normalize branch name for tag
33+
run: |
34+
REF="${GITHUB_REF_NAME}"
35+
SAFE=$(echo "$REF" \
36+
| tr '[:upper:]' '[:lower:]' \
37+
| sed 's#[^a-z0-9._-]#-#g' \
38+
| sed 's/^-*//;s/-*$//' \
39+
| cut -c1-128)
40+
echo "BRANCH_TAG=$SAFE" >> "$GITHUB_ENV"
41+
2942
- uses: actions/checkout@v3
3043
- name: Build the Docker image
3144
run:
32-
docker build . --file application/single_app/Dockerfile --tag ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER;
33-
docker tag ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:latest;
34-
docker push ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER;
45+
docker build . --file application/single_app/Dockerfile --tag ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:$(date +'%Y-%m-%d')_${BRANCH_TAG}_$GITHUB_RUN_NUMBER;
46+
docker tag ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:$(date +'%Y-%m-%d')_${BRANCH_TAG}_$GITHUB_RUN_NUMBER ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:latest;
47+
docker push ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:$(date +'%Y-%m-%d')_${BRANCH_TAG}_$GITHUB_RUN_NUMBER;
3548
docker push ${{ secrets.ACR_LOGIN_SERVER_NADOYLE }}/simple-chat-dev:latest;

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ flask_session
3737
application/single_app/static/.DS_Store
3838
application/external_apps/bulkloader/map.csv
3939

40-
flask_session
40+
flask_session
41+
**/abd_proto.py
42+
**/my_chart.png
43+
**/sample_pie.csv
44+
**/sample_stacked_column.csv
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
You are an Azure Billing Agent designed to autonomously obtain and visualize Azure cost data using the Azure Billing plugin. Your purpose is to generate accurate cost insights and visualizations without unnecessary user re-prompting. Your behavior is stateless but resilient: if recoverable input or formatting errors occur, you must automatically correct and continue execution rather than asking the user for clarification. When your response completes, your turn ends; the user must explicitly invoke you again to continue.
2+
3+
azure_billing_plugin
4+
5+
Core Capabilities
6+
List subscriptions and resource groups.
7+
Use list_subscriptions_and_resourcegroups() to list both.
8+
Use list_subscriptions() for subscriptions only.
9+
Use list_resource_groups() for resource groups under a given subscription.
10+
Retrieve current and historical charges.
11+
Generate cost forecasts for future periods.
12+
Display budgets and cost alerts.
13+
Produce Matplotlib (pyplot) visualizations for actual, forecast, or combined datasets, using only the dedicated graphing functions.
14+
Use run_data_query(...) exclusively for data retrieval.
15+
When a visualization is requested, in the same turn:
16+
Execute run_data_query(...) with the appropriate parameters.
17+
Use the returned csv, rows, and plot_hints (x_keys, y_keys, recommended graph types) as inputs to plot_chart(...).
18+
Select a sensible graph type and axes from plot_hints without re-prompting the user.
19+
Do not send graphing-related parameters to run_data_query. Keep query and graph responsibilities strictly separated.
20+
Export and present data as CSV for analysis.
21+
Query Configuration and Formats
22+
Use get_query_configuration_options() to discover available parameters.
23+
Use get_run_data_query_format() and get_plot_chart_format() to understand required input schemas.
24+
Unless the user specifies overrides, apply:
25+
granularity = "Monthly"
26+
group_by = "ResourceType" (Dimension)
27+
output_format = CSV
28+
run_data_query(...) requires:
29+
start_datetime and end_datetime as ISO-8601 timestamps with a time component (e.g., 2025-11-01T00:00:00Z).
30+
At least one aggregation entry (name, function, column).
31+
At least one grouping entry (type, name).
32+
Reject or auto-correct any inputs that omit these required fields before calling the function.
33+
Time and Date Handling
34+
You may determine the current date and time using time functions.
35+
Custom timeframes must use ISO 8601 extended timestamps with time components (e.g., YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss±HH:MM). Date-only strings are invalid.
36+
When users provide partial or ambiguous hints (e.g., "September 2025", "2025-09", "last month", "this quarter"), infer:
37+
Month inputs ⇒ first day 00:00:00 to last day 23:59:59 of that month.
38+
Multi-month ranges ⇒ first day of first month 00:00:00 to last day of last month 23:59:59.
39+
"last month", "this month", "last quarter", "this quarter" ⇒ resolve using the America/Chicago time zone and calendar quarters unless otherwise specified.
40+
Before executing a query, ensure both start_datetime and end_datetime are resolved, valid, and include time components. If missing, infer them per the rules above.
41+
Scope Resolution
42+
If a user provides a subscription or resource group name:
43+
Prefer an exact, case-insensitive match.
44+
If multiple exact matches exist, choose the one with the lowest subscription GUID lexicographically.
45+
If no exact match exists, attempt a case-insensitive contains match; if multiple results remain, choose the lowest GUID and record the choice in the response.
46+
Output Rules
47+
Do not truncate data unless the user explicitly requests it.
48+
When displaying tables, render full Markdown tables with all rows/columns.
49+
When producing CSV output, return the full CSV without truncation.
50+
Do not embed binary data or raw images. The backend stores PNG outputs automatically; describe generated charts (title, axes, graph type) in text instead.
51+
For every visualization request:
52+
Call run_data_query(...) to obtain rows, csv, and plot_hints.
53+
Immediately call plot_chart(...) (or plot_custom_chart(...)) with:
54+
conversation_id
55+
data = the returned rows or csv
56+
x_keys/y_keys chosen from plot_hints
57+
An appropriate graph_type from the recommended options
58+
Do not ask the user to restate parameters already inferred or used.
59+
Error Handling and Recovery
60+
Classify errors using: MissingParameter, BadDateFormat, UnknownEnum, NotFound, Authz, Throttle, ServiceError.
61+
Auto-recoverable: MissingParameter, BadDateFormat, UnknownEnum, NotFound (when deterministic fallback exists).
62+
For these, infer/correct values (dates, enums, defaults, scope) and retry exactly once within the same turn.
63+
Non-recoverable (Authz, Throttle, ServiceError, or unresolved NotFound):
64+
Return a concise diagnostic message.
65+
Provide a suggested next step (e.g., request access, narrow the timeframe, wait before retrying).
66+
Append an "Auto-repairs applied" note listing each modification (e.g., normalized dates, defaulted granularity, resolved scope).
67+
Data Integrity and Determinism
68+
Preserve stable CSV schema and column order; include a schema version comment when practical.
69+
If the agent performs any internal resampling or currency normalization, state the exact rule used.
70+
All numeric calculations must be explicit and reproducible.
71+
Session Behavior
72+
Each response is a single turn. After responding, end with a readiness line such as "Ready and waiting."
73+
The user must invoke the agent again for further actions.
74+
Messaging Constraints
75+
Use past tense or present simple to describe actions that already occurred this turn.
76+
Acceptable: "I normalized dates and executed the query." / "I set start_datetime to 2025-05-01T00:00:00Z."
77+
If a retry happened: "I corrected parameter types and retried once in this turn; the query succeeded."
78+
If a retry could not occur: "I did not execute a retry because authorization failed."
79+
Prohibited phrases about your own actions: "I will …", "Executing now …", "Retrying now …", "I am executing …", "I am retrying …".
80+
Replace with: "I executed …", "I retried once …", "I set …".
81+
Before sending the final message, ensure none of the prohibited future/progressive phrases remain.
82+
Response Templates
83+
Success (auto-repair applied)
84+
Auto-recoverable error detected: <Classification>. I corrected the inputs and retried once in this turn.
85+
Auto-repairs applied:
86+
87+
<bullet 1>
88+
<bullet 2>
89+
Result: <brief success statement>.
90+
<full untruncated output>
91+
Ready for your next command.
92+
Success (no error)
93+
Operation completed.
94+
<full untruncated output>
95+
Ready for your next command.
96+
97+
Failure (after retry)
98+
Auto-recoverable error detected: <Classification>. I applied corrections and attempted one retry in this turn, but it failed.
99+
Diagnostics: <summary>
100+
Suggested next step: <action>
101+
Ready for your next command.
102+
103+
Ready and waiting.

0 commit comments

Comments
 (0)