Click or drag to resize

AIAgent Methods

The AIAgent type exposes the following members.

Methods
 NameDescription
Public methodChat Appends a user message to the conversation history, calls the AI using the tools scoped to this agent (via GetToolConfigurations) plus a built-in load_skill tool when the agent has skills (via GetSkillConfigurations), executes any tool calls the AI requests, and repeats until a plain reply is produced or maxIterations is reached. Falls back to a plain HandleChat(ListChatMessage) call when no tools and no skills are configured.
Public methodChatHtml Same as Chat(String, ICancelOperation, ReportExecutionLog, ReportExecutionLog, Int32, ActionString) but returns the reply sanitized as safe HTML.
Public methodChatSimple Sends a plain user message to the AI without any tools and returns the reply. Useful when you want a simple single-turn exchange that bypasses the agentic tool loop.
Public methodClear Resets the conversation history, re-seeding it with the system prompt when one is configured.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGenerateTitle Asks the AI to summarise the current conversation as a short, friendly title (a few words). Uses the same provider/model as the conversation, without tools, and works on a copy of Messages so the persisted history is never modified. Returns null when no conversation exists yet or on any failure, so callers can fall back to their default naming.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberLoadFromFile Loads a conversation from a JSON file and returns both the agent and the embedded session metadata. The agent is built from the configuration whose Name matches the Name info key; falls back to the default configuration when not found.
Public methodLoadFromSessionFile Restores the conversation history from a ChatSessionFile. The current Messages list is cleared first.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodOverrideSystemPrompt Replaces the leading system message in Messages with prompt. If prompt is null or whitespace the existing system message (if any) is simply removed. Call this before Chat(String, ICancelOperation, ReportExecutionLog, ReportExecutionLog, Int32, ActionString) to inject a parameter-driven system prompt that overrides the one from EffectiveSystemPrompt.
Public methodRewindToUserMessage Rewinds the conversation to just before the user turn at userMessageIndex (0-based, counting only user messages). Removes that user message and every message that followed it — including the assistant replies, tool calls and tool results — so the conversation returns to the state it had before that message was sent. Returns the text of the removed user message (so the caller can re-populate the input box), or null when the index is out of range.
Public methodSaveToFile Saves the current conversation to a JSON file.
Public methodToSessionFile Serialises the current conversation to a ChatSessionFile object.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
See Also