<!--
 ⚠️  AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
 This file is automatically generated by scripts/docs-generator.js
 To make changes, edit the source TypeScript files or update the generator script
-->

[agents](../../) / [Exports](../modules) / LocalExecutor

# Class: LocalExecutor

Local executor that directly delegates to AI provider instances

This executor maintains a registry of AI provider instances and delegates
chat execution requests to the appropriate provider based on the provider
name in the request. This is the "traditional" execution mode where
API calls are made directly from the client.

**`Example`**

```typescript
import { LocalExecutor } from '@robota-sdk/agent-core';
import { OpenAIProvider } from '@robota-sdk/agent-provider-openai';

const executor = new LocalExecutor();
executor.registerProvider('openai', new OpenAIProvider({ apiKey: 'sk-...' }));

const response = await executor.executeChat({
  messages: [{ role: 'user', content: 'Hello!' }],
  provider: 'openai',
  model: 'gpt-4',
});
```

## Hierarchy

- [`AbstractExecutor`](AbstractExecutor)

  ↳ **`LocalExecutor`**

## Table of contents

### Constructors

- [constructor](LocalExecutor#constructor)

### Properties

- [name](LocalExecutor#name)
- [version](LocalExecutor#version)

### Methods

- [registerProvider](LocalExecutor#registerprovider)
- [unregisterProvider](LocalExecutor#unregisterprovider)
- [getProvider](LocalExecutor#getprovider)
- [executeChat](LocalExecutor#executechat)
- [executeChatStream](LocalExecutor#executechatstream)
- [supportsTools](LocalExecutor#supportstools)
- [validateConfig](LocalExecutor#validateconfig)
- [dispose](LocalExecutor#dispose)

## Constructors

### constructor

• **new LocalExecutor**(`config?`): [`LocalExecutor`](LocalExecutor)

#### Parameters

| Name     | Type                                                         |
| :------- | :----------------------------------------------------------- |
| `config` | [`ILocalExecutorConfig`](../interfaces/ILocalExecutorConfig) |

#### Returns

[`LocalExecutor`](LocalExecutor)

#### Overrides

[AbstractExecutor](AbstractExecutor).[constructor](AbstractExecutor#constructor)

#### Defined in

[packages/agents/src/executors/local-executor.ts:40](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L40)

## Properties

### name

• `Readonly` **name**: `"local"`

Get executor name/identifier

#### Overrides

[AbstractExecutor](AbstractExecutor).[name](AbstractExecutor#name)

#### Defined in

[packages/agents/src/executors/local-executor.ts:34](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L34)

---

### version

• `Readonly` **version**: `"1.0.0"`

Get executor version

#### Overrides

[AbstractExecutor](AbstractExecutor).[version](AbstractExecutor#version)

#### Defined in

[packages/agents/src/executors/local-executor.ts:35](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L35)

## Methods

### registerProvider

▸ **registerProvider**(`name`, `provider`): `void`

Register an AI provider instance for use with this executor

#### Parameters

| Name       | Type                                                     | Description                                                 |
| :--------- | :------------------------------------------------------- | :---------------------------------------------------------- |
| `name`     | `string`                                                 | Provider name (e.g., 'openai', 'anthropic', 'google')       |
| `provider` | [`AIProviderInstance`](../interfaces/AIProviderInstance) | Provider instance that implements the required chat methods |

#### Returns

`void`

#### Defined in

[packages/agents/src/executors/local-executor.ts:57](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L57)

---

### unregisterProvider

▸ **unregisterProvider**(`name`): `void`

Unregister an AI provider

#### Parameters

| Name   | Type     | Description             |
| :----- | :------- | :---------------------- |
| `name` | `string` | Provider name to remove |

#### Returns

`void`

#### Defined in

[packages/agents/src/executors/local-executor.ts:66](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L66)

---

### getProvider

▸ **getProvider**(`name`): `undefined` \| [`AIProviderInstance`](../interfaces/AIProviderInstance)

Get registered provider instance

#### Parameters

| Name   | Type     | Description   |
| :----- | :------- | :------------ |
| `name` | `string` | Provider name |

#### Returns

`undefined` \| [`AIProviderInstance`](../interfaces/AIProviderInstance)

Provider instance or undefined if not registered

#### Defined in

[packages/agents/src/executors/local-executor.ts:76](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L76)

---

### executeChat

▸ **executeChat**(`request`): `Promise`\<[`IAssistantMessage`](../interfaces/IAssistantMessage)\>

Execute a chat completion request by delegating to the appropriate provider

#### Parameters

| Name      | Type                                                           |
| :-------- | :------------------------------------------------------------- |
| `request` | [`IChatExecutionRequest`](../interfaces/IChatExecutionRequest) |

#### Returns

`Promise`\<[`IAssistantMessage`](../interfaces/IAssistantMessage)\>

#### Overrides

[AbstractExecutor](AbstractExecutor).[executeChat](AbstractExecutor#executechat)

#### Defined in

[packages/agents/src/executors/local-executor.ts:83](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L83)

---

### executeChatStream

▸ **executeChatStream**(`request`): `AsyncIterable`\<[`TUniversalMessage`](../modules#tuniversalmessage), `any`, `any`\>

Execute a streaming chat completion request

#### Parameters

| Name      | Type                                                               |
| :-------- | :----------------------------------------------------------------- |
| `request` | [`IStreamExecutionRequest`](../interfaces/IStreamExecutionRequest) |

#### Returns

`AsyncIterable`\<[`TUniversalMessage`](../modules#tuniversalmessage), `any`, `any`\>

#### Overrides

[AbstractExecutor](AbstractExecutor).[executeChatStream](AbstractExecutor#executechatstream)

#### Defined in

[packages/agents/src/executors/local-executor.ts:133](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L133)

---

### supportsTools

▸ **supportsTools**(): `boolean`

Check if any registered providers support tools

#### Returns

`boolean`

#### Overrides

[AbstractExecutor](AbstractExecutor).[supportsTools](AbstractExecutor#supportstools)

#### Defined in

[packages/agents/src/executors/local-executor.ts:175](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L175)

---

### validateConfig

▸ **validateConfig**(): `boolean`

Validate executor configuration and all registered providers

#### Returns

`boolean`

#### Overrides

[AbstractExecutor](AbstractExecutor).[validateConfig](AbstractExecutor#validateconfig)

#### Defined in

[packages/agents/src/executors/local-executor.ts:187](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L187)

---

### dispose

▸ **dispose**(): `Promise`\<`void`\>

Clean up all registered providers

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractExecutor](AbstractExecutor).[dispose](AbstractExecutor#dispose)

#### Defined in

[packages/agents/src/executors/local-executor.ts:216](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/executors/local-executor.ts#L216)
