Agents 0.0.2
Edge AI Agents SDK
Loading...
Searching...
No Matches
agents::ActorAgent Class Reference

Actor-based agent implementation. More...

#include <actor_agent.h>

Inheritance diagram for agents::ActorAgent:
agents::Agent

Public Types

enum class  State {
  READY ,
  RUNNING ,
  WAITING ,
  COMPLETED ,
  FAILED ,
  STOPPED
}
 Agent execution state. More...
 

Public Member Functions

 ActorAgent (std::shared_ptr< AgentContext > context)
 Constructor with agent context.
 
virtual ~ActorAgent ()
 Destructor.
 
void init () override
 Initialize the agent.
 
Task< JsonObjectrun (const String &task) override
 Run the agent with a task using coroutines.
 
void stop () override
 Stop the agent.
 
void provideFeedback (const String &feedback) override
 Provide human feedback.
 
void setSystemPrompt (const String &system_prompt)
 Set the system prompt for the agent.
 
String getSystemPrompt () const
 Get the current system prompt.
 
Task< StringwaitForFeedback (const String &message, const JsonObject &context) override
 Wait for feedback using coroutines.
 
void runAsync (const String &task, std::function< void(const JsonObject &)> callback)
 Run the agent with a callback.
 
std::shared_ptr< AgentContextgetContext () const
 Get the agent's context.
 
State getState () const
 Get the agent's current state.
 
void setOptions (const Options &options)
 Set execution options.
 
const OptionsgetOptions () const
 Get execution options.
 
void setStatusCallback (std::function< void(const String &)> callback)
 Set a callback for status updates.
 

Detailed Description

Actor-based agent implementation.

This class implements a flexible agent that can operate autonomously, use tools, and achieve complex tasks.

Examples
actor_agent_example.cpp.

Member Enumeration Documentation

◆ State

enum class agents::Agent::State
stronginherited

Agent execution state.

Enumerator
READY 

Ready to start execution.

RUNNING 

Currently executing.

WAITING 

Waiting for human input.

COMPLETED 

Execution completed successfully.

FAILED 

Execution failed.

STOPPED 

Execution stopped by user.

Constructor & Destructor Documentation

◆ ActorAgent()

agents::ActorAgent::ActorAgent ( std::shared_ptr< AgentContext > context)

Constructor with agent context.

Parameters
contextThe agent context

Member Function Documentation

◆ getContext()

std::shared_ptr< AgentContext > agents::Agent::getContext ( ) const
inherited

Get the agent's context.

Returns
The agent context

◆ getOptions()

const Options & agents::Agent::getOptions ( ) const
inherited

Get execution options.

Returns
The execution options

◆ getState()

State agents::Agent::getState ( ) const
inherited

Get the agent's current state.

Returns
The agent state

◆ getSystemPrompt()

String agents::ActorAgent::getSystemPrompt ( ) const

Get the current system prompt.

Returns
The current system prompt

◆ init()

void agents::ActorAgent::init ( )
overridevirtual

Initialize the agent.

Implements agents::Agent.

◆ provideFeedback()

void agents::ActorAgent::provideFeedback ( const String & feedback)
overridevirtual

Provide human feedback.

Parameters
feedbackThe feedback to provide

Reimplemented from agents::Agent.

◆ run()

Task< JsonObject > agents::ActorAgent::run ( const String & task)
overridevirtual

Run the agent with a task using coroutines.

Parameters
taskThe task to run
Returns
The result of the task

Implements agents::Agent.

◆ runAsync()

void agents::Agent::runAsync ( const String & task,
std::function< void(const JsonObject &)> callback )
inherited

Run the agent with a callback.

Parameters
taskThe task to run
callbackThe callback to run

◆ setOptions()

void agents::Agent::setOptions ( const Options & options)
inherited

Set execution options.

Parameters
optionsThe execution options

◆ setStatusCallback()

void agents::Agent::setStatusCallback ( std::function< void(const String &)> callback)
inherited

Set a callback for status updates.

Parameters
callbackThe callback to set

◆ setSystemPrompt()

void agents::ActorAgent::setSystemPrompt ( const String & system_prompt)

Set the system prompt for the agent.

Parameters
system_promptThe system prompt to set

◆ stop()

void agents::ActorAgent::stop ( )
overridevirtual

Stop the agent.

Reimplemented from agents::Agent.

◆ waitForFeedback()

Task< String > agents::ActorAgent::waitForFeedback ( const String & message,
const JsonObject & context )
overridevirtual

Wait for feedback using coroutines.

Parameters
messageThe message to wait for feedback
contextThe context to wait for feedback
Returns
The feedback

Reimplemented from agents::Agent.