Unity Client API¶
Package: com.tryll.client
Namespace: Tryll.Client
Target: Unity 6 (6000.x), .NET Standard 2.1, Windows Standalone + Editor
The Unity client is a hand-authored C# port of the Unreal plugin. The public surface is documented on this page and the entity pages linked below. Internal types under
Tryll.Client.Internalare not part of the public API.
Inspector entities¶
These types appear in the Inspector and have dedicated reference pages.
| Type | Kind | Description |
|---|---|---|
| TryllClient | MonoBehaviour |
Singleton session manager. Created automatically — do not add it to a scene. |
| TryllAgentComponent | MonoBehaviour |
Drop-in component that owns and drives one agent on a GameObject. |
| TryllVoiceInputComponent | MonoBehaviour |
Microphone capture component that streams audio to the STT pipeline. |
| TryllWorkflowAsset | ScriptableObject |
Project asset that stores a TryllGraphDescription. |
| TryllRuntimeSettings | ScriptableObject |
Package settings (server path, host, port). Edit via Project Settings → Tryll Client. |
TryllAgent¶
IDisposable handle for a server-side agent. Obtained from
TryllClient.RequestCreateAgentAsync or from TryllAgentComponent.Agent.
public ulong AgentId { get; }
public bool IsValid { get; }
// Actions
public void SendMessage(string text);
public void ChangeParam(string nodeName, string paramName, string paramValue,
Action<TryllError> onComplete = null);
// Lifetime
public void Dispose();
Ownership
If you obtain a TryllAgent directly from TryllClient.RequestCreateAgentAsync
(not via TryllAgentComponent), you own it and must call Dispose().
TryllError¶
Value-type error struct. Always check IsOk before using an API result.
[Serializable]
public struct TryllError
{
public int Code; // 0 = OK. See TryllErrorCode enum for named values.
public string Message;
public bool IsOk => Code == 0;
public static TryllError Ok();
}
TryllErrorCode¶
Named error code constants. Values match the server ErrorCodes.h. See
Error Codes for the full table.
public enum TryllErrorCode
{
Ok = 0,
// Connection: 1001–1003
// Session: 2001–2002
// Agent: 3001–3007
// Inference: 4001–4003
// Protocol: 5001–5004
// Download: 6001–6004
// StringStorage: 7001–7003
}
TryllGraphDescription and related types¶
[Serializable]
public struct TryllGraphDescription
{
public List<TryllNodeDescription> Nodes;
public string StartNode;
public string DefaultModelName;
}
[Serializable]
public struct TryllNodeDescription
{
public string Name;
public TryllNodeParamsBase Params; // typed subclass; exit fields live here
public List<TryllToolDefinition> Tools;
}
Wiring between nodes is set as exit fields directly on the typed Params
object — e.g. TryllGenerateParams.DefaultExit, TryllHumanMessageGuardrailParams.TriggeredExit.
An empty string routes to END (the default). See each node type's params class
for the full list of exit fields and configuration params.
TryllGraphBuilder¶
Fluent builder for TryllGraphDescription. Typed AddXxx() methods accept a
typed params object; exit fields are set on that object before calling AddXxx().
var graph = new TryllGraphBuilder()
.AddGenerate("gen", new TryllGenerateParams
{
ModelName = "mymodel",
// DefaultExit defaults to "" (END)
})
.SetStartNode("gen")
.SetDefaultModelName("mymodel")
.Build();
TryllModelInfo¶
[Serializable]
public struct TryllModelInfo
{
public string Name;
public TryllModelStatus Status;
public string HuggingFaceRepo;
public long SizeBytes;
}
Enumerations¶
public enum TryllInferenceEngine : byte { Mock, LlamaCpp, OnnxGenAI, WindowsML, OpenVino, TensorRtLlm }
public enum TryllNodeType : byte { Generate, HumanMessageGuardrail, CannedResponse, ToolCall, Retrieve }
public enum TryllTurnStatus : byte { Success, Error, Cancelled }
public enum TryllModelStatus : byte { Absent, Local, Downloading, Loaded, Downloaded }
public enum TryllKnowledgePlacement : byte { InPlaceOfUser, BeforeUserAsUser, BeforeUserAsSystem, AfterUserAsUser, AfterUserAsSystem }
public enum TryllKnowledgeAllEmptyBehavior : byte { UseAlternateTemplate, Skip }
Threading and error handling summary¶
- All events and
Task<T>completions fire on the Unity main thread. - Always check
error.IsOkbefore using anyTask<T>result. - Call
TryllAgentComponent.SendMessage/CreateAgentfrom the main thread only. - Use
awaitonly fromasync voidmethods rooted on the main thread (e.g.,async void Start()).