AgentFn<State> typedef

AgentFn<State> = Future<AgentResult> Function(SessionRunner<State> sess, AgentFnOptions options)

Function handler definition for custom agent actions.

The State type parameter surfaces the agent's typed custom state on the SessionRunner passed to the handler, so sess.getCustom() / sess.updateCustom(...) are typed. It defaults to dynamic (raw JSON) when the agent has no stateSchema.

Implementation

typedef AgentFn<State> =
    Future<AgentResult> Function(
      SessionRunner<State> sess,
      AgentFnOptions options,
    );