openmanus.cpp/include/agent_base.h

58 lines
1.4 KiB
C
Raw Permalink Normal View History

2025-03-10 02:38:39 +08:00
#ifndef OPENMANUS_AGENT_BASE_H
#define OPENMANUS_AGENT_BASE_H
#include <string>
#include <vector>
#include <memory>
#include "tool_collection.h"
#include "mcp/include/mcp_message.h"
namespace openmanus {
/**
* @class AgentBase
* @brief
*/
class AgentBase : public std::enable_shared_from_this<AgentBase> {
public:
AgentBase(const std::string& name, const std::string& description);
virtual ~AgentBase() = default;
/**
* @brief
* @param prompt
* @return
*/
virtual std::string run(const std::string& prompt) = 0;
/**
* @brief
* @param tool_name
* @param params
* @return
*/
virtual mcp::json executeToolCall(const std::string& tool_name, const mcp::json& params);
/**
* @brief
* @return
*/
std::string getName() const { return name_; }
/**
* @brief
* @return
*/
std::string getDescription() const { return description_; }
protected:
std::string name_;
std::string description_;
std::string system_prompt_;
std::string next_step_prompt_;
std::unique_ptr<ToolCollection> available_tools_;
};
} // namespace openmanus
#endif // OPENMANUS_AGENT_BASE_H