Agents 0.0.2
Edge AI Agents SDK
Loading...
Searching...
No Matches
python_tool.h
1
10#pragma once
11
12#include <agents-cpp/tool.h>
13
14namespace agents {
15namespace tools {
16
20class PythonTool : public Tool {
21public:
26
32 ToolResult execute(const JsonObject& params) const override;
33
35protected:
39 void setupParameters();
40
46 bool validatePythonCode(const String& code) const;
47
53 bool isDangerousPythonCode(const String& code) const;
54
60 ToolResult executePythonCode(const String& code) const;
61
70 ToolResult formatPythonResult(const String& code, const String& output, bool success, const String& error = "") const;
72private:
76 static bool pythonInitialized;
77
81 static void initializePython();
82
86 static void finalizePython();
87};
88
89} // namespace tools
90} // namespace agents
Tool(const String &name, const String &description)
Constructor.
PythonTool()
Construct a new Python Tool object.
ToolResult execute(const JsonObject &params) const override
Execute the Python tool.
Tools Namespace.
Definition file_tool.h:15
Framework Namespace.
Definition agent.h:18
nlohmann::json JsonObject
JSON object type.
Definition types.h:39
std::string String
String type.
Definition types.h:27
Result of a tool execution.
Definition tool.h:22