#include "include/flow/base_flow.h" #include namespace openmanus { BaseFlow::BaseFlow(std::shared_ptr agent) { if (agent) { primary_agent_key_ = "default"; agents_[primary_agent_key_] = agent; } } BaseFlow::BaseFlow(const std::vector>& agents) { if (!agents.empty()) { primary_agent_key_ = "agent0"; for (size_t i = 0; i < agents.size(); ++i) { if (agents[i]) { std::string key = "agent" + std::to_string(i); agents_[key] = agents[i]; } } } } std::shared_ptr BaseFlow::getPrimaryAgent() const { auto it = agents_.find(primary_agent_key_); if (it != agents_.end()) { return it->second; } return nullptr; } std::shared_ptr BaseFlow::getAgent(const std::string& key) const { auto it = agents_.find(key); if (it != agents_.end()) { return it->second; } return nullptr; } void BaseFlow::addAgent(const std::string& key, std::shared_ptr agent) { if (agent) { agents_[key] = agent; if (agents_.size() == 1) { primary_agent_key_ = key; } } } } // namespace openmanus