feat: add agent subagent support, bash timeout, context manager improvements, and benchmark script

- Add agent_set_is_subagent and agent_set_tool_registry to agent API for subagent support
- Add timeout_seconds parameter to r_bash_execute to prevent hanging processes
- Refactor context_manager truncation logic with dynamic ratio-based truncation and total size calculation
- Add messages_to_json_string helper and r_config_get_max_tokens accessor
- Introduce tool_registry_get_specialized for type-filtered tool registries
- Add completion_phrases and passive_phrases detection to agent completion logic
- Suppress spinner in http_client when stderr is not a TTY
- Add comprehensive agent_benchmark.py with TestCase framework and logging
This commit is contained in:
2026-01-29 05:01:05 +00:00
parent a72e4116b1
commit 8215d7012d
31 changed files with 922 additions and 260 deletions
+3
View File
@@ -5,6 +5,7 @@
#include "messages.h"
#include "r_error.h"
#include "tool.h"
#include <stdbool.h>
#define AGENT_MAX_ITERATIONS 300
@@ -26,6 +27,8 @@ void agent_destroy(agent_handle agent);
void agent_set_max_iterations(agent_handle agent, int max);
void agent_set_verbose(agent_handle agent, bool verbose);
void agent_set_is_subagent(agent_handle agent, bool is_subagent);
void agent_set_tool_registry(agent_handle agent, tool_registry_t *registry);
agent_state_t agent_get_state(agent_handle agent);
const char *agent_get_error(agent_handle agent);
+1 -1
View File
@@ -4,6 +4,6 @@
#include <stdbool.h>
char *r_bash_execute(const char *command, bool interactive);
char *r_bash_execute(const char *command, bool interactive, int timeout_seconds);
#endif
+1
View File
@@ -32,6 +32,7 @@ r_status_t messages_replace_at(messages_handle msgs, int index, struct json_obje
struct json_object *messages_to_json(messages_handle msgs);
char *messages_to_string(messages_handle msgs);
char *messages_to_json_string(messages_handle msgs);
int messages_count(messages_handle msgs);
#endif
+1
View File
@@ -24,6 +24,7 @@ bool r_config_is_verbose(r_config_handle cfg);
void r_config_set_verbose(r_config_handle cfg, bool verbose);
double r_config_get_temperature(r_config_handle cfg);
int r_config_get_max_tokens(r_config_handle cfg);
const char *r_config_get_session_id(r_config_handle cfg);
bool r_config_set_session_id(r_config_handle cfg, const char *session_id);
+9
View File
@@ -39,4 +39,13 @@ struct json_object *tool_registry_execute(tool_registry_t *registry,
tool_registry_t *tools_get_registry(void);
void tools_registry_shutdown(void);
typedef enum {
TOOL_TYPE_ALL,
TOOL_TYPE_RESEARCHER,
TOOL_TYPE_DEVELOPER,
TOOL_TYPE_SECURITY
} tool_registry_type_t;
tool_registry_t *tool_registry_get_specialized(tool_registry_type_t type);
#endif