Skip to content

How-to Guides

Task recipes. Each page solves one concrete problem and shows a minimal working example in Unity, Unreal, C++, and Python where applicable. If you are new to Tryll, start with First inference; if you want the why, see Concepts.

Guides marked ★ are the ones to read first in their area.

Setup and connection

Editor tools

Build an agent

  • Build a Chat Agent with a Graph ★ — compose a Generate + guardrail graph. Start here when writing your first agent.
  • Design an NPC Prompt ★ — measurement-backed recipes for writing a role-play system_prompt: what actually improves character dialogue, what provably does not, and how model choice changes the answer.
  • Design an Intent-Classifier Prompt — the ClassifyIntentLLM template contract ({{intents_block}} required; {{letters}} optional), how to write and order the labels, and how to tune threshold/margin.
  • Use Mustache Templates — control exactly how instructions, slots, variables, and retrieved chunks land in the prompt.
  • Stream Answers to a UI — wire streaming tokens into your application's view layer.
  • Send Multiple Answers in One Turn — two speakers, or a thinking channel plus a reply, routed by AnswerText.node_name.

Dialogue and turn control

  • Change Agent Parameters at Runtime — mutate a node's params (prompt, sampling, threshold, …) between turns, and which params are structural and cannot change.
  • Seed and Edit Dialog History — append scripted user/assistant turns, write an opener, or retry by removing the last turn — all without running the graph.
  • Export and Import Dialog — capture a full-fidelity snapshot and restore it from a game-owned save file.
  • Save and Load Agent State — coordinate quiescent multi-agent snapshots, variables, game state, atomic slot writes, strict restore, and KV-cache warm-up.
  • Cancel a Turn — stop an in-flight turn (a chat "Stop" button, or a rollback), keeping or discarding the partial reply.
  • Pause and Resume a Turn — suspend a turn between nodes and resume it after acting client-side.
  • Manage an Agent's KV Cache — prefill, evict, and inspect language-model KV caches to trade memory against first-turn latency.
  • Run Many Agents on a Small GPU — size every LLM node's context window, then evict the agents nobody is talking to: the two levers that fit several NPC agents into limited VRAM.
  • Keep Long Conversations Coherent — add a Summarize node so ageing turns fold into a rolling summary instead of being trimmed out of the prompt.

Knowledge and retrieval

  • Create a Simple RAG Assistant ★ — the hero recipe: prepare a knowledge base, add a Retrieve node in front of Generate, see grounded answers.
  • Query Rewriting and HyDE for RAG — rewrite the user's message before retrieval, while still answering what they actually asked. Covers both registers: a keyword query when your chunks read like questions, and a hypothetical answer (HyDE) when they read like statements.
  • Build an Intent-Driven NPC — classify the player's intent against a labelled knowledge base and route to tone-specific replies.
  • Classify Intent Without a Knowledge Base — the same NPC using ClassifyIntentLLM: describe each intent in a sentence, no embedding model and no corpus to author.
  • Score Several Attributes of One Line — label one player line on several axes (Choice, Boolean, Score) in one batched ClassifyAttributesLLM call, then route on the result.
  • Give an NPC a Memory It Can Search — store what the player says with WriteToMemory, find it again with Retrieve on later turns, and keep it across game saves (experimental).

Game state and control flow

The mental model for this section is the per-turn slot blackboard and the per-agent variable store.

Structured output and tools

  • Define and Handle Tool Calls ★ — declare tool definitions on a ToolCall node, route on tool_called / no_tool_called, handle the call client-side, and hand the real result back to the model.
  • Test Tool Calls in Chat and the Dialog Lab — exercise that workflow in the editors without Play/PIE.
  • Compare Tool-Call Models ★ — exact-accuracy on the Tryll-authored suites and the BFCL slice; pick a catalog model by the job (commands, log query, parallel calls), not by parameter count.
  • Design a Tool-Call Prompt ★ — measurement-backed schema and prompt recipes: name "unfiltered", put it first in the enum, and do not add parameters the model cannot fill.
  • Fix Tool-Call Text in Answers — the player sees <|tool_call>… instead of dialogue: find which node wrote it, and fix the prompt, the routing, or the tool node.
  • Constrain Output with a Grammar — force a Generate node to emit exactly a fixed shape (command, choice, JSON) with a GBNF grammar; flip between command turn and free chat at runtime.

Guardrails and safety

Voice

Models and shipping

Downloading and registering models from the editor GUI is covered in Manage Models in the Editor.

Help and support

  • Report a Bug — work out what kind of bug you hit, collect the logs, crash dump or Agent Log export it needs, and post it in the Discord Bug Hunt channel.
  • Concepts — the mental model behind each recipe.
  • Reference — field-level detail for every knob.