12#include <agents-cpp/agent_context.h>
13#include <agents-cpp/coroutine_utils.h>
14#include <agents-cpp/types.h>
87 Agent(std::shared_ptr<AgentContext> context);
173 std::shared_ptr<AgentContext> context_;
189 std::function<void(
const String&)> status_callback_;
195 void setState(
State state);
201 void logStatus(
const String& status);
Agent(std::shared_ptr< AgentContext > context)
Constructor.
void runAsync(const String &task, std::function< void(const JsonObject &)> callback)
Run the agent with a callback.
virtual Task< String > waitForFeedback(const String &message, const JsonObject &context)
Wait for feedback using coroutines.
Definition agent.h:160
void setStatusCallback(std::function< void(const String &)> callback)
Set a callback for status updates.
const Options & getOptions() const
Get execution options.
virtual void init()=0
Initialize the agent.
virtual void provideFeedback(const String &feedback)
Provide human feedback.
virtual Task< JsonObject > run(const String &task)=0
Run the agent with a task using coroutines.
State getState() const
Get the agent's current state.
std::shared_ptr< AgentContext > getContext() const
Get the agent's context.
virtual void stop()
Stop the agent.
Agent(std::shared_ptr< AgentContext > context)
Constructor.
State
Agent execution state.
Definition agent.h:31
@ STOPPED
Execution stopped by user.
Definition agent.h:55
@ WAITING
Waiting for human input.
Definition agent.h:43
@ READY
Ready to start execution.
Definition agent.h:35
@ RUNNING
Currently executing.
Definition agent.h:39
@ COMPLETED
Execution completed successfully.
Definition agent.h:47
@ FAILED
Execution failed.
Definition agent.h:51
virtual ~Agent()=default
Destructor.
void setOptions(const Options &options)
Set execution options.
Provide a future-based fallback for Task.
Definition coroutine_utils.h:115
Framework Namespace.
Definition agent.h:18
nlohmann::json JsonObject
JSON object type.
Definition types.h:39
std::string String
String type.
Definition types.h:27
Agent execution options.
Definition agent.h:61
Agent execution options.
Definition agent.h:61
int max_consecutive_errors
The maximum number of consecutive errors.
Definition agent.h:70
bool human_feedback_enabled
Whether human feedback is enabled.
Definition agent.h:75
int max_iterations
The maximum number of iterations.
Definition agent.h:65
std::function< bool(const String &, const JsonObject &)> human_in_the_loop
The human in the loop function.
Definition agent.h:80