Agents 0.0.2
Edge AI Agents SDK
Loading...
Searching...
No Matches
agents::workflows::Workflow Class Referenceabstract

Abstract base class for workflows. More...

#include <workflow.h>

Inheritance diagram for agents::workflows::Workflow:
agents::workflows::EvaluatorWorkflow agents::workflows::OrchestratorWorkflow agents::workflows::ParallelizationWorkflow agents::workflows::PromptChainingWorkflow agents::workflows::RoutingWorkflow

Public Member Functions

 Workflow (std::shared_ptr< AgentContext > context)
 Constructor.
 
 ~Workflow ()=default
 Destructor.
 
virtual JsonObject run (const String &input)=0
 Run the workflow with a user input and return the result.
 
virtual void runAsync (const String &input, std::function< void(const JsonObject &)> callback)
 Run the workflow with a user input asynchronously.
 
std::shared_ptr< AgentContextgetContext () const
 Get the workflow's context.
 
void setStepCallback (std::function< void(const String &, const JsonObject &)> callback)
 Set a callback for intermediate steps.
 
void setMaxSteps (int max_steps)
 Set maximum number of steps.
 
int getMaxSteps () const
 Get maximum number of steps.
 

Detailed Description

Abstract base class for workflows.

A workflow is a pattern for executing a series of LLM operations to accomplish a task.

Constructor & Destructor Documentation

◆ Workflow()

agents::workflows::Workflow::Workflow ( std::shared_ptr< AgentContext > context)

Constructor.

Parameters
contextThe context

Member Function Documentation

◆ getContext()

std::shared_ptr< AgentContext > agents::workflows::Workflow::getContext ( ) const

Get the workflow's context.

Returns
The context

◆ getMaxSteps()

int agents::workflows::Workflow::getMaxSteps ( ) const

Get maximum number of steps.

Returns
The maximum number of steps

◆ run()

virtual JsonObject agents::workflows::Workflow::run ( const String & input)
pure virtual

◆ runAsync()

virtual void agents::workflows::Workflow::runAsync ( const String & input,
std::function< void(const JsonObject &)> callback )
virtual

Run the workflow with a user input asynchronously.

Parameters
inputThe user input
callbackThe callback

◆ setMaxSteps()

void agents::workflows::Workflow::setMaxSteps ( int max_steps)

Set maximum number of steps.

Parameters
max_stepsThe maximum number of steps

◆ setStepCallback()

void agents::workflows::Workflow::setStepCallback ( std::function< void(const String &, const JsonObject &)> callback)

Set a callback for intermediate steps.

Parameters
callbackThe callback
Examples
prompt_chain_example.cpp.