Class UTryllSubsystem¶
#include <TryllSubsystem.h>
Inherits the following classes: UGameInstanceSubsystem, FTickableGameObject
Classes¶
| Type | Name |
|---|---|
| struct | FEmbeddedStorageInfo |
Public Types¶
| Type | Name |
|---|---|
| typedef void(FEmbeddedStorageInfo, FTryllError) | FTryllOnEmbeddedStorageCreated |
| typedef void(FTryllError) | FTryllOnEmbeddedStorageDestroyed |
| typedef void(FTryllError) | FTryllOnStringStorage |
Public Attributes¶
| Type | Name |
|---|---|
| FOnTryllAgentDestroyed | OnAgentDestroyed |
| FOnTryllConnectionChanged | OnConnectionChanged |
| FOnTryllCreateEmbeddedStringStorage | OnCreateEmbeddedStringStorageComplete |
| FOnTryllCreateSession | OnCreateSessionComplete |
| FOnTryllCreateStringStorage | OnCreateStringStorageComplete |
| FOnTryllDestroyEmbeddedStringStorage | OnDestroyEmbeddedStringStorageComplete |
| FOnTryllDestroyStringStorage | OnDestroyStringStorageComplete |
| FOnTryllDownloadComplete | OnDownloadComplete |
| FOnTryllDownloadProgress | OnDownloadProgress |
| FOnTryllError | OnError |
| FOnTryllIntentClassified | OnIntentClassified |
| FOnTryllListModels | OnListModelsComplete |
| FOnTryllLoadModel | OnLoadModelComplete |
| FOnTryllModelReady | OnModelReady |
| FOnTryllNodeEvent | OnNodeEvent |
| FOnTryllPaused | OnPaused |
| FOnTryllToolCall | OnToolCall |
| FOnTryllToolCallDetailed | OnToolCallDetailed |
| FOnTryllToolCallWithId | OnToolCallWithId |
| FOnTryllUnloadModel | OnUnloadModelComplete |
| FString | ServerBuildConfig |
| FString | ServerExePath |
| FString | ServerHost = TEXT("127.0.0.1") |
| int32 | ServerIdleTimeoutSeconds = 0 |
| int32 | ServerPort = 9100 |
| FString | ServerRunId |
| FString | ServerVersion |
| bool | bServerManaged = false |
Public Functions¶
| Type | Name |
|---|---|
| void | BindVoiceInputClient (const TSharedPtr< FTryllVoiceInput > & Voice) const |
| void | Connect () |
| void | CreateSession (ETryllInferenceEngine Engine, FString GameName=TEXT(""), ETryllInferenceEngine SttEngine=ETryllInferenceEngine::Mock, ETryllInferenceEngine TtsEngine=ETryllInferenceEngine::Mock, ETryllInferenceEngine EmbeddingEngine=ETryllInferenceEngine::Mock, FString StorageDataFolder=TEXT("")) |
| void | CreateSessionFromSettings () |
| virtual void | Deinitialize () override |
| void | Disconnect () |
| TSharedPtr< FTryllAgent > | FindAgent (uint64 AgentId) const |
| int64 | GetSessionId () const |
| virtual TStatId | GetStatId () override const |
| virtual ETickableTickType | GetTickableTickType () override const |
| virtual void | Initialize (FSubsystemCollectionBase & Collection) override |
| bool | IsConnected () const |
| bool | IsSessionReady () const |
| virtual bool | IsTickable () override const |
| virtual bool | IsTickableInEditor () override const |
| virtual bool | IsTickableWhenPaused () override const |
| void | RegisterAgent (std::uint64_t AgentId, TWeakPtr< FTryllAgent > Agent) |
| void | RequestCreateAgent (const FTryllGraphDescription & Graph, TFunction< FTryllOnAgentCreated > OnComplete, bool bEnableDiagnostics=false, bool bMaintainDialogueHistory=true, const TArray< FTryllVariableDecl > & Variables={}, ETryllKvCacheInitialization KvCacheInitialization=ETryllKvCacheInitialization::AllocateOnly, ETryllWorkload Workload=ETryllWorkload::Interactive) |
| void | RequestCreateEmbeddedStringStorage (const FString & Name, const FString & ConfigPath, const FString & EmbeddingModel=FString{}, TFunction< FTryllOnEmbeddedStorageCreated > OnComplete=nullptr) |
| void | RequestCreateEmbeddedStringStorageFromStrings (const FString & Name, const TArray< FString > & Strings, const FString & EmbeddingModel, TFunction< FTryllOnEmbeddedStorageCreated > OnComplete=nullptr) |
| void | RequestCreateStringStorage (const FString & Name, const TArray< FString > & Strings, TFunction< FTryllOnStringStorage > OnComplete=nullptr) |
| void | RequestCreateStringStorageFromFile (const FString & Name, const FString & FilePath, uint8 Kind=0, TFunction< FTryllOnStringStorage > OnComplete=nullptr) |
| void | RequestCreateStringStorageKeyed (const FString & Name, const TArray< FString > & Keys, const TArray< FString > & Values, uint8 Kind=1, TFunction< FTryllOnStringStorage > OnComplete=nullptr) |
| void | RequestCreateVoiceInput (const FTryllVoiceInputConfig & Config, TFunction< FTryllOnVoiceInputCreated > OnComplete) |
| void | RequestDestroyAgent (TSharedPtr< FTryllAgent > Agent) |
| void | RequestDestroyEmbeddedStringStorage (const FString & Name, TFunction< FTryllOnEmbeddedStorageDestroyed > OnComplete=nullptr) |
| void | RequestDestroyStringStorage (const FString & Name, TFunction< FTryllOnStringStorage > OnComplete=nullptr) |
| void | RequestDestroyVoiceInput (TSharedPtr< FTryllVoiceInput > Voice) |
| void | RequestDownloadModel (const FString & ModelName) |
| void | RequestListModels (TFunction< FTryllOnListModels > OnComplete) |
| void | RequestLoadModel (const FString & ModelName) |
| void | RequestModel (const FString & ModelName) |
| void | RequestUnloadModel (const FString & ModelName) |
| void | SetInferenceThrottle (float Level) |
| TArray< FTryllRegisteredAgentSnapshot > | SnapshotRegisteredAgents () const |
| virtual void | Tick (float DeltaTime) override |
| void | UnregisterAgent (std::uint64_t AgentId) |
Public Static Functions¶
| Type | Name |
|---|---|
| TArray< EServerBuildVariant > | GetAvailableServerVariants () |
| FString | GetServerRootDir () |
| FString | ResolveServerExePath (EServerBuildVariant Preferred) |
Detailed Description¶
Game-instance subsystem: one TCP session to the Tryll server. Manages the socket connection on a background thread (FTryllConnection) and drains the event queue on Tick(), dispatching to registered agents and delegates.
Default (zero-wiring) path — driven by UTryllRuntimeSettings: * bAutoLaunchServer → spawns the bundled tryll_server.exe on Initialize. * bAutoConnect → Connect() on Initialize (connect-retry covers server startup). * bAutoCreateSession → on Connected, CreateSessionFromSettings() applies the Engine / Stt / Tts / Embedding selections from settings. UTryllAgentComponent / UTryllVoiceInputComponent then create themselves once IsSessionReady() — they queue until OnCreateSessionComplete if they spawn earlier. So the common case is: add the components, pick engines in Project Settings, press play.
Manual path — turn those flags off to drive the session yourself: * Connect() — open TCP session to ServerHost:ServerPort. * OnConnectionChanged(bConnected=true) — bind to continue; or poll IsConnected(). * CreateSession(Engine, ...) — configure explicitly (overrides settings). Completion arrives on OnCreateSessionComplete; IsSessionReady() is true thereafter. * CreateAgent — attach a UTryllAgentComponent (auto-creates once the session is ready) or call RequestCreateAgent(). * SendMessage(Text) — drive one turn; chunks on OnAnswerText, the turn ends with OnTurnComplete(Status). * RequestDestroyAgent / Disconnect — tear down when done.
All delegates fire on the game thread from Tick(); it is safe to touch UObjects and UI directly from callbacks.
Public Types Documentation¶
typedef FTryllOnEmbeddedStorageCreated¶
typedef FTryllOnEmbeddedStorageDestroyed¶
typedef FTryllOnStringStorage¶
Public Attributes Documentation¶
variable OnAgentDestroyed¶
variable OnConnectionChanged¶
variable OnCreateEmbeddedStringStorageComplete¶
variable OnCreateSessionComplete¶
variable OnCreateStringStorageComplete¶
variable OnDestroyEmbeddedStringStorageComplete¶
variable OnDestroyStringStorageComplete¶
variable OnDownloadComplete¶
variable OnDownloadProgress¶
variable OnError¶
variable OnIntentClassified¶
Broadcast when a ClassifyIntentNode emits an intent on its "found" path with notify_client enabled.
variable OnListModelsComplete¶
variable OnLoadModelComplete¶
variable OnModelReady¶
Fired when a RequestModel sequence terminates (load succeeded, or fallback download+load succeeded, or any step failed). bSuccess is the final outcome.
variable OnNodeEvent¶
Broadcast for any NodeEvent whose event_type has no typed delegate (or whose typed delegate has no subscribers). Untyped fallback.
variable OnPaused¶
Broadcast when the executor pauses a turn between nodes (Pause node, or pausing ToolCall dispositions).
variable OnToolCall¶
Broadcast when a ToolCallNode emits a tool_call NodeEvent (notifying dispositions).
variable OnToolCallDetailed¶
Detailed tool-call event carrying the full owning FTryllToolCall (node + disposition).
variable OnToolCallWithId¶
Call-ID-aware tool-call event used to correlate Resume tool results.
variable OnUnloadModelComplete¶
variable ServerBuildConfig¶
Server build configuration ("Debug" | "Release" | "Production").
variable ServerExePath¶
Canonical path of the connected server executable (empty if unknown).
variable ServerHost¶
Host name or IP address of the Tryll server. Defaults to localhost.
variable ServerIdleTimeoutSeconds¶
Server idle-shutdown grace period in seconds (0 when standalone).
variable ServerPort¶
TCP port the Tryll server is listening on (default: 9100).
variable ServerRunId¶
Per-process server run id (UUID).
variable ServerVersion¶
Server version string.
variable bServerManaged¶
True when the server runs in managed (idle-self-exit) mode.
Public Functions Documentation¶
function BindVoiceInputClient¶
function Connect¶
Open a TCP session to ServerHost:ServerPort. Asynchronous — completion is reported via OnConnectionChanged(bConnected=true). Errors fire OnError. Calling Connect() while already connected is a no-op.
function CreateSession¶
void UTryllSubsystem::CreateSession (
ETryllInferenceEngine Engine,
FString GameName=TEXT(""),
ETryllInferenceEngine SttEngine=ETryllInferenceEngine::Mock,
ETryllInferenceEngine TtsEngine=ETryllInferenceEngine::Mock,
ETryllInferenceEngine EmbeddingEngine=ETryllInferenceEngine::Mock,
FString StorageDataFolder=TEXT("")
)
Send CreateSessionRequest. Must be called after Connected and before CreateAgent. Result is delivered via OnCreateSessionComplete delegate.
Parameters:
EngineInference backend to use for this session.GameNameIntegration identifier for telemetry grouping (e.g. "tryll-roleplay-demo"). Leave empty to omit; the server defaults to "unknown" when telemetry is on. Pass UTryllRuntimeSettings::GameName to drive this from the project settings asset.StorageDataFolderProject-relative storage root (e.g. UTryllRuntimeSettings::StorageDataFolder) or an absolute path. Resolved to a full path on the wire. Empty = server default storage root.
function CreateSessionFromSettings¶
Configure the session from project settings (UTryllRuntimeSettings): engine selections, game name, and storage folder.
This is the "use settings" path. It runs automatically once connected when UTryllRuntimeSettings::bAutoCreateSession is true; call it yourself if you connected with that flag disabled and still want the settings-driven config. To override settings, call CreateSession() with explicit parameters instead.
function Deinitialize¶
function Disconnect¶
Close the active session. OnConnectionChanged(bConnected=false) fires once the socket is down.
function FindAgent¶
function GetSessionId¶
Server-assigned session id, or 0 when not connected.
function GetStatId¶
function GetTickableTickType¶
function Initialize¶
function IsConnected¶
True while the background connection is in the Connected state.
function IsSessionReady¶
True once the current connection has a successfully configured session (CreateSession completed OK). Agent / VoiceInput creation must wait for this — creating against an unconfigured session is rejected by the server.
function IsTickable¶
function IsTickableInEditor¶
function IsTickableWhenPaused¶
function RegisterAgent¶
function RequestCreateAgent¶
void UTryllSubsystem::RequestCreateAgent (
const FTryllGraphDescription & Graph,
TFunction< FTryllOnAgentCreated > OnComplete,
bool bEnableDiagnostics=false,
bool bMaintainDialogueHistory=true,
const TArray< FTryllVariableDecl > & Variables={},
ETryllKvCacheInitialization KvCacheInitialization=ETryllKvCacheInitialization::AllocateOnly,
ETryllWorkload Workload=ETryllWorkload::Interactive
)
Begin create-agent; completion is delivered via OnComplete on the game thread.
Parameters:
GraphWorkflow graph description to send to the server.bEnableDiagnosticsWhen true the server populates TurnComplete.debug_info.bMaintainDialogueHistoryWhen true (default) the agent keeps its full dialogue history; when false the history is discarded after each turn (stateless agent — for classification/routing/tool-picking agents).
function RequestCreateEmbeddedStringStorage¶
void UTryllSubsystem::RequestCreateEmbeddedStringStorage (
const FString & Name,
const FString & ConfigPath,
const FString & EmbeddingModel=FString{},
TFunction< FTryllOnEmbeddedStorageCreated > OnComplete=nullptr
)
Create an EmbeddedStringStorage from a server-side *.fig.json. Path A: config file + optional embeddingModel override.
function RequestCreateEmbeddedStringStorageFromStrings¶
void UTryllSubsystem::RequestCreateEmbeddedStringStorageFromStrings (
const FString & Name,
const TArray< FString > & Strings,
const FString & EmbeddingModel,
TFunction< FTryllOnEmbeddedStorageCreated > OnComplete=nullptr
)
Create an EmbeddedStringStorage from inline strings. Path B: requires EmbeddingModel.
function RequestCreateStringStorage¶
void UTryllSubsystem::RequestCreateStringStorage (
const FString & Name,
const TArray< FString > & Strings,
TFunction< FTryllOnStringStorage > OnComplete=nullptr
)
Create a named StringStorage on the server from an inline string array. Completion is broadcast via OnCreateStringStorageComplete.
function RequestCreateStringStorageFromFile¶
void UTryllSubsystem::RequestCreateStringStorageFromFile (
const FString & Name,
const FString & FilePath,
uint8 Kind=0,
TFunction< FTryllOnStringStorage > OnComplete=nullptr
)
Create a named StringStorage on the server from a server-side file path.
Parameters:
Kind0=List (default), 1=Map, 2=Multimap. When Kind is Map or Multimap the file must be a JSON array of {id, text} objects. Completion is broadcast via OnCreateStringStorageComplete.
function RequestCreateStringStorageKeyed¶
void UTryllSubsystem::RequestCreateStringStorageKeyed (
const FString & Name,
const TArray< FString > & Keys,
const TArray< FString > & Values,
uint8 Kind=1,
TFunction< FTryllOnStringStorage > OnComplete=nullptr
)
Create a named StringStorage on the server from inline key/value pairs.
Parameters:
Kind1=Map (default; keys must be unique), 2=Multimap (duplicate keys allowed). Completion is broadcast via OnCreateStringStorageComplete.
function RequestCreateVoiceInput¶
void UTryllSubsystem::RequestCreateVoiceInput (
const FTryllVoiceInputConfig & Config,
TFunction< FTryllOnVoiceInputCreated > OnComplete
)
Create a server-side VoiceInput (STT) handle. Completion is delivered via OnComplete on the game thread with a TSharedPtr<FTryllVoiceInput> on success.
function RequestDestroyAgent¶
Queue destroy for the given agent.
function RequestDestroyEmbeddedStringStorage¶
void UTryllSubsystem::RequestDestroyEmbeddedStringStorage (
const FString & Name,
TFunction< FTryllOnEmbeddedStorageDestroyed > OnComplete=nullptr
)
Destroy a named EmbeddedStringStorage on the server. Nodes that already hold the storage are unaffected.
function RequestDestroyStringStorage¶
void UTryllSubsystem::RequestDestroyStringStorage (
const FString & Name,
TFunction< FTryllOnStringStorage > OnComplete=nullptr
)
Destroy a named StringStorage on the server. Nodes that already hold the storage are unaffected.
function RequestDestroyVoiceInput¶
Queue destroy for the given VoiceInput handle.
function RequestDownloadModel¶
Start downloading a model. Progress is broadcast via OnDownloadProgress (name, bytesDownloaded, totalBytes, percent 0–100); completion via OnDownloadComplete (name, bSuccess, errorMessage — empty on success).
function RequestListModels¶
List models available for the session's inference engine.
function RequestLoadModel¶
Pin a model into memory on the server (LoadAndPin). Completion is broadcast via OnLoadModelComplete.
function RequestModel¶
Ensure a model is loaded and pinned. Tries LoadModel first; if the model is not present on disk the subsystem falls back to DownloadModel and retries the load. Single completion event: OnModelReady(name, bSuccess).
function RequestUnloadModel¶
Demote a pinned model to on-demand and evict it if no contexts hold it. Completion is broadcast via OnUnloadModelComplete.
function SetInferenceThrottle¶
Report how hard the server should yield the GPU back to the game (the manual inference throttle knob). Fire-and-forget: no response, no error surfaced locally. Never sent automatically — a session that never calls this runs unthrottled.
Parameters:
Level0 = full speed (default), 1 = maximum yielding. Clamped server-side; out-of-range values do not fail here.
function SnapshotRegisteredAgents¶
function Tick¶
function UnregisterAgent¶
Public Static Functions Documentation¶
function GetAvailableServerVariants¶
Variant subfolders (Default/Release) whose target resolves on disk.
function GetServerRootDir¶
<PluginBaseDir>/Binaries/ThirdParty/TryllServer; empty if the plugin is not found.
function ResolveServerExePath¶
Server exe to launch for Preferred; see .cpp for the editor/packaged resolution.
The documentation for this class was generated from the following file C:/_tryll/_monorepo3/tryll/clients/unreal/Source/TryllClient/Public/TryllSubsystem.h