Skip to content

Commit a162dee

Browse files
committed
Release 1.4.0
1 parent cd4c102 commit a162dee

33 files changed

+824
-409
lines changed

BUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
cc_import(
55
name = "python",
66
shared_library = select({
7-
"@platforms//os:linux": "lib/linux/libpython3.11.so",
7+
"@platforms//os:linux": "lib/linux/libpython3.11.so.1.0",
88
"@platforms//os:macos": "lib/macos/libpython3.11.dylib",
9-
"@platforms//os:windows": "lib/windows/libpython3.11.dll",
9+
"@platforms//os:windows": "lib/windows/python311.dll",
1010
"//conditions:default": None,
1111
}),
1212
)
@@ -24,7 +24,7 @@ cc_import(
2424
shared_library = select({
2525
"@platforms//os:linux": "lib/linux/libagents_cpp_shared_lib.so",
2626
"@platforms//os:macos": "lib/macos/libagents_cpp_shared_lib.dylib",
27-
"@platforms//os:windows": "lib/windows/libagents_cpp_shared_lib.dll",
27+
"@platforms//os:windows": "lib/windows/agents_cpp_shared_lib.dll",
2828
"//conditions:default": None,
2929
}),
3030
deps = [

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int main() {
127127
context->setLLM(llm);
128128

129129
// Register tools
130-
context->registerTool(tools::createWebSearchTool());
130+
context->registerTool(tools::createWebSearchTool(llm));
131131

132132
// Create the agent
133133
AutonomousAgent agent(context);

examples/BUILD

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,79 @@
1-
21
# Example binaries
32
cc_binary(
43
name = "actor_agent_example",
54
srcs = ["actor_agent_example.cpp"],
65
deps = ["//:agents_cpp"],
6+
visibility = ["//visibility:public"],
77
)
88
cc_binary(
99
name = "autonomous_agent_example",
1010
srcs = ["autonomous_agent_example.cpp"],
1111
deps = ["//:agents_cpp"],
12+
visibility = ["//visibility:public"],
1213
)
1314
cc_binary(
1415
name = "coroutine_example",
1516
srcs = ["coroutine_example.cpp"],
1617
deps = ["//:agents_cpp"],
18+
visibility = ["//visibility:public"],
1719
)
1820
cc_binary(
1921
name = "evaluator_optimizer_example",
2022
srcs = ["evaluator_optimizer_example.cpp"],
2123
deps = ["//:agents_cpp"],
24+
visibility = ["//visibility:public"],
2225
)
2326
cc_binary(
2427
name = "multimodal_example",
2528
srcs = ["multimodal_example.cpp"],
2629
deps = ["//:agents_cpp"],
30+
visibility = ["//visibility:public"],
2731
)
2832
cc_binary(
2933
name = "orchestrator_example",
3034
srcs = ["orchestrator_example.cpp"],
3135
deps = ["//:agents_cpp"],
36+
visibility = ["//visibility:public"],
3237
)
3338
cc_binary(
3439
name = "parallel_example",
3540
srcs = ["parallel_example.cpp"],
3641
deps = ["//:agents_cpp"],
42+
visibility = ["//visibility:public"],
3743
)
3844
cc_binary(
3945
name = "prompt_chain_example",
4046
srcs = ["prompt_chain_example.cpp"],
4147
deps = ["//:agents_cpp"],
48+
visibility = ["//visibility:public"],
4249
)
4350
cc_binary(
4451
name = "robotics_object_detection_demo",
4552
srcs = ["robotics_object_detection_demo.cpp"],
4653
deps = ["//:agents_cpp"],
54+
visibility = ["//visibility:public"],
4755
)
4856
cc_binary(
4957
name = "routing_example",
5058
srcs = ["routing_example.cpp"],
5159
deps = ["//:agents_cpp"],
60+
visibility = ["//visibility:public"],
5261
)
5362
cc_binary(
5463
name = "simple_agent",
5564
srcs = ["simple_agent.cpp"],
5665
deps = ["//:agents_cpp"],
66+
visibility = ["//visibility:public"],
5767
)
5868
cc_binary(
5969
name = "streaming_chat",
6070
srcs = ["streaming_chat.cpp"],
6171
deps = ["//:agents_cpp"],
72+
visibility = ["//visibility:public"],
6273
)
6374
cc_binary(
6475
name = "structured_output_example",
6576
srcs = ["structured_output_example.cpp"],
6677
deps = ["//:agents_cpp"],
67-
)
78+
visibility = ["//visibility:public"],
79+
)

examples/autonomous_agent_example.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void detailedStepCallback(const AutonomousAgent::Step& step) {
2929
Logger::error("\nFailed!");
3030
}
3131

32-
Logger::info("\n------------------------------------");
32+
Logger::info("------------------------------------");
3333
}
3434

3535
// Custom callback for human-in-the-loop
@@ -39,9 +39,9 @@ bool detailedHumanApproval(const std::string& message, const JsonObject& context
3939
Logger::info("{}", context.dump(2));
4040
}
4141

42-
Logger::info("\n🔔 HUMAN APPROVAL REQUIRED 🔔");
42+
Logger::info("🔔 HUMAN APPROVAL REQUIRED 🔔");
4343
Logger::info("{}", message);
44-
Logger::info("\nApprove this step? (y/n/m - y: approve, n: reject, m: modify): ");
44+
Logger::info("Approve this step? (y/n/m - y: approve, n: reject, m: modify): ");
4545
char response;
4646
std::cin >> response;
4747
std::cin.ignore(); // Clear the newline
@@ -115,7 +115,7 @@ int main() {
115115

116116
// Register tools from tool registry
117117
auto registry = tools::ToolRegistry::global();
118-
tools::registerStandardTools(registry, llm);
118+
registry.registerStandardTools(llm);
119119
context->registerToolRegistry(registry);
120120

121121
// Create a custom tool
@@ -211,7 +211,7 @@ int main() {
211211
agent.init();
212212

213213
// Get user input
214-
Logger::info("\n==================================================");
214+
Logger::info("==================================================");
215215
Logger::info(" AUTONOMOUS AGENT ");
216216
Logger::info("==================================================");
217217
Logger::info("Enter a question or task for the agent (or 'exit' to quit):");
@@ -241,15 +241,17 @@ int main() {
241241
auto duration = std::chrono::duration_cast<std::chrono::seconds>(end_time - start_time).count();
242242

243243
// Display the final result
244-
Logger::info("\n==================================================");
244+
Logger::info("==================================================");
245245
Logger::info(" FINAL RESULT ");
246246
Logger::info("==================================================");
247247
Logger::info("{}", result["answer"].get<std::string>());
248248

249249
// Display completion statistics
250-
Logger::info("\n--------------------------------------------------");
251-
Logger::info("Task completed in {} seconds", duration);
252-
Logger::info("Total steps: {}", result["steps"].get<JsonArray>().size());
250+
if (result.contains("steps")) {
251+
Logger::info("--------------------------------------------------");
252+
Logger::info("Task completed in {} seconds", duration);
253+
Logger::info("Total steps: {}", result["steps"].get<JsonArray>().size());
254+
}
253255

254256
if (result.contains("tool_calls")) {
255257
Logger::info("Tool calls: {}", result["tool_calls"].get<int>());
@@ -262,4 +264,4 @@ int main() {
262264
}
263265

264266
return EXIT_SUCCESS;
265-
}
267+
}

examples/coroutine_example.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Task<JsonObject> performResearchTask(std::shared_ptr<Context> context, const std
4646
Logger::info("Starting research on topic: {}", topic);
4747

4848
// Perform a search to get initial information
49-
auto search_tool = tools::createWebSearchTool();
49+
auto search_tool = tools::createWebSearchTool(context->getLLM());
5050
auto search_result = co_await context->executeTool("web_search", {{"query", topic}});
5151

5252
// Extract key points from the search result
@@ -181,8 +181,8 @@ int main(int argc, char* argv[]) {
181181
context->setLLM(llm);
182182

183183
// Register tools
184-
context->registerTool(tools::createWebSearchTool());
185184
context->registerTool(tools::createWikipediaTool());
185+
context->registerTool(tools::createWebSearchTool(llm));
186186
context->registerTool(tools::createSummarizationTool(llm));
187187

188188
// Menu-driven example to demonstrate various coroutines
@@ -273,4 +273,4 @@ int main(int argc, char* argv[]) {
273273
}
274274

275275
return EXIT_SUCCESS;
276-
}
276+
}

examples/orchestrator_example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int main(int argc, char* argv[]) {
5555
context->setLLM(llm);
5656

5757
// Register tools
58-
context->registerTool(tools::createWebSearchTool());
58+
context->registerTool(tools::createWebSearchTool(llm));
5959
context->registerTool(tools::createWikipediaTool());
6060

6161
// Create orchestrator-workers workflow
@@ -163,4 +163,4 @@ int main(int argc, char* argv[]) {
163163
}
164164

165165
return EXIT_SUCCESS;
166-
}
166+
}

examples/routing_example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int main(int argc, char* argv[]) {
5656
context->setLLM(llm);
5757

5858
// Register some tools
59-
context->registerTool(tools::createWebSearchTool());
59+
context->registerTool(tools::createWebSearchTool(llm));
6060
context->registerTool(tools::createWikipediaTool());
6161

6262
// Create routing workflow

examples/simple_agent.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ Task<int> runAgentApp(int argc, char* argv[]) {
5656
context->setLLM(llm);
5757

5858
// Register some tools
59-
context->registerTool(tools::createWebSearchTool());
6059
context->registerTool(tools::createWikipediaTool());
60+
context->registerTool(tools::createWebSearchTool(llm));
6161
context->registerTool(tools::createSummarizationTool(llm));
6262

6363
// Create the agent
@@ -111,4 +111,4 @@ Task<int> runAgentApp(int argc, char* argv[]) {
111111
int main(int argc, char* argv[]) {
112112
// Use blockingWait to execute the coroutine
113113
return blockingWait(runAgentApp(argc, argv));
114-
}
114+
}

examples/streaming_chat.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Task<int> runStreamingChat(int argc, char* argv[]) {
4545
auto context = std::make_shared<Context>();
4646

4747
// Configure the LLM
48-
auto llm = createLLM("google", api_key, "gemini-2.0-flash");
48+
auto llm = createLLM("google", api_key, "gemini-2.5-flash-lite");
4949

5050
// Configure LLM options
5151
LLMOptions options;
@@ -54,6 +54,11 @@ Task<int> runStreamingChat(int argc, char* argv[]) {
5454

5555
context->setLLM(llm);
5656

57+
// Register built-in tools
58+
auto registry = tools::ToolRegistry::global();
59+
registry.registerStandardTools(llm);
60+
context->registerToolRegistry(registry);
61+
5762
// Get user input
5863
Logger::info("Enter a question or task for the model (or 'exit' to quit):");
5964
std::string user_input;
@@ -91,4 +96,4 @@ Task<int> runStreamingChat(int argc, char* argv[]) {
9196
int main(int argc, char* argv[]) {
9297
// Use blockingWait to execute the coroutine
9398
return blockingWait(runStreamingChat(argc, argv));
94-
}
99+
}

include/agents-cpp/agent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Agent {
7272
/**
7373
* @brief Whether human feedback is enabled
7474
*/
75-
bool human_feedback_enabled = true;
75+
bool human_feedback_enabled = false;
7676

7777
/**
7878
* @brief The human in the loop function
@@ -112,7 +112,7 @@ class Agent {
112112
* @param task The task to run
113113
* @param callback The callback to run
114114
*/
115-
void runAsync(const std::string& task, std::function<void(const JsonObject&)> callback);
115+
virtual void runAsync(const std::string& task, std::function<void(const JsonObject&)> callback);
116116

117117
/**
118118
* @brief Stop the agent

0 commit comments

Comments
 (0)