Generate¶
The Generate node runs language-model inference. It is the workhorse of every Tryll workflow: it takes the current dialog, passes it through the agent's projection to build a prompt, and emits the model's response — either as a single chunk or streamed token-by-token.
NodeType: Generate.
Parameters¶
| Param | Type | Default | Range | Structural | Description |
|---|---|---|---|---|---|
model_name |
Optional[str] | inherit model default | — | ✓ | Model catalog name. Empty = use the agent's default_model_name. |
system_prompt |
Optional[str] (multiline) | inherit model default | — | — | Prepended before the user turn during projection. |
template |
Optional[str] (multiline) | inherit model default | — | — | Mustache template applied to the user-area message at projection time. |
placement |
Placement | 0 | — | — | Where the rendered template body is placed in the projected message stream. |
stream |
bool | False | — | — | When true, emit answer text as streaming deltas; otherwise one final chunk. |
sampling |
Optional[Any] | inherit model default | — | — | Sparse sampling overrides applied on top of the model-catalog defaults. Sub-table change fires OnSamplingChanged, which re-resolves overrides against the cached model-default sampling. |
Exits¶
Each exit is a structural string field on the node's params; its value names the target node (empty = END).
| Exit | Param field | Description |
|---|---|---|
default |
default_exit |
Default exit target — routes here after generation completes. Empty string = END (turn finishes). |
Exit routes¶
| Route | Param field | Fires when |
|---|---|---|
default |
default_exit |
Always — Generate never branches. Set default_exit to the next node name, or leave it empty to terminate the turn (END). |
Side effects¶
- Appends the generated answer to the current turn as the assistant's reply.
- Emits one or more
AnswerTextframes to the client. - Updates the per-model KV cache.
Diagnostics¶
When the agent has enable_diagnostics = true, the node's
contribution to TurnComplete.debug_info includes the projected
prompt and the model name that was actually run (after the
model_name / default_model_name fallback).
Minimum working example¶
from tryll_client.graph import GraphDescription, GenerateParams
graph = (
GraphDescription()
.add_node("answer", GenerateParams(
system_prompt="You are a terse assistant.",
stream=True,
default_exit="", # empty = END
))
.set_start_node("answer")
.set_default_model_name("My Local Model")
)
agent = client.create_agent(graph)
using namespace Tryll::Client;
using namespace Tryll::NodeParams;
GenerateParamsT gp;
gp.system_prompt = "You are a terse assistant.";
gp.stream = true;
// gp.default_exit = ""; // empty = END (the default)
GraphDescription graph;
graph.AddGenerate("answer", std::move(gp))
.SetStartNode("answer")
.SetDefaultModelName("My Local Model");
auto agent = client.CreateAgent(graph);
#include "Generated/TryllGraphBuilder.Nodes.h"
#include "Generated/TryllNodeParamsFactory.h"
UTryllGenerateParams* P = UTryllNodeParamsFactory::MakeGenerateParams(this);
P->bOverrideSystemPrompt = true;
P->SystemPrompt = TEXT("You are a terse assistant.");
P->bStream = true;
// P->DefaultExit = TEXT(""); // empty = END (the default)
FTryllGraphDescription Graph = FTryllGraphBuilder()
.AddNode(TEXT("answer"), P)
.SetStartNode(TEXT("answer"))
.SetDefaultModelName(TEXT("My Local Model"))
.Build();
Or author the same node inside a UTryllWorkflowAsset in the
Content Browser and assign it to UTryllAgentComponent.
Client bindings¶
- C++:
GraphDescription::AddGenerate(name, GenerateParamsT)—GraphDescription.h - Python:
GraphDescription.add_node(name, GenerateParams(...))—tryll_client.graph - Unity:
TryllGraphBuilder.AddGenerate(name, new TryllGenerateParams{...})—Runtime/Generated/TryllGraphBuilder.Nodes.cs - Unreal:
AddGenerateNode(builder, name, UTryllGenerateParams*)—Generated/TryllGraphBuilder.Nodes.h