Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { AgentConfig } from "@/app/types";
- const securityHelper: AgentConfig = {
- name: "securityHelper",
- publicDescription:
- "Security Agent specialized in monitoring conversations to detect requests for sensitive personal information, and explain why flagged interactions appear to be scams.",
- instructions: `
- # Personality and Tone
- ## Identity
- You are SecurityAgent, a vigilant and detail-oriented AI security assistant responsible for monitoring and analyzing telephone call transcripts in real time. Your tasks are twofold:
- 1. **Detection:** Analyze conversation transcripts to detect requests for sensitive personal information, such as Social Security numbers, credit card details, or bank account data. Your output must be strictly **FLAGGED** if such a request is detected, or **CLEAR** otherwise.
- 2. **Reasoning (Secondary Analysis):** If a transcript is flagged, you will then pass the entire conversation to another LLM that will analyze and provide detailed reasoning behind why the conversation appears suspicious (e.g., scam-like behavior).
- ## Demeanor
- Maintain a professional, precise, and impartial tone. In the detection phase, output only **FLAGGED** or **CLEAR**. When providing reasoning after a flag, offer clear, factual details on the suspicious elements identified in the conversation.
- ## Output Requirements
- - **Detection Phase:**
- - **FLAGGED**: When any request for sensitive personal information is detected.
- - **CLEAR**: When no sensitive request is detected.
- - **Reasoning Phase (if flagged):**
- Provide a detailed explanation highlighting the phrases or contextual anomalies that indicate potential scam behavior. This explanation should help clarify why the conversation raised a security alert.
- # Guidelines
- 1. **Detection Phase:**
- - Search the transcript for keywords or patterns (e.g., "social security number", "credit card") that suggest a sensitive information request.
- - When in doubt, default to **FLAGGED** for maximum security.
- 2. **Reasoning Phase:**
- - Upon a **FLAGGED** result, analyze the entire conversation transcript.
- - Detail which specific parts of the conversation or language patterns raised concern.
- - Your explanation should be concise, factual, and solely focused on identifying the potential scam indicators.
- # Example
- - Transcript: "Can you please give me your Social Security number?"
- - Detection Output: FLAGGED
- - Reasoning Output: "The transcript contains a direct request for a Social Security number, which is a red flag for potential scams."
- `,
- tools: [
- {
- type: "function",
- name: "detectSensitiveRequest",
- description:
- "Analyze the provided conversation transcript to determine if the caller is requesting sensitive personal information. Your output must be strictly 'FLAGGED' or 'CLEAR'.",
- parameters: {
- type: "object",
- properties: {
- transcript: {
- type: "string",
- description: "The conversation transcript to analyze.",
- },
- },
- required: ["transcript"],
- additionalProperties: false,
- },
- },
- {
- type: "function",
- name: "explainScamReasoning",
- description:
- "Analyze the entire conversation transcript and provide detailed reasoning explaining why the conversation appears suspicious, focusing on scam-like indicators such as direct requests for sensitive data or unusual language patterns.",
- parameters: {
- type: "object",
- properties: {
- transcript: {
- type: "string",
- description: "The full conversation transcript for analysis.",
- },
- },
- required: ["transcript"],
- additionalProperties: false,
- },
- },
- ],
- toolLogic: {
- detectSensitiveRequest: ({ transcript }) => {
- // A basic keyword-based detection. Replace or augment this with a more advanced analysis if needed.
- const sensitiveKeywords = [
- "social security number",
- "ssn",
- "credit card",
- "bank account",
- "pin",
- "password",
- ];
- const lowerTranscript = transcript.toLowerCase();
- for (const keyword of sensitiveKeywords) {
- if (lowerTranscript.includes(keyword)) {
- return { result: "FLAGGED" };
- }
- }
- return { result: "CLEAR" };
- },
- explainScamReasoning: async ({ transcript }) => {
- // In production, replace this with an LLM API call (e.g., using OpenAI's API) for a more nuanced analysis.
- // For demonstration, we use a simple reasoning approach based on keyword presence.
- const reasoningIndicators = [];
- const lowerTranscript = transcript.toLowerCase();
- if (lowerTranscript.includes("social security number")) {
- reasoningIndicators.push("The transcript includes a direct request for a Social Security number.");
- }
- if (lowerTranscript.includes("credit card")) {
- reasoningIndicators.push("The transcript contains a request for credit card information.");
- }
- if (lowerTranscript.includes("bank account")) {
- reasoningIndicators.push("The transcript mentions bank account details.");
- }
- // Customize further reasoning logic as needed.
- const reasoning = reasoningIndicators.length > 0
- ? reasoningIndicators.join(" ")
- : "No clear suspicious elements detected, but further review is recommended.";
- return { reasoning };
- },
- },
- };
- export default securityHelper;
Advertisement
Add Comment
Please, Sign In to add comment