SDK Configuration Parameters
Both integration modes require the same core configuration parameters for authentication and initialization.
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Currently logged-in user's email from your system | |
| companyId | string | Yes | Company ID provided by Eureka |
| publicKey | string | Yes | Public key provided by Eureka for RSA encryption |
| JSEncrypt | constructor | Yes | Global JSEncrypt constructor from the library |
| iframe | HTMLElement | iframe only | iframe DOM element for embedding mode |
New Window Mode Configuration
Configure the SDK to open AI Agents in a new browser window. This mode is ideal for standalone workflows and complex analysis tasks.
const PatsnapAgentNewTab = window.PatsnapAgentSDK.AgentNewTab;
const AGENT_NAME = window.PatsnapAgentSDK.AGENT_NAME;
// Initialize SDK
const agentNewTab = new PatsnapAgentNewTab({
email: 'user@yourcompany.com',
companyId: 'your-company-id',
publicKey: 'YOUR_PUBLIC_KEY',
JSEncrypt: window.JSEncrypt,
});
// Login and open agent
document.getElementById('btn').addEventListener('click', async () => {
try {
await agentNewTab.login();
await agentNewTab.openAgent(AGENT_NAME.NOVELTY_SEARCH);
} catch (error) {
console.error('Failed to open agent:', error);
}
});iframe Embedding Mode Configuration
Configure the SDK to embed AI Agents directly into your page. This mode provides seamless integration within your existing UI.
<iframe id="agent-iframe" style="width: 100%; height: 600px; border: none;"></iframe>const AgentIframe = window.PatsnapAgentSDK.AgentIframe;
const AGENT_NAME = window.PatsnapAgentSDK.AGENT_NAME;
const iframe = document.getElementById('agent-iframe');
// Initialize SDK
const agentIframe = new AgentIframe({
email: 'user@yourcompany.com',
companyId: 'your-company-id',
publicKey: 'YOUR_PUBLIC_KEY',
JSEncrypt: window.JSEncrypt,
iframe: iframe,
});
// Login and initialize agent
document.getElementById('btn').addEventListener('click', async () => {
try {
await agentIframe.login();
await agentIframe.init(AGENT_NAME.NOVELTY_SEARCH);
} catch (error) {
console.error('Failed to initialize agent:', error);
}
});Important: iframe mode requires CSP (Content Security Policy) configuration. Add Eureka domains to your whitelist, or use new window mode if CSP configuration is not possible.
Advanced Configuration
Customize widget behavior with advanced configuration options for export handling and question pre-filling.
Export Configuration
Control how AI Agents handle report exports. Available for Patent Disclosure agent only.
const EXPORT_BEHAVIOR = window.PatsnapAgentSDK.EXPORT_BEHAVIOR;
await agentNewTab.openAgent(AGENT_NAME.PATENT_DISCLOSURE, {
exportConfig: {
behavior: EXPORT_BEHAVIOR.EVENT_ONLY,
},
eventListeners: {
exportReport: (eventData) => {
console.log('Export task ID:', eventData.taskId);
// Use taskId to call OpenAPI endpoint for report download
}
}
});Question Configuration
Pre-fill questions when opening an agent to streamline user workflows.
await agentNewTab.openAgent(AGENT_NAME.TECHNICAL_QA, {
questionConfig: {
input: 'Explain machine learning overfitting',
enableInputAppendToJob: true // Use as initial question
}
});Available Agents
Access 30+ AI Agent widgets across multiple domains. Use the AGENT_NAME constants to specify which agent to open.
Research & Innovation
Intellectual Property
Life Sciences & Materials
See the complete list of available agents and their capabilities in the API Reference section of the agent integration documentation.
Next Steps
Configuration complete! Check the FAQ section for common issues and troubleshooting tips, or start integrating widgets into your application.