Agent / foldkit-agent-native

AgentNative

namespace · packages/agent-native/src/agentNative.ts:1

export * as AgentNative from './agentNative.js'

Members

AgentNative.ActionEntry

interface · packages/agent-native/src/actions.ts:32

interface ActionEntry {
  readonly tool: {
    readonly description: string
    readonly parameters: NonNullable<ActionTool['parameters']>
  }
  readonly run: (
    args: unknown,
    context?: ActionRunContext,
  ) => Promise<ActionResult>
  readonly schema: StandardSchemaV1<unknown, unknown> &
    StandardJSONSchemaV1<unknown, unknown>
  readonly http: {
    readonly method: 'POST'
  }
  readonly requiresAuth: boolean
  readonly readOnly: false
}

One entry of the record registerPackageActions takes.

AgentNative.ActionRegistry

type · packages/agent-native/src/actions.ts:118

type ActionRegistry<ByName = Record<string, unknown>> =
  string extends keyof ByName
    ? Record<string, ActionEntry>
    : {
        readonly [Name in keyof ByName]: ActionEntry
      }

The registry, keyed by the contract's capability names when they are known, so a registered name needs no lookup check and a mistyped one does not compile.

AgentNative.ActionResult

interface · packages/agent-native/src/actions.ts:22

interface ActionResult {
  readonly ok: boolean
  readonly tag?: string | undefined
  readonly completion?: 'completed' | 'failed' | undefined
  readonly message: string
}

What an action reports back. run never decides anything itself.

AgentNative.ActionRunContext

interface · packages/agent-native/src/actions.ts:16

interface ActionRunContext {
  readonly userEmail?: string | undefined
  readonly orgId?: string | null | undefined
}

The request context Agent Native hands an action.

Deliberately narrower than the framework's own ActionRunContext: the adapter promises only the identity a principal mapper needs, so its public surface does not grow with the framework's context. The framework still passes its full context through at runtime.

AgentNative.actions

function · packages/agent-native/src/actions.ts:122

function actions<ByName = Record<string, unknown>>(
  options: ActionsOptions<ByName>,
): ActionRegistry<ByName>

AgentNative.ActionsOptions

interface · packages/agent-native/src/actions.ts:75

interface ActionsOptions<ByName = Record<string, unknown>> {
  readonly definition: Agent.Definition<any, any, any, ByName, any>
  readonly resolveRuntime: (
    context: ActionRunContext,
  ) => AgentRuntime | Promise<AgentRuntime>
  readonly transport?: string | undefined
}