@elizaos/core v1.0.15 / 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/database.ts:35
Methods​
init()​
init():
Promise
<void
>
Initialize database connection
Returns​
Promise
<void
>
Inherited from​
Defined in​
packages/core/src/types/database.ts:41
runMigrations()​
runMigrations(
schema
?,pluginName
?):Promise
<void
>
Run database migrations
Parameters​
• schema?: any
• pluginName?: string
Returns​
Promise
<void
>
Inherited from​
IDatabaseAdapter
.runMigrations
Defined in​
packages/core/src/types/database.ts:44
isReady()​
isReady():
Promise
<boolean
>
Check if the database connection is ready
Returns​
Promise
<boolean
>
Inherited from​
Defined in​
packages/core/src/types/database.ts:47
close()​
close():
Promise
<void
>
Close database connection
Returns​
Promise
<void
>
Inherited from​
Defined in​
packages/core/src/types/database.ts:50
getAgents()​
getAgents():
Promise
<Partial
<Agent
>[]>
Get all agents
Returns​
Promise
<Partial
<Agent
>[]>
Inherited from​
Defined in​
packages/core/src/types/database.ts:57
getEntityByIds()​
getEntityByIds(
entityIds
):Promise
<Entity
[]>
Get entity by IDs
Parameters​
• entityIds: `${string}-${string}-${string}-${string}-${string}`[]
Returns​
Promise
<Entity
[]>
Inherited from​
IDatabaseAdapter
.getEntityByIds
Defined in​
packages/core/src/types/database.ts:68
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/database.ts:71
createEntities()​
createEntities(
entities
):Promise
<boolean
>
Create new entities
Parameters​
• entities: Entity
[]
Returns​
Promise
<boolean
>
Inherited from​
IDatabaseAdapter
.createEntities
Defined in​
packages/core/src/types/database.ts:74
updateEntity()​
updateEntity(
entity
):Promise
<void
>
Update entity
Parameters​
• entity: Entity
Returns​
Promise
<void
>
Inherited from​
Defined in​
packages/core/src/types/database.ts:77
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/database.ts:80
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/database.ts:88
createComponent()​
createComponent(
component
):Promise
<boolean
>
Create component
Parameters​
• component: Component
Returns​
Promise
<boolean
>
Inherited from​
IDatabaseAdapter
.createComponent
Defined in​
packages/core/src/types/database.ts:91
updateComponent()​
updateComponent(
component
):Promise
<void
>
Update component
Parameters​
• component: Component
Returns​
Promise
<void
>
Inherited from​
IDatabaseAdapter
.updateComponent
Defined in​
packages/core/src/types/database.ts:94
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/database.ts:97
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/database.ts:100
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?: Metadata
Returns​
Promise
<boolean
>
Promise resolving to boolean indicating success
Inherited from​
IDatabaseAdapter
.createRelationship
Defined in​
packages/core/src/types/database.ts:219
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/database.ts:231
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/database.ts:238
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/database.ts:248
initialize()​
initialize():
Promise
<void
>
Initialize database connection
Returns​
Promise
<void
>