Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
tool_call_history.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
16#pragma once
17
18#include <cstddef>
19#include <mutex>
20#include <shared_mutex>
21#include <string>
22#include <vector>
23
24namespace entropic {
25
36 size_t sequence;
37 std::string tool_name;
38 std::string params_summary;
39 std::string status;
40 std::string result_summary;
41 double elapsed_ms;
42 std::string error_detail;
44};
45
63public:
69 explicit ToolCallHistory(size_t capacity = 100);
70
76 void record(const ToolCallRecord& entry);
77
84 std::vector<ToolCallRecord> recent(size_t count) const;
85
91 std::vector<ToolCallRecord> all() const;
92
99 std::string to_json(size_t count) const;
100
106 size_t size() const;
107
108private:
109 std::vector<ToolCallRecord> buffer_;
110 size_t head_ = 0;
111 size_t count_ = 0;
112 size_t capacity_;
113 mutable std::shared_mutex mutex_;
114};
115
123std::string summarize_params(const std::string& args_json);
124
133std::string truncate_result(const std::string& text, size_t max_len);
134
135} // namespace entropic
Fixed-size ring buffer of recent tool calls.
std::vector< ToolCallRecord > all() const
Get all stored entries (oldest first, insertion order).
size_t size() const
Current number of stored entries.
void record(const ToolCallRecord &entry)
Record a completed tool call.
std::vector< ToolCallRecord > recent(size_t count) const
Get the N most recent entries (newest first).
std::string to_json(size_t count) const
Serialize recent entries to JSON array string.
Activate model on GPU (WARM → ACTIVE).
std::string truncate_result(const std::string &text, size_t max_len)
Truncate a string to max_len characters with "..." suffix.
std::string summarize_params(const std::string &args_json)
Extract top-level JSON keys as a comma-separated summary.
Lightweight record of a recent tool call for introspection.
size_t sequence
Monotonic sequence number.
std::string tool_name
Fully-qualified tool name.
int iteration
Loop iteration when called.
std::string error_detail
Error message if status != "success".
double elapsed_ms
Execution time in milliseconds.
std::string result_summary
First 200 chars of result.
std::string status
"success", "error", "timeout"
std::string params_summary
Top-level param keys only.