Nutrient Web SDK

v0.0.0-dev

ReferenceAIAssistantAgentConfiguration

Interface AgentConfiguration

Advanced configuration for AI Agent behavior and capabilities.

Customize the agent's system instructions, define domain-specific skills, control tool execution policies.

This interface enables fine-grained control over how the AI Agent processes requests, what knowledge it has access to, and which operations require user approval.

Interface

Example

const config: AIAssistant.AgentConfiguration = {
systemPromptTemplate: 'You are an expert legal document assistant.',
skills: [
{
name: 'contract-review',
description: 'Analyze contracts for key terms and risks',
content: '1. Identify all parties\n2. Extract key dates\n3. Highlight liability clauses'
}
],
toolApproval: {
defaults: { default: 'allow', write: 'ask' }
}
}

Properties

mcps

Optional

Model Context Protocol (MCP) HTTP servers to connect the AI Agent to.

Each entry connects the agent to one HTTP/HTTPS MCP server. The server exposes tools and resources via the Model Context Protocol; the agent can invoke those tools as part of completing a user request.

Only the HTTP transport is supported. To use a stdio-only MCP server, expose it behind an HTTP gateway and configure that gateway here.

Authentication, and any other headers required for the MCP server, are provided via the headers field on each server entry. Two common patterns:

Example

// Bearer token (RFC 6750):
{
transport: 'http',
name: 'analytics',
url: 'https://mcp.example.com/',
headers: { 'Authorization': 'Bearer ' + accessToken },
}
// API key in a custom header (vendor convention):
{
transport: 'http',
name: 'crm',
url: 'https://api.example.com/mcp',
headers: { 'X-API-Key': 'sk-...' },
}

Default Value

[]

seedMessages

Optional
{ content: string; type: "ai" | "human" }[]

Seed messages for shaping agent behavior across all interactions.

Messages injected before the conversation history on every model invocation. Useful for few-shot prompting, additional constraints, and behavioral priming that should persist across all conversation turns.

Important: Seed messages are NOT persisted to the conversation history and are injected fresh on each request.

Common use cases:

  • Few-shot learning: Include human/ai example pairs
  • Additional instructions: Constraints that complement systemPromptTemplate
  • Behavioral priming: Consistent patterns to reinforce across all responses
PropertyDescription
content

The text content of the message.

Use clear, concise language. For few-shot examples, make responses representative of the desired behavior.

type

The sender type for this message.

  • 'human': User/human messages (used in few-shot examples)
  • 'ai': Assistant responses (used in few-shot examples)

Example

seedMessages: [
{
type: 'human',
content: 'Analyze the indemnification clause in this contract.'
},
{
type: 'ai',
content: 'I found the indemnification clause on page 3, section 5.2...'
}
]

skills

Optional
{ content: string; description?: string; name: string }[]

Domain-specific skills for the AI Agent.

Define specialized knowledge, instructions, or workflows that the agent can access and apply when relevant to user requests. Skills allow you to inject domain expertise without modifying the system prompt.

The agent decides when to use each skill based on the skill description and the user's request. Use descriptive names and clear instructions.

PropertyDescription
content

Detailed knowledge and instructions for this skill.

The actual content the agent uses when applying this skill. Include step-by-step instructions, examples, or knowledge the agent should follow. Maximum 50,000 characters.

description

Description of when and how to use this skill.

Helps the agent decide when to apply this knowledge based on user requests. Be specific about the skill's purpose and ideal use cases. Keep it under 500 characters.

name

Unique identifier for this skill.

Used internally by the agent to reference and invoke this skill. Should be lowercase with hyphens (e.g., 'contract-analysis', 'data-extraction'). Minimum 1 character, no spaces.

Example

skills: [
{
name: 'contract-review',
description: 'Analyze contracts for key terms and identify potential risks',
content: `When reviewing a contract:
1. Identify all parties and signatories
2. Extract critical dates (effective date, expiration, renewal)
3. Summarize payment terms and amounts
4. Highlight liability and indemnification clauses
5. Flag unusual or potentially risky terms`
}
]
string

Custom system prompt template for defining agent personality and behavior.

Defines the base instructions, role, and guidelines that shape how the agent processes requests and responds to users. This is the primary mechanism for customizing the agent's expertise and behavior patterns.

Keep prompts concise but descriptive. Focus on the agent's role, key principles, and important constraints.

Example

systemPromptTemplate: `You are an expert legal document analyst.
Your role is to:
- Identify and explain key contractual terms
- Highlight potential risks or unusual clauses
- Always cite the specific section numbers
- If uncertain, clearly state your limitations`

Default Value

A general-purpose document assistant prompt

toolApproval

Optional
{ … }

Tool execution approval policies for security and user control.

Controls which tools can execute automatically and which require user approval. Use this to implement security policies, prevent unintended modifications, or require confirmation for sensitive operations.

Resolution order (first match wins):

  1. Pattern-based rules (if defined)
  2. Tool category defaults (read/write based on tool metadata)
  3. Fallback default setting
PropertyDescription
defaults

Default approval settings for tools by category.

These defaults apply when no rule matches. The resolution order is:

  1. Check if a pattern rule matches (first match wins)
  2. Check tool's readOnlyHint - use 'read' or 'write' setting
  3. Fall back to 'default' setting
rules

Pattern-based rules for fine-grained tool control.

Rules are evaluated in order - the first matching pattern determines the approval mode. Place more specific patterns before general ones.

Patterns use standard glob syntax where * matches any characters.

Example

// Basic: Allow reads, ask for writes
toolApproval: {
defaults: {
default: 'allow',
read: 'allow',
write: 'ask'
}
}
// Advanced: Pattern-based rules with defaults
toolApproval: {
defaults: { default: 'allow' },
rules: [
{ pattern: '*_delete_*', approval: 'deny' },
{ pattern: 'mcp__*_modify_*', approval: 'ask' }
]
}

userId

Optional
string

User identifier for rate limiting and authorization.

Provide a unique identifier for the current user to enable per-user rate limiting and usage tracking.

Example

userId: 'user12345'