Loading AgentsKit ecosystem navigation…
AgentsKit Chat
Actions

Action policy

Capability policy outside the model — deny unknown actions before confirmation.

View canonical Markdown

Action policy

Compose trusted capability policy into the same ChatConfig used by every renderer. Policy runs outside the model — prompts cannot grant capabilities.

Flow

Loading diagram...

Compose policy

code
import { createCapabilityPolicy, withActionPolicy } from '@agentskit/chat'

const policy = createCapabilityPolicy({
  sessionId,
  getContext: () => authenticatedSession, // trusted host seam only
  requirements: {
    'email.send': ['email:send'],
    'docs.open': [],
  },
  onTrace: trace => auditBuffer.push(trace),
})

const chat = withActionPolicy(baseChat, policy)

Rules

RuleDetail
Trusted contextgetContext is a host seam — never from prompts, messages, or component props
Deny by defaultUnknown actions and missing context fail before confirmation
Double-checkCapabilities re-checked immediately before execution (revocation works after UI shown)
TracesImmutable and replayable — not a durable audit ledger; persist in the host if required

Wire with confirmation

code
<AgentChat
  definition={definition}
  onComponentSelect={(event) => {
    // choice may carry action → policy + confirmation path
  }}
/>

See Typed confirmation and Components.