AI Assistant provides agents that determine the capabilities and behavior of your AI-powered document workflows. You can use one of the built-in agents out of the box, or customize your own agent for specific use cases.

Selecting an agent

Select an agent using the agentId field in your AI Assistant configuration:

PSPDFKit.load({
aiAssistant: {
sessionId: 'session123',
jwt: 'your-jwt-token',
backendUrl: 'http://localhost:4000',
agentId: 'agentic', // Choose: 'chat', 'agentic', or 'base'.
},
...
});

Built-in agents

AI Assistant includes three agents out of the box, each optimized for different use cases.

Agentic (default)

The agentic agent provides full autonomous capabilities with read and write access to documents. This is the default agent when no agentId is specified.

Capabilities:

  • Read and search document content
  • Summarize and answer questions about documents
  • Add, modify, and delete annotations
  • Fill form fields
  • Apply redactions
  • Execute multistep document workflows

Use cases:

  • Document editing and review workflows
  • Automated form filling
  • Compliance and redaction tasks
  • Interactive document preparation
PSPDFKit.load({
aiAssistant: {
sessionId: 'session123',
jwt: 'your-jwt-token',
backendUrl: 'http://localhost:4000',
agentId: 'agentic',
},
});

Chat

The chat agent provides a read-only Q&A mode optimized for document analysis without modification capabilities.

Capabilities:

  • Read and search document content
  • Summarize documents
  • Extract data and answer questions
  • Provide document insights and analysis

Limitations:

  • Cannot add or modify annotations
  • Cannot fill forms
  • Cannot apply redactions

Use cases:

  • Customer-facing document viewers where editing is restricted
  • Research and analysis workflows
  • Document comprehension assistants
  • Secure environments where document integrity is critical
PSPDFKit.load({
aiAssistant: {
sessionId: 'session123',
jwt: 'your-jwt-token',
backendUrl: 'http://localhost:4000',
agentId: 'chat',
},
});

Base

The base agent provides a minimal configuration intended for full customization. Use this agent when you want complete control over behavior through the agent configuration.

Capabilities:

  • All tools enabled by default, customizable through toolApproval settings
  • Full customization through agentConfiguration
  • Suitable for building specialized agents

Use cases:

  • Building an agent with only a subset of available tools
  • Creating a focused agent for a single task, such as document summarization
  • Overriding default behaviors that preset agents don’t allow
PSPDFKit.load({
aiAssistant: {
sessionId: 'session123',
jwt: 'your-jwt-token',
backendUrl: 'http://localhost:4000',
agentId: 'base',
agentConfiguration: {
systemPromptTemplate: 'You are a specialized legal document analyst...',
skills: [
{
name: 'contract-review',
description: 'Analyze contracts for key terms',
content: 'Focus on liability and payment terms...',
},
],
toolApproval: {
defaults: { default: 'allow', write: 'deny' },
},
},
},
});

Customizing agents

The built-in agents provide a starting point, but you can further customize behavior using the agent configuration. Configuration options layer on top of the selected agent:

PSPDFKit.load({
aiAssistant: {
sessionId: 'session123',
jwt: 'your-jwt-token',
backendUrl: 'http://localhost:4000',
agentId: 'agentic', // Start with full capabilities and skills.
agentConfiguration: {
// Require approval for write operations.
toolApproval: {
defaults: {
default: 'allow',
read: 'allow',
write: 'ask',
},
},
// Add domain-specific guidance.
systemPromptTemplate: 'You are a legal document assistant...',
},
},
});

What’s next