IreneInContext commited on
Commit
00a12cb
·
verified ·
1 Parent(s): f239dd7

Create get_runtime_context

Browse files
Files changed (1) hide show
  1. tools/get_runtime_context +21 -0
tools/get_runtime_context ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import platform
3
+ from datetime import datetime, timezone
4
+ from smolagents.tools import Tool
5
+
6
+ class GetRuntimeContext(Tool):
7
+ name="get_runtime_context"
8
+ description= "Returns basic information about the runtime environment."
9
+ inputs = {}
10
+ output_type = "string"
11
+
12
+ def forward(self) –> str:
13
+ info = {
14
+ "datetime_utc":datetime.now(timezone.utc).isoformat(),
15
+ "platform": platform.system(),
16
+ "platform_release": platform.release(),
17
+ "python_version": platform.python_version(),
18
+ "working_directory": os.getcwd(),
19
+
20
+ }
21
+ return "\n".join(f"{k}: {v}" for k,v in info.items())