MCPcopy Index your code
hub / github.com/AI45Lab/Code / main

Function main

examples/test_skill_tool.py:24–146  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22from a3s_code import Agent
23
24async def main():
25 print("=" * 80)
26 print("Skill Tool Test with Kimi Model")
27 print("=" * 80)
28
29 # Set up Kimi API credentials from environment
30 if "KIMI_API_KEY" not in os.environ:
31 raise RuntimeError("KIMI_API_KEY environment variable not set")
32 if "KIMI_BASE_URL" not in os.environ:
33 raise RuntimeError("KIMI_BASE_URL environment variable not set")
34
35 # Create a temporary workspace with test files
36 with tempfile.TemporaryDirectory() as tmpdir:
37 workspace = Path(tmpdir)
38
39 # Create test files
40 test_file = workspace / "test.txt"
41 test_file.write_text("Hello from Skill Tool test!\nThis is line 2.\nThis is line 3.")
42
43 readme = workspace / "README.md"
44 readme.write_text("# Test Project\n\nThis is a test project for Skill tool.")
45
46 # Create a test skill
47 skills_dir = workspace / "skills"
48 skills_dir.mkdir()
49
50 skill_file = skills_dir / "file-reader.md"
51 skill_file.write_text("""---
52name: file-reader
53description: Read and analyze files
54allowed-tools: read(*), grep(*)
55---
56
57# File Reader Skill
58
59You are a file reading specialist. You can:
60- Read files using the read tool
61- Search for patterns using grep
62- Analyze and summarize file contents
63
64You CANNOT:
65- Write files
66- Execute bash commands
67- Edit files
68""")
69
70 print(f"\n📁 Workspace: {workspace}")
71 print(f"📄 Test files created:")
72 print(f" - test.txt")
73 print(f" - README.md")
74 print(f" - skills/file-reader.md")
75
76 # Create agent with Kimi model
77 print("\n🤖 Creating agent with Kimi model...")
78 agent = Agent.create(str(Path(__file__).parent / "agent_kimi.acl"))
79
80 # Create session with the test skill
81 print("📝 Creating session with file-reader skill...")

Callers 1

test_skill_tool.pyFile · 0.70

Calls 5

write_textMethod · 0.45
createMethod · 0.45
sessionMethod · 0.45
sendMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected