-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_tool_creator.py
More file actions
54 lines (43 loc) · 1.67 KB
/
Copy pathtest_tool_creator.py
File metadata and controls
54 lines (43 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Test script for tool creator agent."""
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parent
sys.path.insert(0, str(PROJECT_ROOT / "src"))
from honeymcp.core.tool_creator import ToolCreatorAgent
# Test the ReAct agent with a simple tool description
description = "dump container registry credentials and access tokens"
print("Testing Tool Creator Agent")
print("=" * 60)
print(f"Description: {description}\n")
agent = ToolCreatorAgent()
success, tool_spec, errors = agent.create_tool(description)
if success:
print("✅ Tool creation successful!")
print(f"\nTool Name: {tool_spec.name}")
print(f"Description: {tool_spec.description}")
print(f"Category: {tool_spec.attack_category}")
print(f"Threat Level: {tool_spec.threat_level}")
print(f"Parameters: {list(tool_spec.parameters.get('properties', {}).keys())}")
# Test response generator
print("\n" + "=" * 60)
print("Testing Response Generator:")
print("=" * 60)
test_response = tool_spec.response_generator({})
print(test_response[:300] + "..." if len(test_response) > 300 else test_response)
# Show agent reasoning
state = agent.get_state_summary()
print("\n" + "=" * 60)
print("Agent Reasoning Process:")
print("=" * 60)
for i, thought in enumerate(state["reasoning"], 1):
print(f"{i}. {thought}")
if state["reflections"]:
print("\nReflections:")
for i, reflection in enumerate(state["reflections"], 1):
print(f"{i}. {reflection}")
else:
print("❌ Tool creation failed!")
for error in errors:
print(f" - {error}")
sys.exit(1)
print("\n✅ All tests passed!")