@maiar-ai/core / Runtime
Class: Runtime
Defined in: packages/core/src/runtime/index.ts:31
Runtime class that manages the execution of plugins and agent state
Accessors​
logger​
Get Signature​
get logger():
Logger
Defined in: packages/core/src/runtime/index.ts:50
Returns the logger instance for the runtime scoped to the runtime
Returns​
Logger
memory​
Get Signature​
get memory():
MemoryManager
Defined in: packages/core/src/runtime/index.ts:316
Access to the memory manager for plugins
Returns​
server​
Get Signature​
get server():
Server
Defined in: packages/core/src/runtime/index.ts:323
Access to the server manager for plugins
Returns​
Server
templates​
Get Signature​
get templates():
PromptRegistry
Defined in: packages/core/src/runtime/index.ts:330
Access to the prompt registry for plugins
Returns​
Methods​
init()​
static
init(__namedParameters
):Promise
<Runtime
>
Defined in: packages/core/src/runtime/index.ts:87
Parameters​
__namedParameters​
modelProviders​
memoryProvider​
plugins​
Plugin
[]
capabilityAliases​
CapabilityAliasGroup
[] = []
options​
{ logger
: LoggerOptions
; server
: { port
: number
; cors
: CorsOptions
; }; }
options.logger​
LoggerOptions
options.server​
{ port
: number
; cors
: CorsOptions
; }
options.server.port​
number
options.server.cors​
CorsOptions
Returns​
Promise
<Runtime
>
start()​
start():
Promise
<void
>
Defined in: packages/core/src/runtime/index.ts:337
Start the runtime
Returns​
Promise
<void
>
stop()​
stop():
Promise
<void
>
Defined in: packages/core/src/runtime/index.ts:390
Stop the runtime
Returns​
Promise
<void
>
createEvent()​
createEvent(
trigger
,space
):Promise
<void
>
Defined in: packages/core/src/runtime/index.ts:501
Create an event that will be processed by the pipeline processor
Parameters​
trigger​
space​
Returns​
Promise
<void
>
executeCapability()​
executeCapability<
K
>(capabilityId
,input
,config
?):Promise
<ICapabilities
[K
]["output"
]>
Defined in: packages/core/src/runtime/index.ts:524
Execute a capability through the model-manager.
Type Parameters​
• K extends "text-generation"
– Capability identifier literal (key of the ICapabilities
interface).
Parameters​
capabilityId​
K
– The capability ID or alias.
input​
ICapabilities
[K
]["input"
]
– Data validated against the capability's input
Zod schema.
config?​
ICapabilities
[K
] extends object
? C
: unknown
– Optional configuration object.
The type of config
is computed with the conditional type
ICapabilities[K] extends { config: infer C } ? C : unknown
:
• If a given capability defines a config
schema, the parameter is
strongly typed as that schema (C
).
• Otherwise the parameter collapses to unknown
, making it truly
optional and preventing "config" from being accessed on capabilities
that don't declare one.
Returns​
Promise
<ICapabilities
[K
]["output"
]>
getObject()​
getObject<
T
>(schema
,prompt
,config
?):Promise
<TypeOf
<T
>>
Defined in: packages/core/src/runtime/index.ts:539
Prompt the LLM to generate a JSON object from a prompt
Type Parameters​
• T extends ZodType
Parameters​
schema​
T
The schema of the object to generate in zod format
prompt​
string
The prompt to generate the object from
config?​
The configuration for the model request
Returns​
Promise
<TypeOf
<T
>>
The generated object