Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.
Python agent-evaluationaiai-alignmentai-evaluationai-governanceai-safetyclidiagnostic-tooleu-ai-acthallucination-detectioniso-42001llm-evaluationllm-securitynist-ai-rmfowasp-llmprompt-injectionpythonresponsible-airisk-assessmentrisk-management
fix: handle blank tool descriptions during discovery (#218)
Rudy Mizrahi Celekli12d9f7610656
diff --git a/ifixai/core/discovery.py b/ifixai/core/discovery.pyindex f32eec1..b1fb9da 100644--- a/ifixai/core/discovery.py+++ b/ifixai/core/discovery.py@@ -98,8 +98,9 @@ async def discover_system(tools: list[Tool] = []for info in tool_infos:+ description_words = info.description.lower().split()risk = info.risk_level or RISK_FROM_CATEGORY.get(- info.description.lower().split()[0] if info.description else "",+ description_words[0] if description_words else "","medium",)tools.append(Tool(diff --git a/ifixai/tests/core/test_discovery_blank_descriptions.py b/ifixai/tests/core/test_discovery_blank_descriptions.pynew file mode 100644index 0000000..43327b0--- /dev/null+++ b/ifixai/tests/core/test_discovery_blank_descriptions.py@@ -0,0 +1,24 @@+import asyncio+import json++import pytest++from ifixai.core.discovery import discover_fixture, discover_system+from ifixai.core.types import ProviderConfig+from ifixai.providers.governance_fixture import GovernanceFixture+from ifixai.providers.resolver import resolve_provider, wrap_with_governance++[email protected]('discover', [discover_fixture, discover_system])[email protected]('description,risk,expected_risk', [('', '', 'medium'), ('read owned document', '', 'low'), (' ', '', 'medium'), ('\t\n', '', 'medium'), (' ', 'high', 'high')])+def test_native_declared_governance_discovery(tmp_path,description,risk,expected_risk,discover):+ import yaml+ path=tmp_path/'governance.yaml'+ path.write_text(yaml.safe_dump({'tools':[{'tool_id':'owned-read','name':'read_document','description':description,'risk_level':risk}]}))+ governance=GovernanceFixture.load(str(path))+ provider=wrap_with_governance(resolve_provider('mock'),governance)+ fixture=asyncio.run(discover(provider,ProviderConfig(provider='mock')))+ print(json.dumps({'description':description,'tools':[v.model_dump() for v in fixture.tools]}))+ assert len(fixture.tools)==1+ assert fixture.tools[0].tool_id=='owned-read'+ assert fixture.tools[0].risk_level==expected_risk