feat: Add network activity monitoring to tool execution verifier
This PR adds network activity monitoring to the tool execution verification system to detect when tools fabricate results without making actual network calls.
Summary
- Add NetworkEvent dataclass to capture network request evidence
- Add NetworkMonitor class to hook HTTP libraries and capture activity
- Enhance ToolExecutionWrapper to include network monitoring during execution
- Update ExecutionRecord to store network activity evidence
- Enhance complete_execution to accept and store network events
- Add AgentExecutionInterface and enhance_tool_for_verification utilities
Verification
This addresses the need to verify that tools making network requests actually execute those requests rather than fabricating responses. The system can now distinguish between:
- LIKELY_REAL: Network activity detected during tool execution
- LIKELY_FAKE: No network activity detected when network calls were expected
Backward Compatibility
All existing functionality is preserved and all original tests continue to pass.
[!NOTE] Add HTTP network activity monitoring to tool execution verification and store captured events with execution records, with docs, demos, and tests.
- Verification utilities:
- Add
NetworkEventandNetworkMonitorto capture HTTP activity by hookingrequests/urllib.- Enhance
ToolExecutionWrapperto monitor executions and persist events viaExecutionRegistry.complete_execution; extendExecutionRecordwithnetwork_activity.- Introduce
AgentExecutionInterfaceand helper wrappers insrc/crewai/utilities/tool_execution_verifier.py.- Documentation:
- New guides:
NETWORK_MONITORING_FEATURE.md,src/crewai/utilities/NETWORK_MONITORING_README.md(design, usage, verification logic).- Examples & tests:
- Add
src/crewai/utilities/demo_network_monitoring_feature.pyandsrc/crewai/utilities/test_network_monitoring_concept.py.- Adjust existing tests for clearer exception assertions and minor security annotations.
Written by Cursor Bugbot for commit 2c267e3b0780422fde741bb70160749aef27686f. This will update automatically on new commits. Configure here.
This PR is stale because it has been open for 45 days with no activity.