12#include <agents-cpp/workflow.h>
94 const String& prompt_template,
95 std::function<
bool(
const JsonObject&)> validator =
nullptr,
116 std::vector<Step> steps_;
void addStep(const Step &step)
Add a step to the workflow.
PromptChainingWorkflow(std::shared_ptr< AgentContext > context)
Constructor with context.
JsonObject run(const String &input) override
Execute the workflow with input.
JsonObject run()
Execute the workflow using the latest USER message from context memory.
void addStep(const String &name, const String &prompt_template, std::function< bool(const JsonObject &)> validator=nullptr, std::function< JsonObject(const JsonObject &)> transformer=nullptr)
Add a step to the workflow with basic params.
Workflow(std::shared_ptr< AgentContext > context)
Constructor.
Worflows Namespace.
Definition workflow.h:22
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
Step in the workflow.
Definition prompt_chaining_workflow.h:31
bool use_tools
Flag to control tool usage.
Definition prompt_chaining_workflow.h:55
String prompt_template
Prompt template for this step.
Definition prompt_chaining_workflow.h:40
std::function< JsonObject(const JsonObject &)> transformer
Function to transform step output for the next step.
Definition prompt_chaining_workflow.h:50
String name
Name of the step.
Definition prompt_chaining_workflow.h:35
std::function< bool(const JsonObject &)> validator
Function to validate step output (returns true if valid)
Definition prompt_chaining_workflow.h:45
Step(const String &name, const String &prompt_template, std::function< bool(const JsonObject &)> validator=nullptr, std::function< JsonObject(const JsonObject &)> transformer=nullptr)
Constructor.
Definition prompt_chaining_workflow.h:64