-
Notifications
You must be signed in to change notification settings - Fork 10
feat: First version of the sam-powerBI query tool plugin. #159
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
349adcd
First version of the sam-powerBI query tool plugin.
peetkes 90a47a8
Adjusted readme, added sonar-project.properties and test-placeholder
peetkes b997d95
fixed issue with toml file
peetkes 056ba1a
Added unittests for sam-powerbi
peetkes 420041f
refactored 2 functions in tools.py to reduce the cognitive complexity
peetkes 1f5650b
Ran add_missing_plugins.py
peetkes 91e01c1
test init
cyrus2281 93575f4
Added required pytest-json-ctrf and pytest-xdist dependencies to hatc…
peetkes 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
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
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
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
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
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
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,17 @@ | ||
| # Configuration used for fossa scan | ||
| version: 3 | ||
|
|
||
| project: | ||
| locator: SolaceLabs_sam-powerbi | ||
| id: SolaceLabs_sam-powerbi | ||
| name: sam-powerbi | ||
| labels: | ||
| - solaceai | ||
| - solace-agent-mesh-core-plugins | ||
|
|
||
| vendoredDependencies: | ||
| forceRescans: false | ||
| scanMethod: CLILicenseScan | ||
|
|
||
| telemetry: | ||
| scope: full |
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,55 @@ | ||
| # SamPowerbi SAM Plugin | ||
|
|
||
| PowerBI executeQueries tool with MSAL device-code delegated auth | ||
|
|
||
| This is a plugin for Solace Agent Mesh (SAM). | ||
|
|
||
| ## About Solace Agent Mesh | ||
|
|
||
| Solace Agent Mesh (SAM) is an open-source framework for building event-driven, multi-agent AI systems where specialized agents collaborate on complex tasks. It provides a standardized way for agents to communicate, share data, and integrate with external systems while keeping components loosely coupled and production-ready. | ||
|
|
||
| SAM helps you: | ||
|
|
||
| - Build event-driven multi-agent systems on Solace Event Mesh | ||
| - Connect agents, tools, gateways, and services through a common runtime | ||
| - Extend projects with installable plugins such as `sam-nuclia-tool` | ||
|
|
||
| Learn more in the [Solace Agent Mesh documentation](https://solacelabs.github.io/solace-agent-mesh/) and the [main project repository](https://github.com/SolaceLabs/solace-agent-mesh). | ||
|
|
||
| ## Features | ||
|
|
||
| This agent connects to Power BI via the Power BI REST API to retrieve, analyze, and summarize data from reports and datasets. | ||
| It can execute DAX queries against published datasets, fetch report metadata, and translate natural language questions into structured queries — returning insights without requiring the user to navigate the Power BI interface directly. | ||
|
|
||
| - **Natural Language to DAX query:** Translate the user's question into a valid DAX query | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| Set the following environment variables for your MongoDB connection: | ||
|
|
||
| ```bash | ||
| export AZURE_TENANT_ID="your azure tenant id" | ||
| export POWERBI_CLIENT_ID="your powerBI client id" | ||
| export POWERBI_WORKSPACE_ID="your powerBI workspace id" | ||
| export POWERBI_SEMANTIC_MODEL_ID="your semantic model id" | ||
| export POWERBI_TOKEN_CACHE="your location for your token-cahe, default /tmp/samv2/powerbi_msal_cache.json" | ||
| ``` | ||
|
|
||
| ## Build | ||
|
|
||
| To build the PowerBI Agent plugin, run the following command: | ||
| ```bash\ | ||
| sam plugin build | ||
| ``` | ||
|
|
||
| ## Installation | ||
|
|
||
| To install the PowerBI Agent plugin, run the following command: | ||
|
|
||
| ```bash | ||
| sam plugin install sam-powerbi | ||
| ``` | ||
|
|
||
| This will create a new component configuration at `configs/plugins/<your-new-component-name-kebab-case>.yaml`. |
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,104 @@ | ||
| # Plugin Metadata: | ||
| # Name: sam-powerbi | ||
| # Version: 0.1.0 | ||
| # Description: A PowerBI plugin for executing queries with MSAL device-code delegated auth | ||
| # Author: SolaceLabs solacelabs@solace.com | ||
|
|
||
| log: | ||
| stdout_log_level: INFO | ||
| log_file_level: DEBUG | ||
| log_file: __COMPONENT_KEBAB_CASE_NAME__.log | ||
|
|
||
| # To use the `shared_config.yaml` file, uncomment the following line and remove the `shared_config` section below. | ||
| # !include ../shared_config.yaml | ||
| shared_config: | ||
| - broker_connection: &broker_connection | ||
| dev_mode: ${SOLACE_DEV_MODE, false} | ||
| broker_url: ${SOLACE_BROKER_URL, ws://localhost:8008} | ||
| broker_username: ${SOLACE_BROKER_USERNAME, default} | ||
| broker_password: ${SOLACE_BROKER_PASSWORD, default} | ||
| broker_vpn: ${SOLACE_BROKER_VPN, default} | ||
| temporary_queue: ${USE_TEMPORARY_QUEUES, true} | ||
|
|
||
| - models: | ||
| general: &general_model | ||
| # This dictionary structure tells ADK to use the LiteLlm wrapper. | ||
| # 'model' uses the specific model identifier your endpoint expects. | ||
| model: ${LLM_SERVICE_GENERAL_MODEL_NAME} # Use env var for model name | ||
| # 'api_base' tells LiteLLM where to send the request. | ||
| api_base: ${LLM_SERVICE_ENDPOINT} # Use env var for endpoint URL | ||
| # 'api_key' provides authentication. | ||
| api_key: ${LLM_SERVICE_API_KEY} # Use env var for API key | ||
|
|
||
| - services: | ||
| # Default session service configuration | ||
| session_service: &default_session_service | ||
| type: "memory" | ||
| default_behavior: "PERSISTENT" | ||
|
|
||
| # Default artifact service configuration | ||
| artifact_service: &default_artifact_service | ||
| type: "filesystem" | ||
| base_path: "/tmp/samv2" | ||
| artifact_scope: namespace # Or "namespace", "app", "custom" | ||
|
|
||
| apps: | ||
| - name: __COMPONENT_KEBAB_CASE_NAME__-app | ||
| app_base_path: . | ||
| app_module: solace_agent_mesh.agent.sac.app | ||
| broker: | ||
| <<: *broker_connection | ||
|
|
||
| # App Level Config | ||
| app_config: | ||
| namespace: ${NAMESPACE} | ||
| supports_streaming: true | ||
| agent_name: "__COMPONENT_PASCAL_CASE_NAME__" | ||
| display_name: "__COMPONENT_SPACED_CAPITALIZED_NAME__ Agent" | ||
| model: *general_model | ||
| model_provider: | ||
| - "general" | ||
|
|
||
| instruction: | | ||
| You're __COMPONENT_SPACED_CAPITALIZED_NAME__ agent. | ||
| Configure its specific instructions here. | ||
|
|
||
| tools: | ||
| - group_name: artifact_management | ||
| tool_type: builtin-group | ||
|
|
||
| # --- Example Python Tools (defined in tools.py) --- | ||
| # - tool_type: python | ||
| # component_module: sam_powerbi.tools | ||
| # component_base_path: . # Relative to where the agent runs | ||
| # function_name: example_text_processor_tool | ||
| # tool_config: | ||
| # prefix: "PluginProcessed: " | ||
|
|
||
| # - tool_type: python | ||
| # component_module: sam_powerbi.tools | ||
| # component_base_path: . | ||
| # function_name: example_file_creator_tool | ||
| # tool_config: {} # Add specific config if needed by the tool | ||
|
|
||
| session_service: *default_session_service | ||
| artifact_service: *default_artifact_service | ||
|
|
||
| artifact_handling_mode: "reference" | ||
| enable_embed_resolution: true | ||
| enable_artifact_content_instruction: true | ||
|
|
||
| agent_card: | ||
| description: "PowerBI executeQueries tool with MSAL device-code delegated auth" | ||
| defaultInputModes: ["text"] | ||
| defaultOutputModes: ["text"] | ||
| skills: [] # Remove brackets after adding entries | ||
| # - id: "example_tool" | ||
| # name: "Example Tool" | ||
| # description: "An example tool provided by the SamPowerbi plugin." | ||
|
|
||
| agent_card_publishing: { interval_seconds: 10 } | ||
| agent_discovery: { enabled: false } | ||
| inter_agent_communication: | ||
| allow_list: [] | ||
| request_timeout_seconds: 30 |
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,62 @@ | ||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [tool.hatch.metadata] | ||
| allow-direct-references = true | ||
|
|
||
| [tool.sam_powerbi.metadata] | ||
| type = "tool" | ||
|
|
||
| [project] | ||
| name = "sam_powerbi" | ||
| version = "0.1.0" | ||
| authors = [ | ||
| { name="SolaceLabs", email="solacelabs@solace.com" }, | ||
| ] | ||
| description = "A PowerBI plugin for executing queries with MSAL device-code delegated auth" | ||
| readme = "README.md" | ||
| requires-python = ">=3.10.16,<3.14" | ||
| classifiers = [ | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "License :: OSI Approved :: Apache Software License", | ||
| "Operating System :: OS Independent", | ||
| "Topic :: Software Development :: Libraries :: Application Frameworks", | ||
| ] | ||
| dependencies = [ | ||
| "msal>=1.34", | ||
| "httpx>=0.27", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/SolaceLabs/solace-agent-mesh" | ||
| Documentation = "https://solacelabs.github.io/solace-agent-mesh/" | ||
| Repository = "https://github.com/SolaceLabs/solace-agent-mesh-core-plugins" | ||
| Issues = "https://github.com/SolaceLabs/solace-agent-mesh-core-plugins/issues" | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/sam_powerbi"] | ||
| src-path = "src" | ||
|
|
||
| [tool.hatch.build.targets.wheel.force-include] | ||
| "config.yaml" = "sam_powerbi/config.yaml" | ||
| "README.md" = "sam_powerbi/README.md" | ||
| "pyproject.toml" = "sam_powerbi/pyproject.toml" | ||
|
|
||
| [tool.pytest.ini_options] | ||
| asyncio_mode = "auto" | ||
| addopts = "--tb=short --strict-markers --disable-warnings -p pytest_asyncio" | ||
|
|
||
| [tool.hatch.envs.hatch-test] | ||
| dependencies = [ | ||
| "pytest>=8.0.0", | ||
| "pytest-asyncio>=0.23.0", | ||
| "pytest-mock>=3.0.0", | ||
| "pytest-cov>=4.0.0", | ||
| "pytest-json-ctrf>=0.1.0", | ||
| "pytest-xdist>=3.5.0", | ||
| "sam-test-infrastructure @ git+https://github.com/SolaceLabs/solace-agent-mesh#subdirectory=tests/sam-test-infrastructure" | ||
| ] | ||
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,35 @@ | ||
| # SonarQube Configuration for sam-powerbi | ||
| sonar.projectKey=SolaceLabs_sam-powerbi | ||
| sonar.projectName=sam-powerbi | ||
|
|
||
| # Source and Test Directories | ||
| sonar.sources=src/ | ||
| sonar.tests=tests/ | ||
|
|
||
| # Python Configuration | ||
| sonar.python.version=3.10,3.11,3.12,3.13 | ||
|
|
||
| # Coverage Configuration | ||
| sonar.python.coverage.reportPaths=**/coverage.xml | ||
|
|
||
| # Source Encoding | ||
| sonar.sourceEncoding=UTF-8 | ||
|
|
||
| # Exclusions | ||
| sonar.exclusions=\ | ||
| **/__pycache__/**,\ | ||
| **/dist/**,\ | ||
| **/.hatch/**,\ | ||
| **/build/**,\ | ||
| **/*.egg-info/**,\ | ||
| **/tests/** | ||
|
|
||
| # Duplication Exclusions | ||
| sonar.cpd.exclusions=\ | ||
| **/tests/** | ||
|
|
||
| # Test Inclusions | ||
| sonar.test.inclusions=\ | ||
| **/tests/**/*.py,\ | ||
| **/test_*.py,\ | ||
| **/*_test.py |
Empty file.
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.