Skip to content

Class UTryllAgentComponent

ClassList > UTryllAgentComponent

More...

  • #include <TryllAgentComponent.h>

Inherits the following classes: UActorComponent

Public Attributes

Type Name
FTryllGraphDescription InlineGraphDescription
TArray< FTryllVariableDecl > InlineVariables
ETryllKvCacheInitialization KvCacheInitialization = ETryllKvCacheInitialization::AllocateOnly
FOnTryllAgentReady OnAgentReady
FOnTryllAgentAnswerFull OnAnswerFull
FOnTryllAgentAnswerText OnAnswerText
FOnTryllAppendInteractionsError OnAppendInteractionsError
FOnTryllAgentError OnError
FOnTryllInteractionsAppended OnInteractionsAppended
FOnTryllInteractionsRemoved OnInteractionsRemoved
FOnTryllKvCacheEvictError OnKvCacheEvictError
FOnTryllKvCacheEvicted OnKvCacheEvicted
FOnTryllKvCachePrefillError OnKvCachePrefillError
FOnTryllKvCachePrefilled OnKvCachePrefilled
FOnTryllKvCacheStatus OnKvCacheStatus
FOnTryllKvCacheStatusError OnKvCacheStatusError
FOnTryllParamChanged OnParamChanged
FOnTryllRemoveInteractionsError OnRemoveInteractionsError
FOnTryllResumed OnResumed
FOnTryllAgentTurnComplete OnTurnComplete
TObjectPtr< UTryllSpeakerComponent > Speaker = nullptr
TArray< FTryllVariableOverride > VariableOverrides
UTryllWorkflowAsset * WorkflowAsset = nullptr
ETryllWorkload Workload = ETryllWorkload::Interactive
bool bAutoCreateOnConnect = true
bool bEnableDiagnostics = false
bool bMaintainDialogueHistory = true

Public Functions

Type Name
void AppendInteractions (const TArray< FTryllDialogInteraction > & Interactions)
void Cancel (ETryllCancelMode Mode=ETryllCancelMode::StopAndKeep)
void ChangeParams (const FString & NodeName, UTryllNodeParamsBase * Params)
void CreateAgent ()
void DestroyAgent ()
void EvictKvCache ()
int64 GetAgentId () const
void GetKvCacheStatus ()
FTryllAgentVariables * GetLiveVariables ()
UTryllNodeParamsBase * GetNodeParamsBaseline (const FString & NodeName) const
TArray< FString > GetStartNodeOptions () const
UTryllAgentVariables * GetVariables ()
bool HasLiveAgent () const
bool HasPausedToolBatch () const
bool IsAgentReady () const
void PrefillKvCache ()
void RegisterTool (const FString & ToolName, FTryllToolHandler Handler)
void RegisterTool (const FString & ToolName, FTryllSimpleToolHandler Handler)
void RemoveInteractionsFromEnd (int32 Count)
void Resume (const FString & ResumeNode=TEXT(""))
void ResumeWithToolResult (const FTryllToolResult & ToolResult, const FString & ResumeNode=TEXT(""))
void ResumeWithToolResults (const TArray< FTryllToolResult > & ToolResults, const FString & ResumeNode=TEXT(""))
void RetryPausedToolBatch ()
void SendMessage (const FString & Message)
UTryllAgentComponent ()
bool UnregisterTool (const FString & ToolName)

Protected Functions

Type Name
virtual void BeginPlay () override
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override

Detailed Description

Actor component: manages one Tryll server-side agent. Attach to any Actor; Blueprint users bind to the delegates and call SendMessage().

Graph resolution order: * WorkflowAsset (if set) — designer-authored data asset in the Content Browser. This is the supported way to give the component a graph. * InlineGraphDescription — set programmatically in C++ or edited in the Details panel. Temporary: this fallback will be removed in a future release.

The component auto-creates an agent once the session is ready (if bAutoCreateOnConnect) — it queues until OnCreateSessionComplete if it spawns before the session is configured. It auto-destroys the agent on EndPlay.

Public Attributes Documentation

variable InlineGraphDescription

FTryllGraphDescription UTryllAgentComponent::InlineGraphDescription;

Fallback graph description used when WorkflowAsset is not set. Can be populated programmatically via FTryllGraphBuilder::Build().

Temporary: inline graphs will be removed in a future release — author the graph as a Workflow Asset instead.


variable InlineVariables

TArray<FTryllVariableDecl> UTryllAgentComponent::InlineVariables;

Declared per-agent Variables when WorkflowAsset is not set (WorkflowAsset->Variables is used instead when one is).


variable KvCacheInitialization

ETryllKvCacheInitialization UTryllAgentComponent::KvCacheInitialization;

How language-model KV contexts are materialised at agent creation.


variable OnAgentReady

FOnTryllAgentReady UTryllAgentComponent::OnAgentReady;

Fired once after the server confirms the agent has been created.


variable OnAnswerFull

FOnTryllAgentAnswerFull UTryllAgentComponent::OnAnswerFull;

Fired after TurnComplete with the full accumulated response text.


variable OnAnswerText

FOnTryllAgentAnswerText UTryllAgentComponent::OnAnswerText;

Fired for each streaming AnswerText chunk. * Text = the chunk (delta or accumulated, per server config). * bIsFinal = true on the last chunk before TurnComplete.


variable OnAppendInteractionsError

FOnTryllAppendInteractionsError UTryllAgentComponent::OnAppendInteractionsError;

variable OnError

FOnTryllAgentError UTryllAgentComponent::OnError;

Fired on any agent-level error (send failure, server error response).


variable OnInteractionsAppended

FOnTryllInteractionsAppended UTryllAgentComponent::OnInteractionsAppended;

variable OnInteractionsRemoved

FOnTryllInteractionsRemoved UTryllAgentComponent::OnInteractionsRemoved;

variable OnKvCacheEvictError

FOnTryllKvCacheEvictError UTryllAgentComponent::OnKvCacheEvictError;

variable OnKvCacheEvicted

FOnTryllKvCacheEvicted UTryllAgentComponent::OnKvCacheEvicted;

variable OnKvCachePrefillError

FOnTryllKvCachePrefillError UTryllAgentComponent::OnKvCachePrefillError;

variable OnKvCachePrefilled

FOnTryllKvCachePrefilled UTryllAgentComponent::OnKvCachePrefilled;

variable OnKvCacheStatus

FOnTryllKvCacheStatus UTryllAgentComponent::OnKvCacheStatus;

variable OnKvCacheStatusError

FOnTryllKvCacheStatusError UTryllAgentComponent::OnKvCacheStatusError;

variable OnParamChanged

FOnTryllParamChanged UTryllAgentComponent::OnParamChanged;

Fired when a ChangeParam request completes. * bSuccess = true on Ack; false on any server error. * ErrorMessage = empty on success; human-readable description on failure.


variable OnRemoveInteractionsError

FOnTryllRemoveInteractionsError UTryllAgentComponent::OnRemoveInteractionsError;

variable OnResumed

FOnTryllResumed UTryllAgentComponent::OnResumed;

Fired when a Resume request completes. * bSuccess = true on Ack; false on any server error (e.g. AgentNotPaused, UnknownNode). * ErrorMessage = empty on success; human-readable description on failure.


variable OnTurnComplete

FOnTryllAgentTurnComplete UTryllAgentComponent::OnTurnComplete;

Fired when TurnComplete arrives, carrying the turn outcome status.


variable Speaker

TObjectPtr<UTryllSpeakerComponent> UTryllAgentComponent::Speaker;

Optional speaker component used to play streaming TTS audio frames emitted by the agent (e.g. from a GenerateAndSpeak node).

If left unset, BeginPlay will auto-discover a UTryllSpeakerComponent on the same actor (the common case — add both components to your actor and you're done). Set this explicitly when the owning actor has more than one speaker and you need to pick a specific one.

To disable TTS playback entirely: leave this unset AND have no speaker component on the actor.


variable VariableOverrides

TArray<FTryllVariableOverride> UTryllAgentComponent::VariableOverrides;

Per-instance value overrides for the workflow's declared variables (Material-Instance pattern — name/type come from the declaration; only the initial value can be overridden). Entries whose Name/Type no longer match a declared variable are skipped with a warning at agent-creation time.


variable WorkflowAsset

UTryllWorkflowAsset* UTryllAgentComponent::WorkflowAsset;

Designer-authored workflow asset. When set, its Graph takes precedence over InlineGraphDescription for agent creation.


variable Workload

ETryllWorkload UTryllAgentComponent::Workload;

Whether a human ever waits on this agent's turns. Set Background for world-logic/evaluator agents so the inference scheduler paces or defers their work first under GPU pressure. Purely a scheduling hint.


variable bAutoCreateOnConnect

bool UTryllAgentComponent::bAutoCreateOnConnect;

Automatically create the agent once the session is ready (connected + configured).


variable bEnableDiagnostics

bool UTryllAgentComponent::bEnableDiagnostics;

Request the server to populate TurnComplete.debug_info with workflow execution data. Authoring UI retired (Package 2): Chat and Agent Log OR this on via transient override / diagnostics-demand lease. Kept for runtime/Blueprint API and asset compatibility; default remains false (zero overhead in production).


variable bMaintainDialogueHistory

bool UTryllAgentComponent::bMaintainDialogueHistory;

When true (default) the agent keeps its full dialogue history across turns. When false the history is discarded after each turn — a stateless agent, useful for technical/classification agents that should not store or project prior turns.


Public Functions Documentation

function AppendInteractions

void UTryllAgentComponent::AppendInteractions (
    const TArray< FTryllDialogInteraction > & Interactions
) 

Append scripted user/assistant interactions without running the graph.


function Cancel

void UTryllAgentComponent::Cancel (
    ETryllCancelMode Mode=ETryllCancelMode::StopAndKeep
) 

Cooperatively cancel the in-flight turn. The turn ends with ETryllTurnStatus::Cancelled via OnTurnComplete. No-op if idle or the agent is not ready. Mode selects whether the partial interaction is kept (StopAndKeep, the chat "Stop" button) or discarded (StopAndDiscard).


function ChangeParams

void UTryllAgentComponent::ChangeParams (
    const FString & NodeName,
    UTryllNodeParamsBase * Params
) 

Mutate a named parameter on a workflow node at runtime. The agent must not be processing a turn. On completion (success or error), OnParamChanged fires.

Use the clone-set-send idiom: auto* P = Cast<UTryllGenerateParams>(GetNodeParamsBaseline("gen")); auto* Mut = Cast<UTryllGenerateParams>(UTryllNodeParamsFactory::CloneParams(P, this)); Mut->SystemPrompt = TEXT("New prompt"); ChangeParams(TEXT("gen"), Mut);

Parameters:

  • NodeName Instance name of the target node in the graph.
  • Params Fully specified typed params for the node (clone of baseline + edits).

function CreateAgent

void UTryllAgentComponent::CreateAgent () 

Request creation of a server-side agent from WorkflowAsset (if set) or InlineGraphDescription. Fires OnAgentReady on success; OnError on failure. Safe to call from Blueprint Begin Play.


function DestroyAgent

void UTryllAgentComponent::DestroyAgent () 

Request destruction of the current server-side agent. OnAgentDestroyed (on the subsystem) fires on completion.


function EvictKvCache

void UTryllAgentComponent::EvictKvCache () 

Release every eligible language-model backend KV context.


function GetAgentId

inline int64 UTryllAgentComponent::GetAgentId () const

Server-assigned agent id, or 0 if the agent has not been created yet.


function GetKvCacheStatus

void UTryllAgentComponent::GetKvCacheStatus () 

Query aggregate language-model KV-cache lifecycle state.


function GetLiveVariables

FTryllAgentVariables * UTryllAgentComponent::GetLiveVariables () 

C++ access to the live variables mirror: the PIE agent when ready, otherwise an editor-preview agent attached by Tryll Chat (if any). Null when neither is active. Used by Details customization for live override apply / Flush Now.


function GetNodeParamsBaseline

UTryllNodeParamsBase * UTryllAgentComponent::GetNodeParamsBaseline (
    const FString & NodeName
) const

Return the authored params baseline for the named node. Call after OnAgentReady has fired; returns null if the node name is unknown.


function GetStartNodeOptions

inline TArray< FString > UTryllAgentComponent::GetStartNodeOptions () const

Options provider for FTryllGraphDescription::StartNode dropdown in the Details panel.


function GetVariables

UTryllAgentVariables * UTryllAgentComponent::GetVariables () 

Blueprint/C++ access to this agent's declared per-agent Variables, or nullptr if no agent is ready. Use to Set/Get/AddToSet/RemoveFromSet/Reset declared variables from Blueprint or C++ — see UTryllAgentVariables. (C++ code that needs the raw mirror can use the agent's own FTryllAgent::GetVariables().)


function HasLiveAgent

bool UTryllAgentComponent::HasLiveAgent () const

True when a PIE agent or editor-preview agent is available for live variable edits.


function HasPausedToolBatch

bool UTryllAgentComponent::HasPausedToolBatch () const

True while a paused tool-call batch is retained: surfaced by the current pause and not yet cleared by a successful resume Ack, turn end/cancel, destroy, or a terminal disconnect. False when no agent is ready.


function IsAgentReady

inline bool UTryllAgentComponent::IsAgentReady () const

True after the server has confirmed agent creation (OnAgentReady has fired).


function PrefillKvCache

void UTryllAgentComponent::PrefillKvCache () 

Synchronise every eligible language-model context to its reusable prefix.


function RegisterTool [1/2]

void UTryllAgentComponent::RegisterTool (
    const FString & ToolName,
    FTryllToolHandler Handler
) 

Register native game-thread auto-resume sugar for a named tool.


function RegisterTool [2/2]

void UTryllAgentComponent::RegisterTool (
    const FString & ToolName,
    FTryllSimpleToolHandler Handler
) 

function RemoveInteractionsFromEnd

void UTryllAgentComponent::RemoveInteractionsFromEnd (
    int32 Count
) 

Remove whole interactions from the end of the dialog.


function Resume

void UTryllAgentComponent::Resume (
    const FString & ResumeNode=TEXT("")
) 

Resume a turn that is currently paused (see the subsystem's OnPaused event, fired for the Pause node / pausing ToolCall dispositions). On completion (success or error), OnResumed fires.

Parameters:

  • ResumeNode Empty continues via the paused node's pending exit route; non-empty jumps to that node by name.

function ResumeWithToolResult

void UTryllAgentComponent::ResumeWithToolResult (
    const FTryllToolResult & ToolResult,
    const FString & ResumeNode=TEXT("")
) 

Resume with one result correlated to a tool-call ID.


function ResumeWithToolResults

void UTryllAgentComponent::ResumeWithToolResults (
    const TArray< FTryllToolResult > & ToolResults,
    const FString & ResumeNode=TEXT("")
) 

Resume with the complete result batch for one paused tool-call pass.


function RetryPausedToolBatch

void UTryllAgentComponent::RetryPausedToolBatch () 

Re-attempt the retained paused tool-call batch: handlers that already produced a result on a previous attempt are skipped, remaining handlers run, and a fresh Resume is sent. No-op when no agent is ready or there is no retained batch.


function SendMessage

void UTryllAgentComponent::SendMessage (
    const FString & Message
) 

Send a user-turn message to the agent. Streaming tokens arrive on OnAnswerText; the turn ends with OnTurnComplete + OnAnswerFull. No-op if the agent is not yet ready (IsAgentReady() == false).


function UTryllAgentComponent

UTryllAgentComponent::UTryllAgentComponent () 

function UnregisterTool

bool UTryllAgentComponent::UnregisterTool (
    const FString & ToolName
) 

Remove a previously registered native tool handler.


Protected Functions Documentation

function BeginPlay

virtual void UTryllAgentComponent::BeginPlay () override

function EndPlay

virtual void UTryllAgentComponent::EndPlay (
    const EEndPlayReason::Type EndPlayReason
) override


The documentation for this class was generated from the following file C:/_tryll/_monorepo3/tryll/clients/unreal/Source/TryllClient/Public/TryllAgentComponent.h