Portal Community

Integration Direction

WorkDesk embeds Octopus — the integration is one-directional: WorkDesk embeds the Octopus ChatWidget. WorkDesk passes page context as seed data to the widget so the agent is immediately aware of what the employee is looking at.

ChatWidget in WorkDesk Shell

The ChatWidget is mounted once in WorkDeskShell.tsx and persists across page navigation. As the employee navigates between pages, WorkDesk updates the widget's context seed data to reflect the current view:

// WorkDeskShell.tsx — Octopus ChatWidget integration
import { ChatWidget } from '@bizfirstai/octopus-react';
import { useOctopusContext } from './hooks/useOctopusContext';

export function WorkDeskShell() {
  const { agentId, seedData } = useOctopusContext(); // context changes per page

  return (
    <div className="shell">
      <WorkDeskNav />
      <main>
        <Outlet />  {/* React Router page content */}
      </main>

      <ChatWidget
        agentId={agentId}             // configured per WorkDesk deployment
        seedData={seedData}           // current-page context (task, execution, etc.)
        theme="dark"
        position="bottom-right"
        initiallyOpen={false}
        locale={userLocale}
      />
    </div>
  );
}

Context-Aware Seed Data

The useOctopusContext hook builds seed data based on the current route. The agent receives relevant context without the employee needing to explain what they're looking at:

// useOctopusContext.ts — builds seed data per page
export function useOctopusContext(): OctopusContextData {
  const location = useLocation();
  const { taskId } = useParams();
  const task = useTaskStore(s => s.activeTask);
  const execution = useHistoryStore(s => s.activeExecution);

  return useMemo(() => {
    // Task inbox — active task page
    if (location.pathname.startsWith('/tasks/') && task) {
      return {
        agentId: OCTOPUS_AGENT_ID,
        seedData: {
          context: 'hil_task',
          taskId:       task.id,
          taskType:     task.type,         // "approval" | "form" | "review"
          taskTitle:    task.title,
          workflowName: task.workflowName,
          dueAt:        task.dueAt,
          // Note: form field values NOT included — privacy boundary
        }
      };
    }

    // Workflow history — execution detail page
    if (location.pathname.startsWith('/history/') && execution) {
      return {
        agentId: OCTOPUS_AGENT_ID,
        seedData: {
          context:      'execution_history',
          executionId:  execution.id,
          workflowName: execution.workflowName,
          status:       execution.status,
          triggeredAt:  execution.triggeredAt,
        }
      };
    }

    // Dashboard / default
    return {
      agentId: OCTOPUS_AGENT_ID,
      seedData: { context: 'workdesk_home' }
    };
  }, [location.pathname, task, execution]);
}

What the Agent Can Help With

The Octopus agent configured for WorkDesk has access to the following capabilities based on the context seed:

ContextAgent Can Help With
HIL Approval TaskExplain what the workflow does, what approving vs. rejecting means, relevant policies
HIL Form TaskExplain individual fields, provide examples, clarify validation requirements
HIL Review TaskSummarize long documents, answer questions about the content under review
Workflow HistoryExplain why an execution failed, what each node does, how to re-trigger
NotificationsExplain what a notification means, link to the relevant task or workflow
DashboardGeneral WorkDesk help, navigation assistance, feature questions
WorkDesk Assistant
Online — Octopus AI
I can see you have an Expense Report Approval task due tomorrow. Would you like me to explain what happens when you approve vs. reject?
Yes, what happens if I reject?
If you reject, the workflow sends a notification to the employee who submitted the expense, and routes the execution back to the "Revise and Resubmit" node. The employee gets a chance to correct the report and resubmit for your approval.

Privacy Boundaries

WorkDesk enforces strict privacy boundaries on what data is passed to the Octopus agent:

What is NOT Sent to Octopus
  • Form field values (user-entered data in HIL form tasks)
  • Workflow data context variables (intermediate computation outputs)
  • Other users' task details or notification content
  • Authentication tokens or session data

Only structural metadata (task type, workflow name, due date) is passed as seed data. The agent uses its knowledge base to provide help — it does not have access to actual business data unless explicitly granted by the administrator.

Agent Configuration

The Octopus agent used in WorkDesk is configured in the Octopus admin console and identified by agentId. Platform engineers can configure:

// WorkDesk environment configuration
NEXT_PUBLIC_OCTOPUS_AGENT_ID=agt-workdesk-assistant-prod
NEXT_PUBLIC_OCTOPUS_ENDPOINT=https://octopus.bizfirstai.com

// ChatWidget picks up agent config from Octopus via agentId
// No additional configuration needed in WorkDesk code

ChatWidget Lifecycle

EventBehavior
User opens WorkDeskChatWidget mounts in closed state — no conversation started yet
User clicks chat iconWidget opens; agent receives seed data and sends an opening message based on current context
User navigates to different pageSeed data updates; if chat is open, agent receives context update event and adjusts its awareness
User closes widgetConversation state is preserved — reopening resumes the conversation
User session endsConversation history is cleared (not persisted between sessions by default)
Octopus Widget is Optional

If the OCTOPUS_AGENT_ID environment variable is not set, WorkDeskShell skips rendering the ChatWidget entirely. Deployments that do not have Octopus available can disable the integration by leaving the variable unset.