Skip to content

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.

using Tryll::Client::GraphDescription::Params = std::unordered_map<std::string, std::string>;


Public Functions Documentation

function AddNode

Append a node to the graph.

GraphDescription & Tryll::Client::GraphDescription::AddNode (
    std::string name,
    NodeType type,
    Params params={}
) 

Parameters:

  • name Graph-unique node name; used by Wire and SetStartNode to reference this node.
  • type Node kind; see NodeType. For NodeType::ToolCall prefer AddToolCallNode.
  • params Key/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:

  • name Graph-unique node name.
  • tools Tool definitions available to the model at this node.
  • params Additional key/value node parameters.

Returns:

*this for fluent chaining.


function GetDefaultModelName

inline const std::string & Tryll::Client::GraphDescription::GetDefaultModelName () noexcept const

Returns:

Default model name, or empty if none has been set.


function GetNodes

inline const std::vector< NodeDesc > & Tryll::Client::GraphDescription::GetNodes () noexcept const

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

inline const std::string & Tryll::Client::GraphDescription::GetStartNode () noexcept const

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 .

GraphDescription & Tryll::Client::GraphDescription::SetDefaultModelName (
    std::string 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:

  • name Catalog model name as registered in models.json.

Returns:

*this for fluent chaining.


function SetStartNode

Nominate which node receives the turn when the agent runs.

GraphDescription & Tryll::Client::GraphDescription::SetStartNode (
    std::string name
) 

Parameters:

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:

  • source Name of the node the wire leaves.
  • exitName Name of the exit route on source (exit names are node-type-specific; see the node reference).
  • target Name 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