<!--
 ⚠️  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) / IAgentLifecycleEvents

# Interface: IAgentLifecycleEvents

Agent lifecycle events

## Table of contents

### Properties

- [beforeCreate](IAgentLifecycleEvents#beforecreate)
- [afterCreate](IAgentLifecycleEvents#aftercreate)
- [onCreateError](IAgentLifecycleEvents#oncreateerror)
- [onDestroy](IAgentLifecycleEvents#ondestroy)

## Properties

### beforeCreate

• `Optional` **beforeCreate**: (`config`: [`IAgentConfig`](IAgentConfig)) => `void` \| `Promise`\<`void`\>

Called before agent creation

#### Type declaration

▸ (`config`): `void` \| `Promise`\<`void`\>

##### Parameters

| Name     | Type                           |
| :------- | :----------------------------- |
| `config` | [`IAgentConfig`](IAgentConfig) |

##### Returns

`void` \| `Promise`\<`void`\>

#### Defined in

[packages/agents/src/managers/agent-factory.ts:45](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/managers/agent-factory.ts#L45)

---

### afterCreate

• `Optional` **afterCreate**: (`agent`: `IAgent`\<[`IAgentConfig`](IAgentConfig), [`IRunOptions`](IRunOptions), [`TUniversalMessage`](../modules#tuniversalmessage)\>, `config`: [`IAgentConfig`](IAgentConfig)) => `void` \| `Promise`\<`void`\>

Called after successful agent creation

#### Type declaration

▸ (`agent`, `config`): `void` \| `Promise`\<`void`\>

##### Parameters

| Name     | Type                                                                                                                          |
| :------- | :---------------------------------------------------------------------------------------------------------------------------- |
| `agent`  | `IAgent`\<[`IAgentConfig`](IAgentConfig), [`IRunOptions`](IRunOptions), [`TUniversalMessage`](../modules#tuniversalmessage)\> |
| `config` | [`IAgentConfig`](IAgentConfig)                                                                                                |

##### Returns

`void` \| `Promise`\<`void`\>

#### Defined in

[packages/agents/src/managers/agent-factory.ts:47](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/managers/agent-factory.ts#L47)

---

### onCreateError

• `Optional` **onCreateError**: (`error`: `Error`, `config`: [`IAgentConfig`](IAgentConfig)) => `void` \| `Promise`\<`void`\>

Called when agent creation fails

#### Type declaration

▸ (`error`, `config`): `void` \| `Promise`\<`void`\>

##### Parameters

| Name     | Type                           |
| :------- | :----------------------------- |
| `error`  | `Error`                        |
| `config` | [`IAgentConfig`](IAgentConfig) |

##### Returns

`void` \| `Promise`\<`void`\>

#### Defined in

[packages/agents/src/managers/agent-factory.ts:49](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/managers/agent-factory.ts#L49)

---

### onDestroy

• `Optional` **onDestroy**: (`agentId`: `string`) => `void` \| `Promise`\<`void`\>

Called when agent is destroyed

#### Type declaration

▸ (`agentId`): `void` \| `Promise`\<`void`\>

##### Parameters

| Name      | Type     |
| :-------- | :------- |
| `agentId` | `string` |

##### Returns

`void` \| `Promise`\<`void`\>

#### Defined in

[packages/agents/src/managers/agent-factory.ts:51](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/managers/agent-factory.ts#L51)
