Agents 0.0.2
Edge AI Agents SDK
Loading...
Searching...
No Matches
tool_registry.h
1
10#pragma once
11
12#include <agents-cpp/tool.h>
13#include <agents-cpp/tools/wiki_tool.h>
14#include <map>
15#include <memory>
16#include <vector>
17
18namespace agents {
23namespace tools {
24
31class ToolRegistry {
32public:
33 ToolRegistry() = default;
34 ~ToolRegistry() = default;
35
40 void registerTool(std::shared_ptr<Tool> tool);
41
47 std::shared_ptr<Tool> getTool(const String& name) const;
48
53 std::vector<std::shared_ptr<Tool>> getAllTools() const;
54
60 bool hasTool(const String& name) const;
61
66 void removeTool(const String& name);
67
71 void clear();
72
78
83 static ToolRegistry& global();
84
85private:
86 std::map<String, std::shared_ptr<Tool>> tools_;
87};
88
95
101std::shared_ptr<Tool> createShellCommandTool();
102
108std::shared_ptr<Tool> createWebSearchTool();
109
115std::shared_ptr<Tool> createWikipediaTool();
116
122std::shared_ptr<Tool> createPythonTool();
123
129std::shared_ptr<Tool> createFileReadTool();
130
136std::shared_ptr<Tool> createFileWriteTool();
137
138} // namespace tools
139} // namespace agents
Registry for tools that agents can use.
Definition tool_registry.h:31
std::vector< std::shared_ptr< Tool > > getAllTools() const
Get all registered tools.
void registerTool(std::shared_ptr< Tool > tool)
Register a tool.
bool hasTool(const String &name) const
Check if a tool is registered.
std::shared_ptr< Tool > getTool(const String &name) const
Get a tool by name.
void removeTool(const String &name)
Remove a tool.
static ToolRegistry & global()
Get the global tool registry.
JsonObject getToolSchemas() const
Get tool schemas as JSON.
void clear()
Clear all tools.
Tools Namespace.
Definition file_tool.h:15
std::shared_ptr< Tool > createWikipediaTool()
Creates a tool for retrieving information from Wikipedia.
std::shared_ptr< Tool > createShellCommandTool()
Creates a tool for executing shell commands.
std::shared_ptr< Tool > createWebSearchTool()
Creates a tool for performing web searches.
std::shared_ptr< Tool > createFileReadTool()
Creates a tool for reading files.
std::shared_ptr< Tool > createPythonTool()
Creates a tool for running Python code.
std::shared_ptr< Tool > createFileWriteTool()
Creates a tool for writing files.
void registerStandardTools(ToolRegistry &registry)
Create and register standard tools.
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