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 |
| FOnTryllConfigureSession | OnConfigureSessionComplete |
| FOnTryllConnectionChanged | OnConnectionChanged |
| FOnTryllCreateEmbeddedStringStorage | OnCreateEmbeddedStringStorageComplete |
| FOnTryllCreateStringStorage | OnCreateStringStorageComplete |
| FOnTryllDestroyEmbeddedStringStorage | OnDestroyEmbeddedStringStorageComplete |
| FOnTryllDestroyStringStorage | OnDestroyStringStorageComplete |
| FOnTryllDownloadComplete | OnDownloadComplete |
| FOnTryllDownloadProgress | OnDownloadProgress |
| FOnTryllError | OnError |
| FOnTryllListModels | OnListModelsComplete |
| FOnTryllLoadModel | OnLoadModelComplete |
| FOnTryllModelReady | OnModelReady |
| FOnTryllToolCall | OnToolCall |
| FOnTryllUnloadModel | OnUnloadModelComplete |
Public Functions¶
| Type | Name |
|---|---|
| void | ConfigureSession (ETryllInferenceEngine Engine, bool bAllowAutoModelDownloading=false) |
| void | Connect () |
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams (FOnTryllCreateEmbeddedStringStorage, const FString &, Name, int32, RecordCount, bool, bSuccess) |
|
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (FOnTryllCreateStringStorage, const FString &, Name, bool, bSuccess) |
|
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (FOnTryllDestroyStringStorage, const FString &, Name, bool, bSuccess) |
|
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (FOnTryllDestroyEmbeddedStringStorage, const FString &, Name, bool, bSuccess) |
|
| virtual void | Deinitialize () override |
| void | Disconnect () |
| int64 | GetSessionId () const |
| virtual TStatId | GetStatId () override const |
| virtual ETickableTickType | GetTickableTickType () override const |
| virtual void | Initialize (FSubsystemCollectionBase & Collection) override |
| bool | IsConnected () 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) |
| 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, TFunction< FTryllOnStringStorage > OnComplete=nullptr) |
| void | RequestDestroyAgent (TSharedPtr< FTryllAgent > Agent) |
| void | RequestDestroyEmbeddedStringStorage (const FString & Name, TFunction< FTryllOnEmbeddedStorageDestroyed > OnComplete=nullptr) |
| void | RequestDestroyStringStorage (const FString & Name, TFunction< FTryllOnStringStorage > OnComplete=nullptr) |
| 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) |
| virtual void | Tick (float DeltaTime) override |
| UPROPERTY (EditAnywhere, BlueprintReadWrite, Category="Tryll|Connection", meta=(ToolTip="Host name or IP address of the Tryll server (default: 127.0.0.1).")) |
|
| UPROPERTY (EditAnywhere, BlueprintReadWrite, Category="Tryll|Connection", meta=(ToolTip="TCP port the Tryll server is listening on (default: 9100).", ClampMin="1", ClampMax="65535")) |
|
| void | UnregisterAgent (std::uint64_t AgentId) |
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.
Lifecycle (game-thread, event-driven): * Connect() — open TCP session to ServerHost:ServerPort. * OnConnectionChanged(bConnected=true) — bind this to continue; or poll IsConnected(). * ConfigureSession(Engine) — select the inference engine for this session. Completion arrives on OnConfigureSessionComplete. * CreateAgent — either attach a UTryllAgentComponent (which calls RequestCreateAgent under the hood when bAutoCreateOnConnect is true) or invoke RequestCreateAgent() directly with a graph. On success the callback gets a TSharedPtr<FTryllAgent>. * SendMessage(Text) — drive one turn through the agent. Streaming chunks arrive 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.
Usage: UTryllSubsystem* Tryll = GetGameInstance()->GetSubsystem<UTryllSubsystem>(); Tryll->Connect(); // Bind OnConnectionChanged to ConfigureSession, then CreateAgent, then SendMessage.
Public Types Documentation¶
typedef FTryllOnEmbeddedStorageCreated¶
typedef FTryllOnEmbeddedStorageDestroyed¶
typedef FTryllOnStringStorage¶
Public Attributes Documentation¶
variable OnAgentDestroyed¶
variable OnConfigureSessionComplete¶
variable OnConnectionChanged¶
variable OnCreateEmbeddedStringStorageComplete¶
variable OnCreateStringStorageComplete¶
variable OnDestroyEmbeddedStringStorageComplete¶
variable OnDestroyStringStorageComplete¶
variable OnDownloadComplete¶
variable OnDownloadProgress¶
variable OnError¶
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 OnToolCall¶
Broadcast when a ToolCallNode detects a tool call with notify_client enabled.
variable OnUnloadModelComplete¶
Public Functions Documentation¶
function ConfigureSession¶
void UTryllSubsystem::ConfigureSession (
ETryllInferenceEngine Engine,
bool bAllowAutoModelDownloading=false
)
Send ConfigureSessionRequest. Must be called after Connected and before CreateAgent. Result is delivered via OnConfigureSessionComplete delegate.
Parameters:
EngineInference backend to use for this session.bAllowAutoModelDownloadingWhen true, CreateAgent automatically downloads any missing models referenced by the graph instead of failing immediately. Intended for development and prototyping only. Pass UTryllRuntimeSettings::bAllowAutoModelDownloading to drive this from the project settings asset.
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 DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams¶
UTryllSubsystem::DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams (
FOnTryllCreateEmbeddedStringStorage,
const FString &,
Name,
int32,
RecordCount,
bool,
bSuccess
)
function DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams [1/3]¶
UTryllSubsystem::DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (
FOnTryllCreateStringStorage,
const FString &,
Name,
bool,
bSuccess
)
function DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams [2/3]¶
UTryllSubsystem::DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (
FOnTryllDestroyStringStorage,
const FString &,
Name,
bool,
bSuccess
)
function DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams [3/3]¶
UTryllSubsystem::DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (
FOnTryllDestroyEmbeddedStringStorage,
const FString &,
Name,
bool,
bSuccess
)
function Deinitialize¶
function Disconnect¶
Close the active session. OnConnectionChanged(bConnected=false) fires once the socket is down.
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 IsTickable¶
function IsTickableInEditor¶
function IsTickableWhenPaused¶
function RegisterAgent¶
function RequestCreateAgent¶
void UTryllSubsystem::RequestCreateAgent (
const FTryllGraphDescription & Graph,
TFunction< FTryllOnAgentCreated > OnComplete,
bool bEnableDiagnostics=false
)
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.
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,
TFunction< FTryllOnStringStorage > OnComplete=nullptr
)
Create a named StringStorage on the server from a server-side file path. Completion is broadcast via OnCreateStringStorageComplete.
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 RequestDownloadModel¶
Start downloading a model. Progress is broadcast via OnDownloadProgress; completion via OnDownloadComplete.
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 Tick¶
function UPROPERTY [1/2]¶
UTryllSubsystem::UPROPERTY (
EditAnywhere,
BlueprintReadWrite,
Category="Tryll|Connection",
meta=(ToolTip="Host name or IP address of the Tryll server (default: 127.0.0.1).")
)
Host name or IP address of the Tryll server. Defaults to localhost.
function UPROPERTY [2/2]¶
UTryllSubsystem::UPROPERTY (
EditAnywhere,
BlueprintReadWrite,
Category="Tryll|Connection",
meta=(ToolTip="TCP port the Tryll server is listening on (default: 9100).", ClampMin="1", ClampMax="65535")
)
TCP port the Tryll server is listening on (default: 9100).
function UnregisterAgent¶
The documentation for this class was generated from the following file C:/_tryll/_monorepo/server/client-unreal/Source/TryllClient/Public/TryllSubsystem.h