ForestHub SDK 0.1.0
C++14 LLM SDK for PC and embedded platforms
Loading...
Searching...
No Matches
agent.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (c) 2026 ForestHub. All rights reserved.
3// For commercial licensing, visit https://github.com/ForestHubAI/fh-sdk
4
5#ifndef FORESTHUB_AGENT_AGENT_HPP
6#define FORESTHUB_AGENT_AGENT_HPP
7
10
11#include <memory>
12#include <string>
13#include <vector>
14
19
20namespace foresthub {
21namespace agent {
22
24class Runner;
25
27class Agent {
28public:
30 explicit Agent(std::string name);
31
34
37
40
42 Agent& WithTools(std::vector<std::shared_ptr<core::Tool>> tools);
43
45 Agent& AddTool(std::shared_ptr<core::Tool> tool);
46
50 std::shared_ptr<core::ExternalTool> FindExternalTool(const std::string& name) const;
51
58 std::shared_ptr<core::Tool> AsTool(std::string tool_name, std::string description,
59 const std::shared_ptr<Runner>& runner);
60
62 const std::string& name() const { return name_; }
64 const std::string& instructions() const { return instructions_; }
66 const foresthub::Optional<core::ResponseFormat>& response_format() const { return response_format_; }
68 const core::Options& options() const { return options_; }
70 const std::vector<std::shared_ptr<core::Tool>>& tools() const { return tools_; }
71
72private:
73 std::string name_;
74 std::string instructions_;
76 core::Options options_;
77 std::vector<std::shared_ptr<core::Tool>> tools_;
78};
79
80} // namespace agent
81} // namespace foresthub
82
83#endif // FORESTHUB_AGENT_AGENT_HPP
Agent & WithTools(std::vector< std::shared_ptr< core::Tool > > tools)
Replace all tools with the given list.
const core::Options & options() const
Definition agent.hpp:68
const std::string & name() const
Definition agent.hpp:62
Agent & WithResponseFormat(core::ResponseFormat format)
Set the structured output format.
const std::vector< std::shared_ptr< core::Tool > > & tools() const
Definition agent.hpp:70
Agent & WithInstructions(std::string instructions)
Set the system prompt for this agent.
Agent & AddTool(std::shared_ptr< core::Tool > tool)
Append a tool to the agent's tool list.
const foresthub::Optional< core::ResponseFormat > & response_format() const
Definition agent.hpp:66
Agent(std::string name)
Construct an agent with the given display name.
std::shared_ptr< core::ExternalTool > FindExternalTool(const std::string &name) const
Search for an ExternalTool by name within the agent's tools.
Agent & WithOptions(core::Options options)
Set generation parameters (temperature, max_tokens, etc.).
std::shared_ptr< core::Tool > AsTool(std::string tool_name, std::string description, const std::shared_ptr< Runner > &runner)
Convert this agent into a tool that other agents can invoke.
const std::string & instructions() const
Definition agent.hpp:64
Manages the agent execution loop: LLM calls, tool dispatch, and handoffs.
Definition runner.hpp:55
ChatRequest and ChatResponse types with fluent builder API.
Agent framework: multi-turn execution with tool calling and handoffs.
Top-level namespace for the ForestHub SDK.
Minimal Optional<T> polyfill for C++14 compatibility.
Model-specific generation options (temperature, max_tokens, etc.).
Minimal Optional<T> polyfill for C++14 compatibility.
Definition optional.hpp:21
Model-specific generation options.
Definition options.hpp:17
Structured output format with JSON schema constraints.
Definition types.hpp:32
Tool system: ExternalTool, FunctionTool, WebSearch, and tool call types.