Class Tryll::Client::GraphDescription¶
ClassList > Tryll > Client > GraphDescription
Fluent builder for a workflow graph description sent to the server. More...
#include <GraphDescription.h>
Classes¶
| Type | Name |
|---|---|
| struct | NodeDesc Internal serialisable description of one node. |
| struct | RouteDesc Internal serialisable description of one wire between two nodes. |
Public Types¶
| Type | Name |
|---|---|
| typedef std::unordered_map< std::string, std::string > | Params String → string map of per-node parameters sent on the wire. |
Public Functions¶
| Type | Name |
|---|---|
| GraphDescription & | AddNode (std::string name, NodeType type, Params params={}) Append a node to the graph. |
| GraphDescription & | AddToolCallNode (std::string name, std::vector< ToolDef > tools, Params params={}) Append a ToolCall node with structured tool definitions. |
| const std::string & | GetDefaultModelName () noexcept const |
| const std::vector< NodeDesc > & | GetNodes () noexcept const |
| const std::vector< RouteDesc > & | GetRoutes () noexcept const |
| const std::string & | GetStartNode () noexcept const |
| GraphDescription & | SetDefaultModelName (std::string name) Set the fallback model name for nodes that do not specify model_name . |
| GraphDescription & | SetStartNode (std::string name) Nominate which node receives the turn when the agent runs. |
| GraphDescription & | Wire (std::string source, std::string exitName, std::string target) Add a wire (exit route) from one node to another. |
Detailed Description¶
Typical usage:
auto graph = Tryll::Client::GraphDescription{}
.AddNode("gen", Tryll::Client::NodeType::Generate, {{"prompt", "..."}})
.SetStartNode("gen")
.SetDefaultModelName("qwen2.5-0.5b-instruct");
auto agent = client.CreateAgent(graph);
The graph is serialised into CreateAgentRequest on Tryll::TryllClient::CreateAgent; there is no server-side validation until that point.
Public Types Documentation¶
typedef Params¶
String → string map of per-node parameters sent on the wire.
Public Functions Documentation¶
function AddNode¶
Append a node to the graph.
GraphDescription & Tryll::Client::GraphDescription::AddNode (
std::string name,
NodeType type,
Params params={}
)
Parameters:
nameGraph-unique node name; used by Wire and SetStartNode to reference this node.typeNode kind; see NodeType. ForNodeType::ToolCallprefer AddToolCallNode.paramsKey/value node parameters. All values are sent as strings on the wire.
Returns:
*this for fluent chaining.
function AddToolCallNode¶
Append a ToolCall node with structured tool definitions.
GraphDescription & Tryll::Client::GraphDescription::AddToolCallNode (
std::string name,
std::vector< ToolDef > tools,
Params params={}
)
Convenience over AddNode that accepts a list of ToolDef rather than encoding tools into string params.
Parameters:
nameGraph-unique node name.toolsTool definitions available to the model at this node.paramsAdditional key/value node parameters.
Returns:
*this for fluent chaining.
function GetDefaultModelName¶
Returns:
Default model name, or empty if none has been set.
function GetNodes¶
Returns:
Nodes in insertion order.
function GetRoutes¶
inline const std::vector< RouteDesc > & Tryll::Client::GraphDescription::GetRoutes () noexcept const
Returns:
Wires in insertion order.
function GetStartNode¶
Returns:
Start node name, or empty if none has been set.
function SetDefaultModelName¶
Set the fallback model name for nodes that do not specify model_name .
Sent as default_model_name in CreateAgentRequest. Nodes that invoke a language model (Generate, ToolCall) use this value when their own model param is unset.
Parameters:
nameCatalog model name as registered inmodels.json.
Returns:
*this for fluent chaining.
function SetStartNode¶
Nominate which node receives the turn when the agent runs.
Parameters:
nameName of a node previously added via AddNode or AddToolCallNode.
Returns:
*this for fluent chaining.
function Wire¶
Add a wire (exit route) from one node to another.
GraphDescription & Tryll::Client::GraphDescription::Wire (
std::string source,
std::string exitName,
std::string target
)
Parameters:
sourceName of the node the wire leaves.exitNameName of the exit route onsource(exit names are node-type-specific; see the node reference).targetName of the node the wire enters.
Returns:
*this for fluent chaining.
The documentation for this class was generated from the following file C:/_tryll/_monorepo/server/client-cpp/include/tryll/GraphDescription.h