AIAgent Methods |
The AIAgent type exposes the following members.
| Name | Description | |
|---|---|---|
| Chat | 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. | |
| ChatHtml | Same as Chat(String, ICancelOperation, ReportExecutionLog, ReportExecutionLog, Int32, ActionString) but returns the reply sanitized as safe HTML. | |
| ChatSimple | 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. | |
| Clear | Resets the conversation history, re-seeding it with the system prompt when one is configured. | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) | |
| GenerateTitle | 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. | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| LoadFromFile | 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. | |
| LoadFromSessionFile | Restores the conversation history from a ChatSessionFile. The current Messages list is cleared first. | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
| OverrideSystemPrompt | 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. | |
| RewindToUserMessage | 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. | |
| SaveToFile | Saves the current conversation to a JSON file. | |
| ToSessionFile | Serialises the current conversation to a ChatSessionFile object. | |
| ToString | Returns a string that represents the current object. (Inherited from Object) |