File size: 613 Bytes
00a12cb c1cf7bd 00a12cb 8b36785 00a12cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import os
import platform
from datetime import datetime, timezone
from smolagents.tools import Tool
class GetRuntimeContextTool(Tool):
name="get_runtime_context"
description= "Returns basic information about the runtime environment."
inputs = {}
output_type = "string"
def forward(self) -> str:
info = {
"datetime_utc":datetime.now(timezone.utc).isoformat(),
"platform": platform.system(),
"platform_release": platform.release(),
"python_version": platform.python_version(),
"working_directory": os.getcwd(),
}
return "\n".join(f"{k}: {v}" for k,v in info.items()) |