{"flow":{"id":76,"summary":"Send message to company AI assistant","versions":[290,297],"created_by":"hugo989","created_at":"2026-03-17T10:09:56.724Z","votes":0,"approved":true,"apps":["ai"],"value":{"groups":[],"modules":[{"id":"call_ai","value":{"type":"aiagent","tools":[{"id":"a","value":{"lock":"{\n  \"dependencies\": {}\n}\n//bun.lock\n<empty>","type":"rawscript","content":"export async function main() {\n  const today = new Date();\n  const results = [];\n  const baseSales = [1200, 850, 720, 1150, 1180, 1220, 1190, 3850, 3620, 3290,\n                     1450, 1280, 890, 1100, 6420, 5890, 5240, 1520, 1380, 1050,\n                     920, 1180, 1240, 1210, 1290, 1350, 1180, 1220, 1340, 1410];\n  for (let i = 29; i >= 0; i--) {\n    const date = new Date(today);\n    date.setDate(today.getDate() - i);\n    const dateStr = date.toISOString().split('T')[0];\n    results.push({ date: dateStr, sales: baseSales[29 - i] });\n  }\n  return results;\n}","language":"bun","tool_type":"flowmodule","input_transforms":{}},"summary":"get_sale_metrics"},{"id":"b","value":{"lock":"{\n  \"dependencies\": {}\n}\n//bun.lock\n<empty>","type":"rawscript","content":"export async function main() {\n  const today = new Date();\n  const campaigns = [\n    { daysAgo: 28, name: \"Monthly Newsletter\", type: \"email\", budget: 500, reach: 15000 },\n    { daysAgo: 25, name: \"Instagram Ads - New Collection\", type: \"social_media\", budget: 1200, reach: 45000 },\n    { daysAgo: 21, name: \"Google Search Ads\", type: \"paid_search\", budget: 800, reach: 8000 },\n    { daysAgo: 17, name: \"Influencer Partnership - @fashionista\", type: \"influencer\", budget: 2000, reach: 120000 },\n    { daysAgo: 14, name: \"Flash Sale Newsletter\", type: \"email\", budget: 300, reach: 18000 },\n    { daysAgo: 10, name: \"TikTok Video Campaign\", type: \"social_media\", budget: 1500, reach: 85000 },\n    { daysAgo: 6, name: \"Retargeting Ads - Facebook\", type: \"social_media\", budget: 600, reach: 12000 },\n    { daysAgo: 3, name: \"Weekend Promo Email\", type: \"email\", budget: 400, reach: 20000 },\n  ];\n  return campaigns.map(c => {\n    const date = new Date(today);\n    date.setDate(today.getDate() - c.daysAgo);\n    return { date: date.toISOString().split('T')[0], name: c.name, type: c.type, budget: c.budget, reach: c.reach };\n  });\n}","language":"bun","tool_type":"flowmodule","input_transforms":{}},"summary":"get_marketing_activations"}],"input_transforms":{"memory":{"expr":"({\n    \"kind\": \"auto\",\n    \"memory_id\": flow_input.session_id,\n    \"context_length\": 5\n})","type":"javascript"},"provider":{"type":"static","value":{"kind":"anthropic","model":"claude-sonnet-4-20250514","resource":"$res:f/landing_examples/limited_demo_anthropic"}},"streaming":{"type":"static","value":true},"output_type":{"type":"static","value":"text"},"temperature":{"type":"static","value":null},"user_message":{"expr":"flow_input.message","type":"javascript"},"output_schema":{"type":"static","value":null},"system_prompt":{"type":"static","value":"You are Boris, the internal AI assistant for Acme Corporation. Your role is to help employees find information about company policies, HR questions, internal processes, and general company knowledge.\n\n## Company Overview\n- **Company Name**: Acme Corporation\n- **Founded**: 2015\n- **Headquarters**: 123 Innovation Drive, San Francisco, CA 94105\n- **CEO**: Sarah Johnson\n- **Number of Employees**: 450+\n\n## Key Contacts\n- **HR Director**: Maria Garcia (maria.garcia@acme.com)\n- **IT Support**: helpdesk@acme.com or ext. 5555\n- **Facilities Manager**: Tom Wilson (tom.wilson@acme.com)\n- **Finance Director**: David Chen (david.chen@acme.com)\n- **Legal Counsel**: Jennifer Smith (jennifer.smith@acme.com)\n\n## Payroll & Compensation\n- **Pay Schedule**: Bi-weekly, every other Friday\n- **Next Payday**: Check the HR portal for exact dates\n- **Direct Deposit**: Set up through the HR portal under \"Payroll Settings\"\n- **Pay Stubs**: Available on the HR portal 2 days before payday\n- **Annual Raises**: Performance reviews in March, raises effective April 1st\n- **Bonuses**: Annual bonuses paid in December based on company and individual performance\n\n## Time Off & Leave\n- **PTO Policy**: 20 days per year for all full-time employees (accrues monthly)\n- **Sick Leave**: 10 days per year (separate from PTO)\n- **How to Request**: Submit through the HR portal at least 2 weeks in advance for planned leave\n- **Parental Leave**: 16 weeks paid for primary caregivers, 8 weeks for secondary\n- **Bereavement**: 5 days for immediate family, 3 days for extended family\n- **Jury Duty**: Paid time off for the duration of service\n\n## Company Holidays (2024)\n1. New Year's Day - January 1\n2. Martin Luther King Jr. Day - January 15\n3. Presidents' Day - February 19\n4. Memorial Day - May 27\n5. Independence Day - July 4\n6. Labor Day - September 2\n7. Thanksgiving - November 28-29 (2 days)\n8. Christmas Eve & Day - December 24-25\n9. New Year's Eve - December 31\n\n## Benefits\n- **Health Insurance**: Blue Cross PPO and HMO options, company pays 80%\n- **Dental & Vision**: Included with health insurance\n- **401(k)**: Company matches 4% of salary\n- **Life Insurance**: 2x annual salary provided\n- **FSA/HSA**: Available for health and dependent care expenses\n- **Gym Membership**: $50/month reimbursement\n- **Professional Development**: $2,000/year for courses, conferences, certifications\n\n## Office Information\n- **Office Hours**: 8:00 AM - 6:00 PM, Monday to Friday\n- **Building Access**: Badge required, contact Security for issues\n- **Parking**: Free parking in Lot B, badge required for garage\n- **Kitchen**: Free coffee, tea, and snacks on each floor\n- **Meeting Rooms**: Book through Outlook calendar or the Rooms app\n\n## IT & Security\n- **Password Reset**: Self-service at password.acme.com or contact IT\n- **VPN Access**: Required for remote work, setup guide on IT portal\n- **Software Requests**: Submit ticket through IT portal\n- **Security Incidents**: Report immediately to security@acme.com\n\n## Remote Work Policy\n- **Hybrid Schedule**: 3 days in office (Tue, Wed, Thu), 2 days remote\n- **Equipment**: Laptop provided, $500 home office stipend for new hires\n- **Internet Reimbursement**: $50/month for remote work days\n\n## Expense Reimbursement\n- **Submit Through**: Concur expense system\n- **Deadline**: Within 30 days of expense\n- **Approval**: Manager approval required for expenses over $100\n- **Travel Policy**: Book through corporate travel portal for best rates\n\nBe helpful, friendly, and concise. If you don't know something specific, direct employees to the appropriate contact person or department. NEVER use '**' in your answer. We cant read markdown syntax"},"max_iterations":{"type":"static","value":10},"user_attachments":{"type":"static","value":[]},"max_completion_tokens":{"type":"static","value":null}}},"summary":"Generate AI response with conversation memory"},{"id":"return_response","value":{"lock":"{\n  \"dependencies\": {}\n}\n//bun.lock\n<empty>","type":"rawscript","content":"export async function main(ai_result: any) {\n  // Extract tool calls from the messages array\n  const toolCalls: string[] = [];\n\n  if (ai_result?.messages && Array.isArray(ai_result.messages)) {\n    for (const msg of ai_result.messages) {\n      if (msg.role === 'assistant' && msg.tool_calls && Array.isArray(msg.tool_calls)) {\n        for (const tc of msg.tool_calls) {\n          const name = tc.function?.name;\n          if (name && !toolCalls.includes(name)) {\n            toolCalls.push(name);\n          }\n        }\n      }\n    }\n  }\n\n  return {\n    content: ai_result?.output || '',\n    tool_calls: toolCalls.length > 0 ? toolCalls : undefined\n  };\n}\n","language":"bun","input_transforms":{"ai_result":{"expr":"results.call_ai","type":"javascript"}}},"summary":"Return response with tool usage info"}],"failure_module":{"id":"failure","value":{"lock":"{\n  \"dependencies\": {}\n}\n//bun.lock\n<empty>","type":"rawscript","content":"\nexport async function main(message: string, name: string, step_id: string) {\n  const flow_id = process.env.WM_ROOT_FLOW_JOB_ID\n  let actualMessage = message;\n  if (message.includes(\"Not found: Resource\")) {\n    actualMessage = \"AI Resource not found, create one from your resources page and use it in the ai agent step\"\n  }\n  return { message: actualMessage, flow_id, step_id, recover: false }\n}\n","language":"bun","input_transforms":{"name":{"expr":"error.name","type":"javascript"},"message":{"expr":"error.message","type":"javascript"},"step_id":{"expr":"error.step_id","type":"javascript"}}}}},"schema":{"type":"object","order":["message","session_id"],"required":["message"],"properties":{"message":{"type":"string","description":"User's message"},"session_id":{"type":"string","default":"","description":""}}},"description":"Calls AI with auto memory - no message storage","recording":null,"vcreated_at":"2026-04-01T11:46:20.928Z","vcreated_by":"hugo989","comments":[]}}