Action
@daydreamsai/core / Action
Interface: Action<Schema, Result, TError, TContext, TAgent, TState>
Defined in: packages/core/src/types.ts:141
Represents an action that can be executed with typed parameters
Template
Context type for the action execution
Type Parameters
Schema
Schema extends ActionSchema = ActionSchema
Zod schema defining parameter types
Result
Result = any
Return type of the action
TError
TError = unknown
TContext
TContext extends AnyContext = AnyContext
TAgent
TAgent extends AnyAgent = AnyAgent
TState
TState extends ActionState = ActionState
Properties
actionState?
optionalactionState:TState
Defined in: packages/core/src/types.ts:157
attributes?
optionalattributes:ActionSchema
Defined in: packages/core/src/types.ts:155
callFormat?
optionalcallFormat:"json"|"xml"
Defined in: packages/core/src/types.ts:202
context?
optionalcontext:TContext
Defined in: packages/core/src/types.ts:171
description?
optionaldescription:string
Defined in: packages/core/src/types.ts:150
enabled()?
optionalenabled: (ctx) =>boolean
Defined in: packages/core/src/types.ts:161
Parameters
ctx
ActionContext<TContext, InferAgentContext<TAgent>, TState>
Returns
boolean
examples?
optionalexamples:string[]
Defined in: packages/core/src/types.ts:198
format()?
optionalformat: (result) =>string|string[]
Defined in: packages/core/src/types.ts:169
Parameters
result
ActionResult<Result>
Returns
string | string[]
handler
handler:
ActionHandler<Schema,Result,TContext,TAgent,TState>
Defined in: packages/core/src/types.ts:165
install()?
optionalinstall: (agent) =>void|Promise<void>
Defined in: packages/core/src/types.ts:159
Parameters
agent
TAgent
Returns
void | Promise<void>
instructions?
optionalinstructions:string
Defined in: packages/core/src/types.ts:151
name
name:
string
Defined in: packages/core/src/types.ts:149
onError()?
optionalonError: (err,ctx,agent) =>any
Defined in: packages/core/src/types.ts:181
Parameters
err
TError
ctx
ActionCallContext<Schema, TContext, InferAgentContext<TAgent>, TState>
agent
TAgent
Returns
any
onSuccess()?
optionalonSuccess: (result,ctx,agent) =>void|Promise<void>
Defined in: packages/core/src/types.ts:173
Parameters
result
ActionResult<Result>
ctx
ActionCallContext<Schema, TContext, InferAgentContext<TAgent>, TState>
agent
TAgent
Returns
void | Promise<void>
parser()?
optionalparser: (ref) =>InferActionArguments<Schema>
Defined in: packages/core/src/types.ts:200
Parameters
ref
Returns
InferActionArguments<Schema>
queueKey?
optionalqueueKey:string| (ctx) =>string
Defined in: packages/core/src/types.ts:187
retry?
optionalretry:number|boolean| (failureCount,error) =>boolean
Defined in: packages/core/src/types.ts:179
returns?
optionalreturns:ActionSchema
Defined in: packages/core/src/types.ts:167
schema
schema:
Schema
Defined in: packages/core/src/types.ts:153
templateResolver?
optionaltemplateResolver:boolean| (key,path,ctx) =>MaybePromise<string>
Defined in: packages/core/src/types.ts:204