Nutrient Web SDK
    Preparing search index...

    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.

    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' }
    }
    }
    interface AgentConfiguration {
        seedMessages?: { content: string; type: "ai" | "human" }[];
        skills?: { content: string; description?: string; name: string }[];
        systemPromptTemplate?: string;
        toolApproval?: {
            defaults: {
                default: "allow" | "ask" | "deny";
                read?: "allow" | "ask" | "deny";
                write?: "allow" | "ask" | "deny";
            };
            rules?: { approval: "allow"
            | "ask"
            | "deny"; pattern: string }[];
        };
        userId?: string;
    }
    Index

    Properties

    seedMessages?: { 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

    Type Declaration

    • content: string

      The text content of the message.

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

    • type: "ai" | "human"

      The sender type for this message.

      • 'human': User/human messages (used in few-shot examples)
      • 'ai': Assistant responses (used in few-shot examples)
    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?: { 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.

    Type Declaration

    • content: string

      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.

      content: `Legal Contract Analysis Process:

      1. PARTIES: Identify all parties, signatories, and roles
      2. DATES: Extract effective date, expiration, renewal dates
      3. PAYMENT: Summarize amounts, payment terms, billing cycles
      4. LIABILITY: Identify indemnification and liability caps
      5. TERMINATION: Note termination conditions and notice periods`
    • Optionaldescription?: string

      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.

      description: 'Use when analyzing legal contracts, identifying liability clauses, or explaining terms'
      
    • name: string

      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.

      name: 'legal-clause-analysis'
      
    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`
    }
    ]
    systemPromptTemplate?: 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.

    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`
    A general-purpose document assistant prompt
    
    toolApproval?: {
        defaults: {
            default: "allow" | "ask" | "deny";
            read?: "allow" | "ask" | "deny";
            write?: "allow" | "ask" | "deny";
        };
        rules?: { approval: "allow"
        | "ask"
        | "deny"; pattern: string }[];
    }

    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

    Type Declaration

    • defaults: {
          default: "allow" | "ask" | "deny";
          read?: "allow" | "ask" | "deny";
          write?: "allow" | "ask" | "deny";
      }

      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
      • default: "allow" | "ask" | "deny"

        Fallback approval mode for all tools not matching a rule or category.

        Used when:

        • No pattern rule matches
        • Tool has no readOnlyHint annotation
        • No category-specific default is configured

        Values:

        • "allow": Executes immediately without user intervention
        • "ask": Pauses execution and requests user confirmation
        • "deny": Rejects the tool call
      • Optionalread?: "allow" | "ask" | "deny"

        Approval mode for read-only tools.

        Applies to tools marked with readOnlyHint: true. Typically used for safe operations like searching, analyzing, or retrieving data.

        Values:

        • "allow": Executes immediately without user intervention
        • "ask": Pauses execution and requests user confirmation
        • "deny": Rejects the tool call
      • Optionalwrite?: "allow" | "ask" | "deny"

        Approval mode for write/modification tools.

        Applies to tools marked with readOnlyHint: false that modify documents or state. Recommended to set to 'ask' for user control over document changes.

        Values:

        • "allow": Executes immediately without user intervention
        • "ask": Pauses execution and requests user confirmation
        • "deny": Rejects the tool call
    • Optionalrules?: { approval: "allow" | "ask" | "deny"; pattern: string }[]

      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.

    // 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?: 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.

    userId: 'user12345'