@elizaos/core v1.0.0-beta.51 / IAgentRuntime
Interface: IAgentRuntime
Represents the core runtime environment for an agent. Defines methods for database interaction, plugin management, event handling, state composition, model usage, and task management.
Extends​
Properties​
db​
db:
any
Database instance
Inherited from​
Defined in​
packages/core/src/types.ts:776
Methods​
init()​
init():
Promise
<void
>
Initialize database connection
Returns​
Promise
<void
>
Inherited from​
Defined in​
packages/core/src/types.ts:779
close()​
close():
Promise
<void
>
Close database connection
Returns​
Promise
<void
>
Inherited from​
Defined in​
packages/core/src/types.ts:782
getAgents()​
getAgents():
Promise
<Partial
<Agent
>[]>
Get all agents
Returns​
Promise
<Partial
<Agent
>[]>
Inherited from​
Defined in​
packages/core/src/types.ts:789
getEntityById()​
getEntityById(
entityId
):Promise
<Entity
>
Get entity by ID
Parameters​
• entityId: `${string}-${string}-${string}-${string}-${string}`
Returns​
Promise
<Entity
>
Inherited from​
IDatabaseAdapter
.getEntityById
Defined in​
packages/core/src/types.ts:802
getEntitiesForRoom()​
getEntitiesForRoom(
roomId
,includeComponents
?):Promise
<Entity
[]>
Get entities for room
Parameters​
• roomId: `${string}-${string}-${string}-${string}-${string}`
• includeComponents?: boolean
Returns​
Promise
<Entity
[]>
Inherited from​
IDatabaseAdapter
.getEntitiesForRoom
Defined in​
packages/core/src/types.ts:805
createEntity()​
createEntity(
entity
):Promise
<boolean
>
Create new entity
Parameters​
• entity: Entity
Returns​
Promise
<boolean
>
Inherited from​
Defined in​
packages/core/src/types.ts:808
updateEntity()​
updateEntity(
entity
):Promise
<void
>
Update entity
Parameters​
• entity: Entity
Returns​
Promise
<void
>
Inherited from​
Defined in​
packages/core/src/types.ts:811
getComponent()​
getComponent(
entityId
,type
,worldId
?,sourceEntityId
?):Promise
<Component
>
Get component by ID
Parameters​
• entityId: `${string}-${string}-${string}-${string}-${string}`
• type: string
• worldId?: `${string}-${string}-${string}-${string}-${string}`
• sourceEntityId?: `${string}-${string}-${string}-${string}-${string}`
Returns​
Promise
<Component
>
Inherited from​
Defined in​
packages/core/src/types.ts:814
getComponents()​
getComponents(
entityId
,worldId
?,sourceEntityId
?):Promise
<Component
[]>
Get all components for an entity
Parameters​
• entityId: `${string}-${string}-${string}-${string}-${string}`
• worldId?: `${string}-${string}-${string}-${string}-${string}`
• sourceEntityId?: `${string}-${string}-${string}-${string}-${string}`
Returns​
Promise
<Component
[]>
Inherited from​
IDatabaseAdapter
.getComponents
Defined in​
packages/core/src/types.ts:822
createComponent()​
createComponent(
component
):Promise
<boolean
>
Create component
Parameters​
• component: Component
Returns​
Promise
<boolean
>
Inherited from​
IDatabaseAdapter
.createComponent
Defined in​
packages/core/src/types.ts:825
updateComponent()​
updateComponent(
component
):Promise
<void
>
Update component
Parameters​
• component: Component
Returns​
Promise
<void
>
Inherited from​
IDatabaseAdapter
.updateComponent
Defined in​
packages/core/src/types.ts:828
deleteComponent()​
deleteComponent(
componentId
):Promise
<void
>
Delete component
Parameters​
• componentId: `${string}-${string}-${string}-${string}-${string}`
Returns​
Promise
<void
>
Inherited from​
IDatabaseAdapter
.deleteComponent
Defined in​
packages/core/src/types.ts:831
getMemories()​
getMemories(
params
):Promise
<Memory
[]>
Get memories matching criteria
Parameters​
• params
• params.entityId?: `${string}-${string}-${string}-${string}-${string}`
• params.agentId?: `${string}-${string}-${string}-${string}-${string}`
• params.count?: number
• params.unique?: boolean
• params.tableName: string
• params.start?: number
• params.end?: number
• params.roomId?: `${string}-${string}-${string}-${string}-${string}`
• params.worldId?: `${string}-${string}-${string}-${string}-${string}`
Returns​
Promise
<Memory
[]>
Inherited from​
Defined in​
packages/core/src/types.ts:834
createRelationship()​
createRelationship(
params
):Promise
<boolean
>
Creates a new relationship between two entities.
Parameters​
• params
Object containing the relationship details
• params.sourceEntityId: `${string}-${string}-${string}-${string}-${string}`
• params.targetEntityId: `${string}-${string}-${string}-${string}-${string}`
• params.tags?: string
[]
• params.metadata?
Returns​
Promise
<boolean
>
Promise resolving to boolean indicating success
Inherited from​
IDatabaseAdapter
.createRelationship
Defined in​
packages/core/src/types.ts:951
updateRelationship()​
updateRelationship(
relationship
):Promise
<void
>
Updates an existing relationship between two entities.
Parameters​
• relationship: Relationship
The relationship object with updated data
Returns​
Promise
<void
>
Promise resolving to void
Inherited from​
IDatabaseAdapter
.updateRelationship
Defined in​
packages/core/src/types.ts:963
getRelationship()​
getRelationship(
params
):Promise
<Relationship
>
Retrieves a relationship between two entities if it exists.
Parameters​
• params
Object containing the entity IDs and agent ID
• params.sourceEntityId: `${string}-${string}-${string}-${string}-${string}`
• params.targetEntityId: `${string}-${string}-${string}-${string}-${string}`
Returns​
Promise
<Relationship
>
Promise resolving to the Relationship object or null if not found
Inherited from​
IDatabaseAdapter
.getRelationship
Defined in​
packages/core/src/types.ts:970
getRelationships()​
getRelationships(
params
):Promise
<Relationship
[]>
Retrieves all relationships for a specific entity.
Parameters​
• params
Object containing the user ID, agent ID and optional tags to filter by
• params.entityId: `${string}-${string}-${string}-${string}-${string}`
• params.tags?: string
[]
Returns​
Promise
<Relationship
[]>
Promise resolving to an array of Relationship objects
Inherited from​
IDatabaseAdapter
.getRelationships
Defined in​
packages/core/src/types.ts:980
useModel()​
useModel<
T
,R
>(modelType
,params
):Promise
<R
>
Use a model with strongly typed parameters and return values based on model type
Type Parameters​
• T extends string
The model type to use
• R = ModelResultMap
[T
]
The expected return type, defaults to the type defined in ModelResultMap[T]
Parameters​
• modelType: T
The type of model to use
• params: any
The parameters for the model, typed based on model type
Returns​
Promise
<R
>
- The model result, typed based on the provided generic type parameter
Defined in​
packages/core/src/types.ts:1201
registerSendHandler()​
registerSendHandler(
source
,handler
):void
Registers a handler function responsible for sending messages to a specific source/platform.
Parameters​
• source: string
The unique identifier string for the source (e.g., 'discord', 'telegram').
• handler: SendHandlerFunction
The SendHandlerFunction to be called for this source.
Returns​
void
Defined in​
packages/core/src/types.ts:1236
sendMessageToTarget()​
sendMessageToTarget(
target
,content
):Promise
<void
>
Sends a message to a specified target using the appropriate registered handler.
Parameters​
• target: TargetInfo
Information describing the target recipient and platform.
• content: Content
The message content to send.
Returns​
Promise
<void
>
Promise resolving when the message sending process is initiated or completed.