Class AgentBehaviour
Agent behaviour callbacks and UnityEvent bridges.
- Implements listener interfaces for agent, conversation, text, image, and tool events.
- Exposes UnityEvents so game code and UI can react to agent activity.
- Converts low-level deltas and tool outputs into high-level Unity events.
public sealed class AgentBehaviour : AIBehaviour, IErrorHandler, IUsageHandler, IUniTaskQueueEventListener, IAgentListener, IConversationListener, IEventListener<ConversationEvent>, ITextDeltaListener, IEventListener<TextDelta>, IImageDeltaListener, IEventListener<ImageDelta>, IToolStatusListener, IEventListener<ToolStatusEvent>, IToolOutputListener, IEventListener<ToolOutputEvent>, IAgentBehaviour
- Inheritance
-
objectAgentBehaviour
- Implements
-
IUniTaskQueueEventListener
- Inherited Members
Remarks
- Attach this component to a GameObject to integrate AI conversation logic, streaming responses, and tool-calling into a scene.
- Exposes a simplified, inspector-friendly API on top of the underlying Agent class so that UI, input, and audio components can interact with the agent without depending on low-level networking or provider-specific details.
- Use the public properties to control the active model, voice, and audio settings at runtime, and the public methods to manage conversations and send messages.
Fields
onAgentPreferencesSaved
Agent preferences save event.
- Invoked after agent preferences are persisted to the configured store.
- Provides the saved AgentPrefs snapshot.
public UnityEvent<AgentPrefs> onAgentPreferencesSaved
Field Value
- UnityEvent<AgentPrefs>
onAgentStatusChanged
Agent status change event.
- Invoked whenever the agent status is updated.
- Provides the new AgentStatus value.
public UnityEvent<AgentStatus> onAgentStatusChanged
Field Value
- UnityEvent<AgentStatus>
onCodeInterpreterCode
Code interpreter code delta event.
- Invoked when code is streamed from the Code Interpreter tool.
- Provides incremental code text and completion flags.
public DeltaEvent<string> onCodeInterpreterCode
Field Value
- DeltaEvent<string>
onCodeInterpreterOutputImage
Code interpreter image event.
- Invoked when the Code Interpreter tool produces an image.
- Provides the generated Texture2D.
public UnityEvent<Texture2D> onCodeInterpreterOutputImage
Field Value
- UnityEvent<Texture2D>
onCodeInterpreterOutputLogs
Code interpreter logs event.
- Invoked when the Code Interpreter tool emits textual logs.
- Provides the raw log content as a string.
public UnityEvent<string> onCodeInterpreterOutputLogs
Field Value
- UnityEvent<string>
onConversationCreated
Conversation created event.
- Invoked when a new conversation instance is created.
- Provides the created Conversation.
public UnityEvent<Conversation> onConversationCreated
Field Value
- UnityEvent<Conversation>
onConversationDeleted
Conversation deleted event.
- Invoked when a conversation delete operation completes.
- Provides a boolean indicating whether the delete succeeded.
public UnityEvent<bool> onConversationDeleted
Field Value
- UnityEvent<bool>
onConversationItemsLoaded
Conversation items loaded event.
- Invoked when conversation items are loaded from storage.
- Provides an array of ConversationItem entries.
public UnityEvent<ConversationItem[]> onConversationItemsLoaded
Field Value
- UnityEvent<ConversationItem[]>
onConversationLoaded
Conversation loaded event.
- Invoked when a conversation is loaded from storage.
- Provides the loaded Conversation.
public UnityEvent<Conversation> onConversationLoaded
Field Value
- UnityEvent<Conversation>
onConversationSummaryUpdated
Conversation summary updated event.
- Invoked when a conversation summary is generated or changed.
- Provides the new conversation summary as a string.
public UnityEvent<string> onConversationSummaryUpdated
Field Value
- UnityEvent<string>
onConversationTitleUpdated
Conversation title updated event.
- Invoked when a conversation title is generated or changed.
- Provides the new conversation title as a string.
public UnityEvent<string> onConversationTitleUpdated
Field Value
- UnityEvent<string>
onConversationsLoaded
Conversation list loaded event.
- Invoked when multiple conversations are loaded from storage.
- Provides an array of loaded Conversation objects.
public UnityEvent<Conversation[]> onConversationsLoaded
Field Value
- UnityEvent<Conversation[]>
onFileSearchOutput
File search output event.
- Invoked when the File Search tool returns results.
- Provides a FileSearchOutput payload.
public UnityEvent<FileSearchOutput> onFileSearchOutput
Field Value
- UnityEvent<FileSearchOutput>
onInputTranscript
Input transcription delta event.
- Invoked when speech input is transcribed into text.
- Provides incremental input transcript text and completion flags.
public DeltaEvent<string> onInputTranscript
Field Value
- DeltaEvent<string>
onMcpListToolsOutput
MCP list tools output event.
- Invoked when an MCP List Tools call returns a result.
- Provides a McpListToolsCallOutput payload.
public UnityEvent<McpListToolsCallOutput> onMcpListToolsOutput
Field Value
- UnityEvent<McpListToolsCallOutput>
onMcpToolOutput
MCP tool output event.
- Invoked when an MCP tool call returns a result.
- Provides a McpOutput payload.
public UnityEvent<McpOutput> onMcpToolOutput
Field Value
- UnityEvent<McpOutput>
onMessage
Assistant message delta event.
- Invoked when assistant output text is streamed or finalized.
- Provides incremental text fragments and completion flags.
public DeltaEvent<string> onMessage
Field Value
- DeltaEvent<string>
onOutputImage
Output image delta event.
- Invoked when an image is produced by an image generation tool.
- Provides a Texture2D and completion flags for streaming scenarios.
public DeltaEvent<Texture2D> onOutputImage
Field Value
- DeltaEvent<Texture2D>
onOutputTranscript
Output transcription delta event.
- Invoked when assistant output speech is transcribed back to text.
- Provides incremental output transcript text and completion flags.
public DeltaEvent<string> onOutputTranscript
Field Value
- DeltaEvent<string>
onReasoning
Reasoning text delta event.
- Invoked when reasoning text is streamed, if supported by the model.
- Provides incremental reasoning content and completion flags.
public DeltaEvent<string> onReasoning
Field Value
- DeltaEvent<string>
onReasoningSummary
Reasoning summary text delta event.
- Invoked when a concise reasoning summary is streamed or updated.
- Provides incremental summary text and completion flags.
public DeltaEvent<string> onReasoningSummary
Field Value
- DeltaEvent<string>
onRefusal
Refusal text delta event.
- Invoked when a refusal message is streamed, if supported.
- Provides incremental refusal text and completion flags.
public DeltaEvent<string> onRefusal
Field Value
- DeltaEvent<string>
onToolStatusChanged
Tool status change event.
- Invoked whenever any tool status is updated.
- Provides a ToolStatusEvent containing status details.
public UnityEvent<ToolStatusEvent> onToolStatusChanged
Field Value
- UnityEvent<ToolStatusEvent>
onUnhandledToolCall
Unhandled tool call event.
- Invoked when a tool call is not handled by any registered tool handler.
- Provides the original ToolCall instance.
public UnityEvent<ToolCall> onUnhandledToolCall
Field Value
- UnityEvent<ToolCall>
onWebSearchOutput
Web search output event.
- Invoked when the Web Search tool returns results.
- Provides a WebSearchOutput payload.
public UnityEvent<WebSearchOutput> onWebSearchOutput
Field Value
- UnityEvent<WebSearchOutput>
Properties
Agent
Underlying runtime Agent instance used by this behaviour.
public Agent Agent { get; }
Property Value
Remarks
This is created and managed internally by AgentBehaviour and should not be replaced at runtime. Use the public methods and properties on AgentBehaviour instead of invoking methods directly on the Agent.
Api
API provider inferred from the selected Model.
public override sealed Api Api { get; }
Property Value
Remarks
This value is derived from Model using Model.SafeGetApi() and is used
by the internal request pipeline to select the correct adapter for the current provider.
AutoInit
public bool AutoInit { get; }
Property Value
- bool
Conversation
Currently active conversation for this agent.
public Conversation Conversation { get; }
Property Value
Remarks
The conversation encapsulates all items (messages, tool calls, and other events) that form the context for the agent's responses.
ConversationStoreType
Storage backend used for persisting conversations associated with this agent.
public ConversationStoreType ConversationStoreType { get; }
Property Value
HasInputAudio
Indicates whether this agent accepts audio input.
public bool HasInputAudio { get; }
Property Value
- bool
Remarks
This flag is used by UI components to show or hide audio-recording controls.
HasOutputAudio
Indicates whether this agent can output audio (TTS).
public bool HasOutputAudio { get; }
Property Value
- bool
Remarks
This flag is used by UI components to show or hide speaker or playback controls.
HasOutputImage
Indicates whether this agent can output images.
public bool HasOutputImage { get; }
Property Value
- bool
Remarks
When enabled and supported by the current model, image outputs may be attached to responses and consumed by UI components.
Id
Unique agent identifier.
public string Id { get; }
Property Value
- string
Remarks
This is typically assigned from the associated AgentSettings and can be used to distinguish different agents when saving or loading data.
IncludeObfuscation
Indicates whether obfuscation metadata should be included in streaming responses.
public bool IncludeObfuscation { get; }
Property Value
- bool
Remarks
Support for this flag is provider-specific and may be ignored if not implemented by the current API or model.
InitialConversationId
Initial conversation identifier to load on initialization.
public string InitialConversationId { get; }
Property Value
- string
Remarks
When empty, a new conversation is created instead. This is typically configured in the inspector to resume a specific conversation across sessions.
InputAudioLanguage
Preferred spoken language for audio input and transcription.
public SystemLanguage InputAudioLanguage { get; set; }
Property Value
- SystemLanguage
Remarks
Defaults to Application.systemLanguage when not explicitly set. This value is used as a hint to the transcription and speech systems and may impact recognition accuracy and voice selection.
InputAudioRecorder
Recorder component used to capture audio input for transcription, if assigned.
public InputAudioRecorder InputAudioRecorder { get; }
Property Value
Instructions
System-level instructions currently applied to this agent.
public string Instructions { get; }
Property Value
- string
Remarks
These instructions are typically derived from AgentSettings and can be updated at runtime via the underlying Agent.
IsInitialized
Indicates whether the underlying Agent has completed initialization.
public bool IsInitialized { get; }
Property Value
- bool
IsRecording
Indicates whether the input audio recorder is currently capturing audio.
public bool IsRecording { get; }
Property Value
- bool
Items
All items contained in the current Conversation.
public List<ConversationItem> Items { get; }
Property Value
- List<ConversationItem>
Remarks
- Items include chat messages, tool calls, tool outputs, and other domain events.
- Use this list when you need the full, low-level event history rather than only user and assistant messages.
LastMessage
Last message in the current conversation, if any.
public Message LastMessage { get; }
Property Value
Remarks
This is useful for quickly retrieving the most recent reply from the agent or the last user input without scanning the full history.
McpApprovalTimeoutSeconds
Timeout in seconds for MCP approval requests.
public int McpApprovalTimeoutSeconds { get; }
Property Value
- int
Messages
User and assistant messages in the current conversation.
public List<Message> Messages { get; }
Property Value
- List<Message>
Remarks
This is a filtered view of Items that only includes message-type entries (system, user, assistant, and tool messages).
Microphone
Name of the microphone device used for audio input.
public string Microphone { get; set; }
Property Value
- string
Remarks
This property proxies Microphone if an
InputAudioRecorder is assigned; otherwise, it returns null.
Model
Active generative model used for this agent.
public Model Model { get; set; }
Property Value
Remarks
-
When
saveDatais enabled, the chosen model is persisted per agent and restored on the next session. - Changing this property at runtime will affect all subsequent requests but will not retroactively modify existing conversation items.
Name
Human-readable name of the agent.
public string Name { get; }
Property Value
- string
Remarks
This name is usually surfaced in UI elements (such as headers or labels) to indicate which agent the user is currently interacting with.
OutputAudioPlayer
Player component used to output synthesized speech, if assigned.
public OutputAudioPlayer OutputAudioPlayer { get; }
Property Value
OutputAudioVolume
Master volume for speech output.
public float OutputAudioVolume { get; set; }
Property Value
- float
Remarks
Valid range is 0.0 (muted) to 1.0 (full volume). Values outside this range
are clamped by the underlying implementation.
SpeechOutputVolume
[Obsolete("Use SpeechVolume instead.")]
public float SpeechOutputVolume { get; set; }
Property Value
- float
SpokenLanguage
[Obsolete("Use InputVoiceLanguage instead.")]
public SystemLanguage SpokenLanguage { get; set; }
Property Value
- SystemLanguage
State
Current lifecycle state of the agent.
public AgentStatus State { get; }
Property Value
Remarks
- None – Not initialized.
- Initializing – Initialization in progress.
- Ready – Ready to accept input.
- Processing – Handling a request.
- Terminating – Shutting down.
Stream
public bool Stream { get; set; }
Property Value
- bool
SubmitToolOutputTimeoutSeconds
Timeout (in seconds) used when waiting for tool outputs to be submitted under the SubmitToolOutput policy.
public int SubmitToolOutputTimeoutSeconds { get; }
Property Value
- int
ToolChoice
Tool selection strategy for this agent.
public ToolChoice ToolChoice { get; set; }
Property Value
UnhandledToolCallBehaviour
Policy describing how to handle tool calls that do not have any registered executor.
public UnhandledToolCallBehaviour UnhandledToolCallBehaviour { get; }
Property Value
Voice
Selected TTS voice for audio responses.
public Voice Voice { get; set; }
Property Value
Remarks
This property is optional and only applies when OutputAudioPlayer is present and the current provider supports speech synthesis.
VoiceRecorder
[Obsolete("Use InputAudioRecorder instead.")]
public InputAudioRecorder VoiceRecorder { get; }
Property Value
WaitForToolCallsCompletion
Indicates whether this agent should wait for tool calls to complete before finalizing the response.
public bool WaitForToolCallsCompletion { get; }
Property Value
- bool
Remarks
If agent has registered tool call executors, the agent response may only contain tool calls without a final response message.
- When this property is true, the agent will wait until all tool calls are handled and tool outputs are submitted,
then generate a final response message that includes the tool outputs.
- If false, the agent will return the response message immediately after generating tool calls,
and the client is responsible for handling tool calls and submitting tool outputs separately.
Currently, this property is always true.
codeInterpreterCode
[Obsolete("Use onCodeInterpreterCode instead.")]
public DeltaEvent<string> codeInterpreterCode { get; }
Property Value
- DeltaEvent<string>
image
[Obsolete("Use onOutputImage instead.")]
public DeltaEvent<Texture2D> image { get; }
Property Value
- DeltaEvent<Texture2D>
inputTranscription
[Obsolete("Use onInputTranscription instead.")]
public DeltaEvent<string> inputTranscription { get; }
Property Value
- DeltaEvent<string>
message
[Obsolete("Use onMessage instead.")]
public DeltaEvent<string> message { get; }
Property Value
- DeltaEvent<string>
onImage
[Obsolete("Use onOutputImage instead.")]
public DeltaEvent<Texture2D> onImage { get; }
Property Value
- DeltaEvent<Texture2D>
onInputTranscription
[Obsolete("Use onInputTranscript instead.")]
public DeltaEvent<string> onInputTranscription { get; }
Property Value
- DeltaEvent<string>
onReceiveCodeInterpreterOutputImage
[Obsolete("Use onReceiveCodeInterpreterOutputImage instead.")]
public UnityEvent<Texture2D> onReceiveCodeInterpreterOutputImage { get; }
Property Value
- UnityEvent<Texture2D>
onReceiveCodeInterpreterOutputLogs
[Obsolete("Use onReceiveCodeInterpreterOutputLogs instead.")]
public UnityEvent<string> onReceiveCodeInterpreterOutputLogs { get; }
Property Value
- UnityEvent<string>
onReceiveFileSearchOutput
[Obsolete("Use onFileSearchOutput instead.")]
public UnityEvent<FileSearchOutput> onReceiveFileSearchOutput { get; }
Property Value
- UnityEvent<FileSearchOutput>
onReceiveMcpListToolsOutput
[Obsolete("Use onMcpListToolsOutput instead.")]
public UnityEvent<McpListToolsCallOutput> onReceiveMcpListToolsOutput { get; }
Property Value
- UnityEvent<McpListToolsCallOutput>
onReceiveMcpToolOutput
[Obsolete("Use onMcpToolOutput instead.")]
public UnityEvent<McpOutput> onReceiveMcpToolOutput { get; }
Property Value
- UnityEvent<McpOutput>
onReceiveWebSearchOutput
[Obsolete("Use onWebToolStatusChanged instead.")]
public UnityEvent<WebSearchOutput> onReceiveWebSearchOutput { get; }
Property Value
- UnityEvent<WebSearchOutput>
onTranscript
[Obsolete("Use onOutputTranscript instead.")]
public DeltaEvent<string> onTranscript { get; }
Property Value
- DeltaEvent<string>
reasoning
[Obsolete("Use onReasoning instead.")]
public DeltaEvent<string> reasoning { get; }
Property Value
- DeltaEvent<string>
reasoningSummary
[Obsolete("Use onReasoningSummary instead.")]
public DeltaEvent<string> reasoningSummary { get; }
Property Value
- DeltaEvent<string>
refusal
[Obsolete("Use onRefusal instead.")]
public DeltaEvent<string> refusal { get; }
Property Value
- DeltaEvent<string>
transcript
[Obsolete("Use onTranscript instead.")]
public DeltaEvent<string> transcript { get; }
Property Value
- DeltaEvent<string>
Methods
AddAttachments(params AudioClip[])
Adds one or more AudioClip assets as attachments to the pending input.
public void AddAttachments(params AudioClip[] audioClips)
Parameters
audioClipsAudioClip[]Audio clips to convert to files and attach.
AddAttachments(params IFile[])
Adds one or more file attachments to the pending input message.
public void AddAttachments(params IFile[] files)
Parameters
filesIFile[]Files to attach.
Remarks
This method can be used to attach images, documents, audio clips, or arbitrary files before sending the next user message to the agent.
AddAttachments(IEnumerable<IFile>)
Adds a collection of files as attachments to the pending input message.
public void AddAttachments(IEnumerable<IFile> files)
Parameters
filesIEnumerable<IFile>Enumerable of files to attach.
Remarks
- If there is no pending message, a new UserMessage is created.
- If the pending message has no content, a new content container is created prior to adding files.
files is null or empty, this method does nothing.
AddAttachments(params TextAsset[])
Adds one or more TextAsset documents as attachments to the pending input.
public void AddAttachments(params TextAsset[] documents)
Parameters
documentsTextAsset[]Text assets to convert to files and attach.
AddAttachments(params Texture2D[])
Adds one or more Texture2D images as attachments to the pending input.
public void AddAttachments(params Texture2D[] images)
Parameters
imagesTexture2D[]Images to convert to files and attach.
Awake()
protected override void Awake()
CreateConversation()
Creates a new conversation and makes it the active one for this agent.
public void CreateConversation()
Remarks
This is a fire-and-forget convenience wrapper around CreateConversationAsync(CancellationToken).
CreateConversationAsync(CancellationToken)
Asynchronously creates a new conversation and makes it active.
public UniTask<Conversation> CreateConversationAsync(CancellationToken ct = default)
Parameters
ctCancellationTokenOptional cancellation token.
Returns
- UniTask<Conversation>
The newly created Conversation.
EnterChatMessage(Message)
[Obsolete("Use SendMessage instead.")]
public void EnterChatMessage(Message request)
Parameters
requestMessage
EnterChatText(string)
[Obsolete("Use SendRequest instead.")]
public void EnterChatText(string inputText)
Parameters
inputTextstring
HandleEvent(ConversationEvent)
public void HandleEvent(ConversationEvent evt)
Parameters
HandleEvent(ImageDelta)
public void HandleEvent(ImageDelta delta)
Parameters
deltaImageDelta
HandleEvent(TextDelta)
public void HandleEvent(TextDelta delta)
Parameters
deltaTextDelta
HandleEvent(ToolOutputEvent)
public void HandleEvent(ToolOutputEvent e)
Parameters
HandleEvent(ToolStatusEvent)
public void HandleEvent(ToolStatusEvent e)
Parameters
InitializeAsync()
Initializes the underlying Agent, conversation controller, and tools.
public override UniTask InitializeAsync()
Returns
- UniTask
A UniTask that completes once initialization is finished.
Remarks
- Subscribe to the agent events (for example, streaming updates or unhandled tool calls) before calling this method.
- If the behaviour is terminating or the agent has already left the None state, this call is ignored.
ListConversationsAsync(CancellationToken)
Lists all conversations associated with this agent.
public UniTask<Conversation[]> ListConversationsAsync(CancellationToken ct = default)
Parameters
ctCancellationTokenOptional cancellation token.
Returns
- UniTask<Conversation[]>
An array of Conversation objects.
LoadConversation(string, bool)
Loads an existing conversation by its identifier and makes it active.
public void LoadConversation(string conversationId, bool createIfNotFound = true)
Parameters
conversationIdstringIdentifier of the conversation to load.
createIfNotFoundboolIf
true, a new conversation is created when the requested one does not exist.
Remarks
This is a fire-and-forget convenience wrapper around LoadConversationAsync(string, bool, CancellationToken).
LoadConversationAsync(string, bool, CancellationToken)
Asynchronously loads a conversation by its identifier and makes it active.
public UniTask<Conversation> LoadConversationAsync(string conversationId, bool createIfNotFound = true, CancellationToken ct = default)
Parameters
conversationIdstringIdentifier of the conversation to load.
createIfNotFoundboolIf
true, a new conversation is created when the requested one does not exist.ctCancellationTokenOptional cancellation token.
Returns
- UniTask<Conversation>
The loaded or newly created Conversation.
OnAgentPreferencesSaved(AgentPrefs)
public void OnAgentPreferencesSaved(AgentPrefs prefs)
Parameters
prefsAgentPrefs
OnAgentStatusChanged(AgentStatus)
public void OnAgentStatusChanged(AgentStatus newStatus)
Parameters
newStatusAgentStatus
OnDestroy()
protected override void OnDestroy()
RegisterMcpApprovalHandler(string, IMcpApprovalHandler)
Registers an MCP approval handler for a given server label.
public void RegisterMcpApprovalHandler(string serverLabel, IMcpApprovalHandler handler)
Parameters
serverLabelstringLogical label of the MCP server.
handlerIMcpApprovalHandlerHandler responsible for approving or rejecting MCP tool calls.
RegisterOAuthTokenProvider(string, IOAuthTokenProvider)
Registers an OAuth token provider for a given server label.
public void RegisterOAuthTokenProvider(string serverLabel, IOAuthTokenProvider provider)
Parameters
serverLabelstringLogical label of the OAuth server (for example, "google" or "microsoft").
providerIOAuthTokenProviderProvider instance that can supply and refresh OAuth tokens.
RegisterToolCallExecutor<TCall, TOutput>(IToolCallExecutor<TCall, TOutput>)
Registers a tool call executor for a specific tool call and output type.
public void RegisterToolCallExecutor<TCall, TOutput>(IToolCallExecutor<TCall, TOutput> executor) where TCall : ToolCall where TOutput : ToolOutput
Parameters
executorIToolCallExecutor<TCall, TOutput>Executor instance that can handle the specified tool type.
Type Parameters
TCallType of the tool call.
TOutputType of the tool output.
Remarks
Registered executors are used to resolve tool calls emitted by the agent when running tools-enabled models or MCP-based integrations.
SaveConversation()
Saves the current conversation using the configured ConversationStoreType.
public void SaveConversation()
Remarks
This is a fire-and-forget convenience wrapper around SaveConversationAsync(CancellationToken).
SaveConversationAsync(CancellationToken)
Asynchronously saves the current conversation.
public UniTask SaveConversationAsync(CancellationToken ct = default)
Parameters
ctCancellationTokenOptional cancellation token.
Returns
- UniTask
A UniTask that completes when the save finishes.
SaveConversationItems()
Saves the items of the current conversation using the configured store.
public void SaveConversationItems()
Remarks
This is a fire-and-forget convenience wrapper around SaveConversationItemsAsync(CancellationToken).
SaveConversationItemsAsync(CancellationToken)
Asynchronously saves the items of the current conversation.
public UniTask SaveConversationItemsAsync(CancellationToken ct = default)
Parameters
ctCancellationTokenOptional cancellation token.
Returns
- UniTask
A UniTask that completes when the save finishes.
SendMessage(Message)
Sends a structured Message to the agent.
public void SendMessage(Message inputMessage)
Parameters
inputMessageMessageMessage to enqueue for processing.
Remarks
The message is stored as a pending input and then scheduled into the internal
processing queue. If inputMessage is null, this call is ignored.
SendText(string)
Sends a plain-text input to the agent as a new user message.
public void SendText(string inputText)
Parameters
inputTextstringUser text to send.
Remarks
This is a convenience helper that wraps the provided text in a UserMessage and forwards it to SendMessage(Message).
SetConversation(Conversation)
Sets the active conversation instance for this agent.
public void SetConversation(Conversation conversation)
Parameters
conversationConversationConversation to make active.
Remarks
This is a fire-and-forget convenience wrapper around SetConversationAsync(Conversation, CancellationToken).
SetConversationAsync(Conversation, CancellationToken)
Asynchronously sets the active conversation instance for this agent.
public UniTask SetConversationAsync(Conversation conversation, CancellationToken ct = default)
Parameters
conversationConversationConversation to make active.
ctCancellationTokenOptional cancellation token.
Returns
- UniTask
StartRecording()
[Obsolete("Use StartTranscription instead.")]
public void StartRecording()
StartTranscription()
Starts recording audio input for transcription, if supported.
public void StartTranscription()
Remarks
This call proxies Agent.StartTranscription and uses the configured InputAudioRecorder when available.
StopRecording()
[Obsolete("Use StopTranscription instead.")]
public void StopRecording()
StopTranscription()
Stops recording audio input and submits the captured audio for transcription.
public void StopTranscription()
Remarks
This call proxies Agent.StopTranscription and will only have an effect if audio recording was previously started.
UnregisterMcpApprovalHandler(string)
Unregisters the MCP approval handler associated with the given server label.
public bool UnregisterMcpApprovalHandler(string serverLabel)
Parameters
serverLabelstringServer label whose approval handler should be removed.
Returns
- bool
trueif a handler was removed; otherwise,false.
UnregisterOAuthTokenProvider(string)
Unregisters the OAuth token provider associated with the specified server label.
public bool UnregisterOAuthTokenProvider(string serverLabel)
Parameters
serverLabelstringServer label whose provider should be removed.
Returns
- bool
trueif a provider was removed; otherwise,false.
UnregisterToolCallExecutor<TCall, TOutput>(IToolCallExecutor<TCall, TOutput>)
Unregisters a previously registered tool call executor.
public bool UnregisterToolCallExecutor<TCall, TOutput>(IToolCallExecutor<TCall, TOutput> executor) where TCall : ToolCall where TOutput : ToolOutput
Parameters
executorIToolCallExecutor<TCall, TOutput>Executor instance to remove.
Returns
- bool
trueif the executor was successfully removed; otherwise,false.
Type Parameters
TCallType of the tool call.
TOutputType of the tool output.