2026-01-28 19:34:39 +01:00
|
|
|
// retoor <retoor@molodetz.nl>
|
|
|
|
|
|
|
|
|
|
#ifndef R_AGENT_H
|
|
|
|
|
#define R_AGENT_H
|
|
|
|
|
|
|
|
|
|
#include "messages.h"
|
|
|
|
|
#include "r_error.h"
|
2026-01-29 06:01:05 +01:00
|
|
|
#include "tool.h"
|
2026-01-28 19:34:39 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
#define AGENT_MAX_ITERATIONS 300
|
|
|
|
|
#define AGENT_MAX_TOOL_RETRIES 3
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
AGENT_STATE_IDLE,
|
|
|
|
|
AGENT_STATE_RUNNING,
|
|
|
|
|
AGENT_STATE_EXECUTING_TOOLS,
|
|
|
|
|
AGENT_STATE_COMPLETED,
|
|
|
|
|
AGENT_STATE_MAX_ITERATIONS,
|
|
|
|
|
AGENT_STATE_ERROR
|
|
|
|
|
} agent_state_t;
|
|
|
|
|
|
|
|
|
|
typedef struct agent_t *agent_handle;
|
|
|
|
|
|
|
|
|
|
agent_handle agent_create(const char *goal, messages_handle messages);
|
|
|
|
|
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);
|
2026-01-29 06:01:05 +01:00
|
|
|
void agent_set_is_subagent(agent_handle agent, bool is_subagent);
|
|
|
|
|
void agent_set_tool_registry(agent_handle agent, tool_registry_t *registry);
|
2026-01-28 19:34:39 +01:00
|
|
|
|
|
|
|
|
agent_state_t agent_get_state(agent_handle agent);
|
|
|
|
|
const char *agent_get_error(agent_handle agent);
|
|
|
|
|
int agent_get_iteration_count(agent_handle agent);
|
|
|
|
|
|
2026-02-10 04:29:48 +01:00
|
|
|
void agent_set_id(agent_handle agent, const char *id);
|
|
|
|
|
void agent_set_role(agent_handle agent, const char *role);
|
|
|
|
|
void agent_set_manager_id(agent_handle agent, const char *manager_id);
|
|
|
|
|
const char *agent_get_id(agent_handle agent);
|
|
|
|
|
const char *agent_get_role(agent_handle agent);
|
|
|
|
|
const char *agent_get_manager_id(agent_handle agent);
|
|
|
|
|
|
2026-01-28 19:34:39 +01:00
|
|
|
char *agent_run(agent_handle agent, const char *user_message);
|
|
|
|
|
char *agent_chat(const char *user_message, messages_handle messages);
|
|
|
|
|
char *agent_chat_with_limit(const char *user_message, int max_iterations, messages_handle messages);
|
|
|
|
|
|
|
|
|
|
#endif
|