> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartcopilotadapter.md).

# SmartCopilotAdapter

Namespace: **Wisej.AI.Adapters**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartAdapter](/ai/components/api/smartadapter.md)
  * [SmartCopilotAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartcopilotadapter.md)

Turns the [ChatBox](#chatbox) control into a AI-powered assistant. It can control and navigate an application, click menu items, navigation bar items, buttons, etc. It can also invoke methods in your applications as needed (see [SmartTool](/ai/components/api/smarttool.md)).

{% tabs %}
{% tab title="C#" %}

```csharp
public class SmartCopilotAdapter : SmartAdapter
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class SmartCopilotAdapter
    Inherits SmartAdapter
```

{% endtab %}
{% endtabs %}

Works with:

* AzureAI/OpenAI gpt-4
* AzureAI/OpenAI gpt-4o
* AzureAI/OpenAI gpt-3.5
* AzureAI/Anthropic Claude
* Google Gemini
* Llama3:8b and 70b

When the user instructions contain extra information (i.e. "add Microsoft as a new client"), the additional parameters are extracted, processed and are available in the [Parameters](https://docs.wisej.com/api?q=wisej.ai.adapters.smartcopilotadapter.executeactioneventargs.parameters) property delivered with the [ExecuteAction](#executeaction) event arguments.\
You are not limited to the predefined actions in the application. When you add a method decorated with the [ToolAttribute](/ai/components/api/smarttool/wisej.ai.smarttool.toolattribute.md) the AI can invoke it when necessary.\
This is a simple example that sends an email when prompted by the user:

```csharp

      [SmartTool.Tool]
      [Description("Sends an email message.")]
      public void SendEmailMessage(
        [Description("Email address of the recipient.")]
        string destinationEmail,
        
        [Description("Subject line.")]
        string subject,

        [Description("Message text.")]
        string message) {
        
        // code to send an email, or open a dialog box.
      }

```

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) SmartCopilotAdapter()

Initializes a new instance of the [SmartCopilotAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartcopilotadapter.md) class.

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) BotAvatar

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the icon of the AI bot. (Default: `"resource.wx/Wisej.AI/Icons/wisej-avatar.svg"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) BotName

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the name of the AI bot. (Default: `"Wisej.AI"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) ChatBox

[ChatBox](https://docs.wisej.com/api?q=wisej.web.ext.chatcontrol.chatbox): Gets the [ChatBox](#chatbox) control associated with this adapter.

### ![](/files/ptrKjmmRoQB76pvrIqh0) User

[User](https://docs.wisej.com/api?q=wisej.web.ext.chatcontrol.user): Gets the User associated with the AI bot.

The User is created using [BotName](#botname) and [BotAvatar](#botavatar).

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) OnControlCreated(control)

| Parameter   | Type                                                      | Description |
| ----------- | --------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) |             |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnControlDisposed(control)

| Parameter   | Type                                                      | Description |
| ----------- | --------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) |             |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnExecuteAction(e)

Raises the [ExecuteAction](#executeaction) event.

| Parameter | Type                                                                                                                | Description                                                                                                                                                 |
| --------- | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [ExecuteActionEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartcopilotadapter+executeactioneventargs) | The [ExecuteActionEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartcopilotadapter.executeactioneventargs) instance containing the event data. |

### ![](/files/KL0Ik37djZRr8a07Wopd) RunAsyncCore(control)

Executes the core logic asynchronously.

| Parameter   | Type                                                      | Description                                |
| ----------- | --------------------------------------------------------- | ------------------------------------------ |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control associated with the operation. |

**Returns:** [Task\<Message>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task representing the asynchronous operation.

## Events

### ![](/files/ptrKjmmRoQB76pvrIqh0) ExecuteAction

[ExecuteActionEventHandler](https://docs.wisej.com/api?q=wisej.ai.adapters.smartcopilotadapter+executeactioneventhandler) Occurs when an action is executed.

## Implements

| Name                                                                              | Description                                |
| --------------------------------------------------------------------------------- | ------------------------------------------ |
| [IToolProvider](/ai/components/api/smarttool/wisej.ai.smarttool.itoolprovider.md) | Represents a provider that supplies tools. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartcopilotadapter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
