@elqnt/agents
Complete AI agent management for the Eloquent platform. Provides types, browser & server APIs, React hooks, and utilities for building agent-powered applications.
Installation
npm install @elqnt/agents
Entry Points
| Import | Description |
|---|---|
@elqnt/agents | All exports |
@elqnt/agents/hooks | React hooks (primary interface) |
@elqnt/agents/models | TypeScript types |
@elqnt/agents/api | Internal browser API functions (use hooks instead) |
@elqnt/agents/api/server | Server-side API (SSR, Server Actions) |
@elqnt/agents/utils | Utility functions |
React Hooks
useAgents
Hook for agent CRUD operations with loading/error states.
import { useAgents } from "@elqnt/agents/hooks";
const {
loading,
error,
listAgents,
listAgentSummaries,
getAgent,
createAgent,
updateAgent,
deleteAgent,
getDefaultAgent,
} = useAgents({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all agents
const agents = await listAgents();
// List agent summaries (lightweight)
const summaries = await listAgentSummaries();
// Get agent by ID
const agent = await getAgent("agent-uuid");
// Get default agent
const defaultAgent = await getDefaultAgent();
// Create agent
const newAgent = await createAgent({
name: "Support Agent",
goal: "Help customers with questions",
model: "claude-sonnet-4-20250514",
});
// Update agent
const updated = await updateAgent("agent-uuid", { name: "Updated Name" });
// Delete agent
const success = await deleteAgent("agent-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listAgents | - | Agent[] | List all agents |
listAgentSummaries | - | AgentSummary[] | List lightweight agent summaries |
getAgent | agentId: string | Agent | null | Get agent by ID |
getDefaultAgent | - | Agent | null | Get organization's default agent |
createAgent | agent: Partial<Agent> | Agent | null | Create a new agent |
updateAgent | agentId: string, updates: Partial<Agent> | Agent | null | Update an agent |
deleteAgent | agentId: string | boolean | Delete an agent |
useSkills
Hook for skill CRUD operations with loading/error states.
import { useSkills } from "@elqnt/agents/hooks";
const {
loading,
error,
listSkills,
getSkill,
createSkill,
updateSkill,
deleteSkill,
getCategories,
} = useSkills({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all skills
const skills = await listSkills();
// Get skill categories
const categories = await getCategories();
// Get skill by ID
const skill = await getSkill("skill-uuid");
// Create skill
const newSkill = await createSkill({
name: "Web Search",
description: "Search the web for information",
category: "research",
});
// Update skill
const updated = await updateSkill("skill-uuid", { enabled: true });
// Delete skill
const success = await deleteSkill("skill-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listSkills | - | Skill[] | List all skills |
getSkill | skillId: string | Skill | null | Get skill by ID |
createSkill | skill: Partial<Skill> | Skill | null | Create a new skill |
updateSkill | skillId: string, updates: Partial<Skill> | Skill | null | Update a skill |
deleteSkill | skillId: string | boolean | Delete a skill |
getCategories | - | string[] | Get available skill categories |
useSubAgents
Hook for sub-agent CRUD operations with loading/error states.
import { useSubAgents } from "@elqnt/agents/hooks";
const {
loading,
error,
listSubAgents,
getSubAgent,
createSubAgent,
updateSubAgent,
deleteSubAgent,
} = useSubAgents({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all sub-agents
const subAgents = await listSubAgents();
// Get sub-agent by ID
const subAgent = await getSubAgent("subagent-uuid");
// Create sub-agent
const newSubAgent = await createSubAgent({
name: "Document Analyzer",
description: "Specialized in document analysis",
model: "claude-sonnet-4-20250514",
});
// Update sub-agent
const updated = await updateSubAgent("subagent-uuid", { enabled: true });
// Delete sub-agent
const success = await deleteSubAgent("subagent-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listSubAgents | - | SubAgent[] | List all sub-agents |
getSubAgent | subAgentId: string | SubAgent | null | Get sub-agent by ID |
createSubAgent | subAgent: Partial<SubAgent> | SubAgent | null | Create a new sub-agent |
updateSubAgent | subAgentId: string, updates: Partial<SubAgent> | SubAgent | null | Update a sub-agent |
deleteSubAgent | subAgentId: string | boolean | Delete a sub-agent |
useToolDefinitions
Hook for tool definition CRUD operations with loading/error states.
import { useToolDefinitions } from "@elqnt/agents/hooks";
const {
loading,
error,
listToolDefinitions,
getToolDefinition,
getToolDefinitionsByIds,
createToolDefinition,
updateToolDefinition,
deleteToolDefinition,
} = useToolDefinitions({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all tool definitions
const toolDefs = await listToolDefinitions();
// Get tool definition by ID
const toolDef = await getToolDefinition("tooldef-uuid");
// Get multiple tool definitions by IDs
const toolDefs = await getToolDefinitionsByIds(["id1", "id2", "id3"]);
// Create tool definition
const newToolDef = await createToolDefinition({
name: "get_weather",
description: "Get current weather for a location",
inputSchema: { type: "object", properties: { location: { type: "string" } } },
});
// Update tool definition
const updated = await updateToolDefinition("tooldef-uuid", { enabled: true });
// Delete tool definition
const success = await deleteToolDefinition("tooldef-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listToolDefinitions | - | ToolDefinition[] | List all tool definitions |
getToolDefinition | toolDefId: string | ToolDefinition | null | Get tool definition by ID |
getToolDefinitionsByIds | ids: string[] | ToolDefinition[] | Get multiple tool definitions |
createToolDefinition | toolDef: Partial<ToolDefinition> | ToolDefinition | null | Create a tool definition |
updateToolDefinition | toolDefId: string, updates: Partial<ToolDefinition> | ToolDefinition | null | Update a tool definition |
deleteToolDefinition | toolDefId: string | boolean | Delete a tool definition |
useAgentJobs
Hook for scheduled agent job CRUD operations with loading/error states.
import { useAgentJobs } from "@elqnt/agents/hooks";
const {
loading,
error,
listAgentJobs,
getAgentJob,
createAgentJob,
updateAgentJob,
deleteAgentJob,
pauseAgentJob,
resumeAgentJob,
} = useAgentJobs({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all agent jobs
const jobs = await listAgentJobs();
// Get job by ID
const job = await getAgentJob("job-uuid");
// Create job
const newJob = await createAgentJob({
agentId: "agent-uuid",
name: "Daily Report",
schedule: "0 9 * * *", // 9am daily
prompt: "Generate daily sales report",
});
// Pause job
const paused = await pauseAgentJob("job-uuid");
// Resume job
const resumed = await resumeAgentJob("job-uuid");
// Delete job
const success = await deleteAgentJob("job-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listAgentJobs | - | AgentJob[] | List all agent jobs |
getAgentJob | jobId: string | AgentJob | null | Get job by ID |
createAgentJob | job: Partial<AgentJob> | AgentJob | null | Create a new job |
updateAgentJob | jobId: string, updates: Partial<AgentJob> | AgentJob | null | Update a job |
deleteAgentJob | jobId: string | boolean | Delete a job |
pauseAgentJob | jobId: string | AgentJob | null | Pause a running job |
resumeAgentJob | jobId: string | AgentJob | null | Resume a paused job |
useWidgets
Hook for chat widget CRUD operations with loading/error states.
import { useWidgets } from "@elqnt/agents/hooks";
const {
loading,
error,
listWidgets,
getWidget,
getDefaultWidget,
createWidget,
updateWidget,
deleteWidget,
setDefaultWidget,
} = useWidgets({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
agentId: selectedAgentId,
});
// List all widgets for agent
const widgets = await listWidgets();
// Get default widget
const defaultWidget = await getDefaultWidget();
// Get widget by ID
const widget = await getWidget("widget-uuid");
// Create widget
const newWidget = await createWidget({
name: "Support Widget",
theme: { primaryColor: "#007bff" },
placement: "bottom-right",
});
// Update widget
const updated = await updateWidget("widget-uuid", { name: "Updated Widget" });
// Set as default widget
await setDefaultWidget("widget-uuid");
// Delete widget
const success = await deleteWidget("widget-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listWidgets | - | AgentWidget[] | List all widgets for agent |
getWidget | widgetId: string | AgentWidget | null | Get widget by ID |
getDefaultWidget | - | AgentWidget | null | Get agent's default widget |
createWidget | widget: Partial<AgentWidget> | AgentWidget | null | Create a new widget |
updateWidget | widgetId: string, updates: Partial<AgentWidget> | AgentWidget | null | Update a widget |
deleteWidget | widgetId: string | boolean | Delete a widget |
setDefaultWidget | widgetId: string | boolean | Set widget as default |
useSkillUserConfig
Hook for per-user skill configuration operations.
import { useSkillUserConfig } from "@elqnt/agents/hooks";
const {
loading,
error,
getSkillUserConfig,
updateSkillUserConfig,
deleteSkillUserConfig,
listSkillUserConfigs,
resolveSkillConfig,
} = useSkillUserConfig({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// Get skill config for user
const config = await getSkillUserConfig("skill-uuid", "agent-uuid");
// Update skill config
const updated = await updateSkillUserConfig("skill-uuid", {
enabled: true,
displayOrder: 1,
config: { apiKey: "xxx" },
agentId: "agent-uuid",
});
// List all user configs
const configs = await listSkillUserConfigs({ agentId: "agent-uuid" });
// Resolve effective config (merges org + user configs)
const resolved = await resolveSkillConfig("skill-uuid", "agent-uuid");
// Delete user config
const success = await deleteSkillUserConfig("skill-uuid", "agent-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
getSkillUserConfig | skillId: string, agentId?: string | SkillUserConfig | null | Get user's skill config |
updateSkillUserConfig | skillId: string, data: {...} | SkillUserConfig | null | Update user's skill config |
deleteSkillUserConfig | skillId: string, agentId?: string | boolean | Delete user's skill config |
listSkillUserConfigs | params?: {...} | SkillUserConfig[] | List all user configs |
resolveSkillConfig | skillId: string, agentId: string | ResolveSkillConfigResponse | null | Get resolved config |
useAnalytics
Hook for agent analytics operations.
import { useAnalytics } from "@elqnt/agents/hooks";
const {
loading,
error,
getAgentChatsAnalytics,
getAgentCSATAnalytics,
getAgentListAnalytics,
getTaskOutcomes,
} = useAnalytics({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// Get chat analytics
const chatsData = await getAgentChatsAnalytics({
date_filter: { from: "2024-01-01", to: "2024-12-31" },
agent_id: "agent-uuid", // optional
});
// Get CSAT analytics
const csatData = await getAgentCSATAnalytics({
date_filter: { from: "2024-01-01", to: "2024-12-31" },
});
// Get agent list analytics
const agentListData = await getAgentListAnalytics();
// Get task outcomes
const taskData = await getTaskOutcomes({
date_filter: { from: "2024-01-01", to: "2024-12-31" },
});
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
getAgentChatsAnalytics | { date_filter, agent_id? } | unknown[] | Get chat volume analytics |
getAgentCSATAnalytics | { date_filter, agent_id? } | unknown[] | Get customer satisfaction analytics |
getAgentListAnalytics | - | unknown[] | Get agent performance list |
getTaskOutcomes | { date_filter } | unknown[] | Get task outcome analytics |
useIntegrations
Hook for OAuth integration management (Google, Microsoft) for email, calendar, and drive.
import { useIntegrations } from "@elqnt/agents/hooks";
const {
loading,
error,
listIntegrations,
getIntegration,
connectIntegration,
disconnectIntegration,
refreshIntegration,
updateTriage,
runEmailTriage,
} = useIntegrations({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all user integrations
const integrations = await listIntegrations();
// Get specific integration
const emailIntegration = await getIntegration("google", "email");
// Connect new integration (returns OAuth URL)
const { authUrl, state } = await connectIntegration({
provider: "google",
integrationType: "email",
redirectUri: "/settings/integrations/callback",
});
window.location.href = authUrl; // Redirect to OAuth
// Disconnect integration
await disconnectIntegration({
provider: "google",
integrationType: "email",
});
// Refresh token
const refreshed = await refreshIntegration({
provider: "google",
integrationType: "email",
});
// Enable/disable email triage
const updated = await updateTriage({
provider: "google",
integrationType: "email",
triageEnabled: true,
});
// Manually run email triage
const result = await runEmailTriage();
console.log(`Found ${result.emailsFound} emails, created ${result.instancesCreated} instances`);
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listIntegrations | - | UserIntegration[] | List all user integrations |
getIntegration | provider, integrationType | UserIntegration | null | Get specific integration |
connectIntegration | { provider, integrationType, redirectUri } | { authUrl, state } | Initiate OAuth connection |
disconnectIntegration | { provider, integrationType } | boolean | Disconnect integration |
refreshIntegration | { provider, integrationType } | UserIntegration | null | Refresh OAuth token |
updateTriage | { provider, integrationType, triageEnabled } | UserIntegration | null | Update triage setting |
runEmailTriage | - | { success, emailsFound, instancesCreated } | Manually run email triage |
useSandbox
Hook for AI-generated HTML sandbox operations. Sandboxes are interactive HTML visualizations created from natural language prompts.
import { useSandbox } from "@elqnt/agents/hooks";
const {
loading,
error,
createSandbox,
getSandbox,
updateSandbox,
listSandboxes,
deleteSandbox,
} = useSandbox({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// Create a new sandbox from prompt
const result = await createSandbox({
prompt: "Create an interactive bar chart showing monthly sales data",
title: "Sales Dashboard",
libraries: ["chart.js"], // Optional library hints
style: "dark mode", // Optional style preference
});
console.log(result.url); // Sandbox URL for viewing
// Get sandbox by ID
const sandbox = await getSandbox("sandbox-uuid");
// Update sandbox with new prompt
const updated = await updateSandbox("sandbox-uuid", {
prompt: "Add a trend line to the chart",
title: "Sales Dashboard v2",
});
// List all sandboxes
const { sandboxes, total } = await listSandboxes(50); // limit
// Delete sandbox
const success = await deleteSandbox("sandbox-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
createSandbox | { prompt, title?, libraries?, style? } | { id, url, sandbox? } | Create sandbox from prompt |
getSandbox | sandboxId: string | Sandbox | null | Get sandbox by ID |
updateSandbox | sandboxId: string, { prompt, title? } | { id, url, sandbox? } | Update sandbox with prompt |
listSandboxes | limit?: number | { sandboxes, total } | List all sandboxes |
deleteSandbox | sandboxId: string | boolean | Delete a sandbox |
useSchedulerTasks
Hook for scheduler task operations. Tasks are one-time scheduled jobs that can be snoozed, completed, or started manually.
import { useSchedulerTasks } from "@elqnt/agents/hooks";
const {
loading,
error,
listTasks,
createTask,
getTask,
updateTask,
deleteTask,
snoozeTask,
completeTask,
startTask,
} = useSchedulerTasks({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all tasks
const tasks = await listTasks({ status: "scheduled", limit: 50 });
// Create a new task
const newTask = await createTask({
name: "Send weekly report",
description: "Generate and send the weekly analytics report",
subject: "workflow.execute",
runAt: Date.now() + 3600000, // 1 hour from now
fields: { reportType: "weekly", recipients: ["team@example.com"] },
});
// Get task by ID
const task = await getTask("task-uuid");
// Snooze task
const snoozed = await snoozeTask("task-uuid", { amount: 30, unit: "minutes" });
// Complete task manually
const completed = await completeTask("task-uuid");
// Start task immediately
const started = await startTask("task-uuid");
// Delete task
const success = await deleteTask("task-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listTasks | { status?, limit?, offset? } | SchedulerTask[] | List tasks with optional filters |
createTask | task: Partial<SchedulerTask> | SchedulerTask | null | Create a new task |
getTask | taskId: string | SchedulerTask | null | Get task by ID |
updateTask | taskId: string, updates: Partial<SchedulerTask> | SchedulerTask | null | Update a task |
deleteTask | taskId: string | boolean | Delete a task |
snoozeTask | taskId: string, { amount, unit } | SchedulerTask | null | Snooze task by duration |
completeTask | taskId: string | SchedulerTask | null | Mark task as completed |
startTask | taskId: string | SchedulerTask | null | Start task immediately |
useSchedulerSchedules
Hook for scheduler schedule operations. Schedules are recurring jobs defined with cron expressions.
import { useSchedulerSchedules } from "@elqnt/agents/hooks";
const {
loading,
error,
listSchedules,
createSchedule,
getSchedule,
updateSchedule,
deleteSchedule,
pauseSchedule,
resumeSchedule,
runSchedule,
} = useSchedulerSchedules({
baseUrl: apiGatewayUrl,
orgId: selectedOrgId,
});
// List all schedules
const schedules = await listSchedules({ status: "active", limit: 50 });
// Create a recurring schedule
const newSchedule = await createSchedule({
name: "Daily email triage",
cronExpression: "0 9 * * *", // 9am daily
action: {
type: "email_triage",
emailQuery: "is:unread",
},
});
// Get schedule by ID
const schedule = await getSchedule("schedule-uuid");
// Pause schedule
const paused = await pauseSchedule("schedule-uuid");
// Resume schedule
const resumed = await resumeSchedule("schedule-uuid");
// Run schedule immediately (trigger next execution)
const ran = await runSchedule("schedule-uuid");
// Delete schedule
const success = await deleteSchedule("schedule-uuid");
Methods:
| Method | Parameters | Returns | Description |
|---|---|---|---|
listSchedules | { status?, limit?, offset? } | SchedulerSchedule[] | List schedules with optional filters |
createSchedule | schedule: Partial<SchedulerSchedule> | SchedulerSchedule | null | Create a recurring schedule |
getSchedule | scheduleId: string | SchedulerSchedule | null | Get schedule by ID |
updateSchedule | scheduleId: string, updates: Partial<SchedulerSchedule> | SchedulerSchedule | null | Update a schedule |
deleteSchedule | scheduleId: string | boolean | Delete a schedule |
pauseSchedule | scheduleId: string | SchedulerSchedule | null | Pause a schedule |
resumeSchedule | scheduleId: string | SchedulerSchedule | null | Resume a paused schedule |
runSchedule | scheduleId: string | SchedulerSchedule | null | Trigger immediate execution |
Server API (SSR)
Server-side functions for Next.js Server Actions, API routes, and SSR. These generate JWT tokens internally.
import {
listAgentsServer,
getAgentServer,
listSkillsServer,
listSubAgentsServer,
listToolDefinitionsServer,
listAgentJobsServer,
listWidgetsServer,
} from "@elqnt/agents/api/server";
// In a Next.js Server Action
"use server";
export async function getAgentsList(orgId: string) {
const response = await listAgentsServer({
gatewayUrl: process.env.API_GATEWAY_URL!,
jwtSecret: process.env.JWT_SECRET!,
orgId,
userId: "system",
});
return response.data?.agents || [];
}
// Get single agent
const agent = await getAgentServer("agent-uuid", {
gatewayUrl: process.env.API_GATEWAY_URL!,
jwtSecret: process.env.JWT_SECRET!,
orgId,
});
ServerApiOptions:
interface ServerApiOptions {
gatewayUrl: string; // API Gateway URL
jwtSecret: string; // JWT secret for token generation
orgId: string; // Organization ID
userId?: string; // User ID (defaults to "system")
userEmail?: string; // User email
timeout?: number; // Request timeout in ms
cache?: RequestCache; // Cache strategy
}
Available Server Functions:
| Category | Functions |
|---|---|
| Agents | listAgentsServer, getAgentServer, createAgentServer, updateAgentServer, deleteAgentServer, getDefaultAgentServer |
| Skills | listSkillsServer, getSkillServer, createSkillServer, updateSkillServer, deleteSkillServer, getSkillCategoriesServer |
| Sub-Agents | listSubAgentsServer, getSubAgentServer, createSubAgentServer, updateSubAgentServer, deleteSubAgentServer |
| Tool Definitions | listToolDefinitionsServer, getToolDefinitionServer, createToolDefinitionServer, updateToolDefinitionServer, deleteToolDefinitionServer |
| Agent Jobs | listAgentJobsServer, getAgentJobServer, createAgentJobServer, updateAgentJobServer, deleteAgentJobServer, pauseAgentJobServer, resumeAgentJobServer |
| Widgets | listWidgetsServer, getWidgetServer, createWidgetServer, updateWidgetServer, deleteWidgetServer, getDefaultWidgetServer |
| Skill Config | getSkillUserConfigServer, updateSkillUserConfigServer, deleteSkillUserConfigServer, listSkillUserConfigsServer, resolveSkillConfigServer |
Provisioning API
Function for bulk provisioning agents, skills, and tools.
import { provisionAgentsApi } from "@elqnt/agents/api";
// Provision default agents for a new organization
const result = await provisionAgentsApi(
agentDefinitions,
{ baseUrl: config.apiGatewayUrl, orgId: config.orgId }
);
// Result:
// {
// agents: Agent[],
// agentsCreated: number,
// subAgentsCreated: number,
// toolsCreated: number,
// skillsCreated: number,
// success: boolean
// }
Models
Agent
import type { Agent, AgentSummary } from "@elqnt/agents/models";
interface Agent {
id?: string;
orgId: string;
name: string;
description?: string;
goal?: string;
systemPrompt?: string;
model: string;
temperature?: number;
maxTokens?: number;
tools?: AgentTool[];
skills?: AgentSkill[];
subAgentIds?: string[];
status: AgentStatusTS;
isDefault?: boolean;
contextConfig?: AgentContextConfig;
createdAt?: number;
updatedAt?: number;
}
interface AgentSummary {
id: string;
name: string;
description?: string;
status: AgentStatusTS;
isDefault?: boolean;
}
Skill
import type { Skill, SkillUserConfig } from "@elqnt/agents/models";
interface Skill {
id?: string;
name: string;
description: string;
category: string;
icon?: string;
toolDefinitionIds?: string[];
enabled: boolean;
isSystem: boolean;
configSchema?: JSONSchema;
defaultConfig?: Record<string, unknown>;
createdAt?: number;
updatedAt?: number;
}
interface SkillUserConfig {
id?: string;
skillId: string;
userId: string;
orgId: string;
agentId?: string;
enabled: boolean;
displayOrder: number;
config?: Record<string, unknown>;
createdAt?: number;
updatedAt?: number;
}
SubAgent
import type { SubAgent } from "@elqnt/agents/models";
interface SubAgent {
id?: string;
name: string;
description: string;
model: string;
systemPrompt?: string;
toolDefinitionIds?: string[];
enabled: boolean;
isSystem: boolean;
createdAt?: number;
updatedAt?: number;
}
ToolDefinition
import type { ToolDefinition } from "@elqnt/agents/models";
interface ToolDefinition {
id?: string;
name: string;
description: string;
inputSchema?: JSONSchema;
outputSchema?: JSONSchema;
toolType: ToolTypeTS;
config?: Record<string, unknown>;
enabled: boolean;
isSystem: boolean;
createdAt?: number;
updatedAt?: number;
}
AgentJob
import type { AgentJob } from "@elqnt/agents/models";
interface AgentJob {
id?: string;
agentId: string;
name: string;
description?: string;
schedule: string; // Cron expression
prompt: string;
frequency: JobFrequencyTS;
status: JobStatusTS;
scope: JobScopeTS;
ownerId: string;
lastRunAt?: number;
nextRunAt?: number;
createdAt?: number;
updatedAt?: number;
}
AgentWidget
import type { AgentWidget } from "@elqnt/agents/models";
interface AgentWidget {
id?: string;
widgetId: string; // Public widget ID for embedding
agentId: string;
name: string;
isDefault: boolean;
theme?: WidgetTheme;
placement?: string;
welcomeMessage?: string;
suggestedPrompts?: string[];
allowedDomains?: string[];
createdAt?: number;
updatedAt?: number;
}
AgentContext
import type { AgentContext, AgentExecution } from "@elqnt/agents/models";
interface AgentContext {
orgId: string;
agentId: string;
chatKey: string;
schema: JSONSchema;
variables: Record<string, unknown>;
executions: AgentExecution[];
pendingPlan?: ExecutionPlan;
completedPlans?: ExecutionPlan[];
createdAt: number;
lastUpdated: number;
}
interface AgentExecution {
id: string;
toolName: string;
title: string;
type: string;
status: ExecutionStatusTS;
input: Record<string, unknown>;
output?: Record<string, unknown>;
startedAt: number;
completedAt?: number;
}
Organization Settings
import type { OrgSettings } from "@elqnt/agents/models";
interface OrgSettings {
id: string;
orgId: string;
title: string;
description: string;
logoUrl: string;
defaultLang: string;
timezone: string;
additionalSettings: Record<string, unknown>;
}
Integration Types
OAuth integrations for email, calendar, and drive services.
import type {
UserIntegration,
OrgIntegration,
IntegrationProviderTS,
IntegrationTypeTS,
IntegrationStatusTS,
} from "@elqnt/agents/models";
// Providers
type IntegrationProviderTS = "google" | "microsoft";
// Integration Types
type IntegrationTypeTS = "email" | "calendar" | "drive";
// Status
type IntegrationStatusTS = "active" | "expired" | "revoked" | "error";
// Enterprise Mode
type IntegrationMode = "service_principal" | "domain_delegation";
interface UserIntegration {
id: string;
org_id: string;
user_id: string;
provider: IntegrationProviderTS;
integration_type: IntegrationTypeTS;
account_email: string;
account_name?: string;
status: IntegrationStatusTS;
scopes: string[];
triage_enabled: boolean;
last_used_at?: string;
last_error?: string;
created_at: string;
updated_at: string;
expires_at?: string;
}
interface OrgIntegration {
id: string;
org_id: string;
provider: IntegrationProviderTS;
integration_type: IntegrationTypeTS;
mode: IntegrationMode;
domain?: string;
enabled: boolean;
config?: Record<string, any>;
scopes: string[];
created_by: string;
created_at: string;
updated_at: string;
}
Email Types
import type { EmailSummary, EmailDetails, EmailAttachment } from "@elqnt/agents/models";
interface EmailSummary {
id: string;
thread_id?: string;
from: string;
from_name?: string;
to: string[];
cc?: string[];
subject: string;
snippet: string;
date: string;
has_attachments: boolean;
is_read: boolean;
labels?: string[];
web_link?: string;
provider?: IntegrationProviderTS;
}
interface EmailDetails {
id: string;
thread_id?: string;
from: string;
from_name?: string;
to: string[];
cc?: string[];
bcc?: string[];
subject: string;
body: string;
body_html?: string;
date: string;
attachments?: EmailAttachment[];
labels?: string[];
is_read: boolean;
web_link?: string;
provider?: IntegrationProviderTS;
}
interface EmailAttachment {
id: string;
filename: string;
mime_type: string;
size: number;
}
interface SendEmailResult {
message_id: string;
thread_id?: string;
success: boolean;
error?: string;
}
Calendar Types
import type { CalendarEvent, EventAttendee, EventReminder } from "@elqnt/agents/models";
interface CalendarEvent {
id: string;
title: string;
description?: string;
location?: string;
start: string;
end: string;
is_all_day: boolean;
organizer?: string;
organizer_name?: string;
attendees?: EventAttendee[];
status?: "confirmed" | "tentative" | "cancelled";
response_status?: "accepted" | "declined" | "tentative" | "needsAction";
recurrence_rule?: string;
conference_url?: string;
calendar_id?: string;
provider?: IntegrationProviderTS;
}
interface EventAttendee {
email: string;
name?: string;
response_status?: string;
is_organizer?: boolean;
}
interface EventReminder {
method: "email" | "popup";
minutes: number;
}
Drive Types
import type { FileSummary, FileDetails, FilePermission } from "@elqnt/agents/models";
interface FileSummary {
id: string;
name: string;
mime_type: string;
size: number;
modified_time: string;
created_time?: string;
owner?: string;
owner_email?: string;
web_link?: string;
icon_link?: string;
thumbnail_link?: string;
is_folder: boolean;
parent_id?: string;
provider?: IntegrationProviderTS;
}
interface FileDetails {
id: string;
name: string;
mime_type: string;
size: number;
modified_time: string;
created_time?: string;
owner?: string;
owner_email?: string;
description?: string;
web_link?: string;
download_link?: string;
icon_link?: string;
thumbnail_link?: string;
is_folder: boolean;
parent_id?: string;
parent_name?: string;
shared_with?: FilePermission[];
provider?: IntegrationProviderTS;
}
interface FilePermission {
email: string;
name?: string;
role: "owner" | "writer" | "reader";
}
Sandbox Types
AI-generated HTML sandboxes for interactive visualizations and tools.
import type {
Sandbox,
CreateSandboxRequest,
CreateSandboxResponse,
UpdateSandboxRequest,
ListSandboxesResponse,
} from "@elqnt/agents/models";
import {
CreateSandboxSubject, // "agents.tool.execute.sandbox.create"
GetSandboxSubject, // "agents.tool.execute.sandbox.get"
UpdateSandboxSubject, // "agents.tool.execute.sandbox.update"
ListSandboxSubject, // "agents.tool.execute.sandbox.list"
DeleteSandboxSubject, // "agents.tool.execute.sandbox.delete"
} from "@elqnt/agents/models";
interface Sandbox {
id: string;
orgId?: string;
userId?: string;
html: string;
title?: string;
description?: string;
url?: string; // Sandbox URL for viewing
metadata?: Record<string, string>;
createdAt: string;
expiresAt: string;
}
interface CreateSandboxRequest {
orgId: string;
userId?: string;
prompt: string; // Description of what to create
title?: string;
description?: string;
libraries?: string[]; // Library hints: "d3", "chart.js", "three.js"
style?: string; // Style preference: "dark mode", "minimal"
}
interface CreateSandboxResponse {
sandbox?: Sandbox;
id: string;
url: string;
metadata: ResponseMetadata;
}
interface UpdateSandboxRequest {
id: string;
orgId: string;
userId?: string;
prompt: string; // Description of changes to make
title?: string;
}
interface ListSandboxesResponse {
sandboxes: Sandbox[];
total: number;
metadata: ResponseMetadata;
}
Scheduler Types
Scheduled tasks and recurring schedules for automated job execution.
import type {
SchedulerTask,
SchedulerSchedule,
} from "@elqnt/agents/api";
interface SchedulerTask {
id: string;
orgId: string;
userId?: string;
name?: string;
description?: string;
subject: string; // NATS subject to publish to
fields?: Record<string, unknown>; // Payload data
status: "scheduled" | "running" | "in-progress" | "completed" | "failed" | "cancelled";
progress: number; // 0-100
runAt: number; // Unix timestamp
delay?: {
amount?: number;
unit?: string; // "minutes", "hours", "days"
};
recurring?: boolean;
cronExpr?: string;
output?: Record<string, unknown>;
error?: string;
startedAt?: number;
completedAt?: number;
createdAt?: number;
updatedAt?: number;
}
interface SchedulerSchedule {
id: string;
orgId: string;
userId: string;
name: string;
description?: string;
cronExpression: string; // e.g., "0 9 * * *" (9am daily)
timezone?: string; // e.g., "America/New_York"
status: "active" | "paused" | "failed" | "deleted";
action: {
type: string; // e.g., "email_triage", "workflow_execute"
emailQuery?: string; // For email triage actions
taskTemplate?: {
subject: string;
fields?: Record<string, unknown>;
};
};
lastRunAt?: number;
nextRunAt?: number;
runCount?: number;
failCount?: number;
lastError?: string;
createdAt?: number;
updatedAt?: number;
}
NATS Subjects
For backend service communication:
import {
AgentsSubjects,
SettingsSubjects,
// Integration subjects
HubIntegrationUserList,
HubIntegrationUserGet,
HubIntegrationUserConnect,
HubIntegrationUserCallback,
HubIntegrationUserDisconnect,
HubIntegrationUserRefresh,
HubIntegrationUserUpdateTriage,
HubIntegrationEmailSearch,
HubIntegrationEmailGet,
HubIntegrationEmailSend,
HubIntegrationCalendarList,
HubIntegrationCalendarCreate,
HubIntegrationDriveSearch,
} from "@elqnt/agents/models";
// Agent subjects
AgentsSubjects.agentGet; // "agents.get"
AgentsSubjects.agentCreate; // "agents.create"
AgentsSubjects.agentUpdate; // "agents.update"
AgentsSubjects.agentDelete; // "agents.delete"
AgentsSubjects.agentsList; // "agents.list"
// Settings subjects
SettingsSubjects.orgSettingsGet; // "hub.org-settings.get"
SettingsSubjects.orgSettingsUpdate; // "hub.org-settings.update"
// Integration - User Management
HubIntegrationUserList; // "hub.integrations.user.list"
HubIntegrationUserGet; // "hub.integrations.user.get"
HubIntegrationUserConnect; // "hub.integrations.user.connect"
HubIntegrationUserCallback; // "hub.integrations.user.callback"
HubIntegrationUserDisconnect; // "hub.integrations.user.disconnect"
HubIntegrationUserRefresh; // "hub.integrations.user.refresh"
HubIntegrationUserUpdateTriage; // "hub.integrations.user.triage.update"
// Integration - Org Management (Enterprise)
HubIntegrationOrgList; // "hub.integrations.org.list"
HubIntegrationOrgConfigure; // "hub.integrations.org.configure"
HubIntegrationOrgDisable; // "hub.integrations.org.disable"
// Integration - Email Operations
HubIntegrationEmailSearch; // "hub.integrations.email.search"
HubIntegrationEmailGet; // "hub.integrations.email.get"
HubIntegrationEmailThread; // "hub.integrations.email.thread"
HubIntegrationEmailSend; // "hub.integrations.email.send"
HubIntegrationEmailArchive; // "hub.integrations.email.archive"
HubIntegrationEmailMarkRead; // "hub.integrations.email.markread"
HubIntegrationEmailForward; // "hub.integrations.email.forward"
HubEmailTriageRunNow; // "hub.email.triage.run"
// Integration - Calendar Operations
HubIntegrationCalendarList; // "hub.integrations.calendar.list"
HubIntegrationCalendarGet; // "hub.integrations.calendar.get"
HubIntegrationCalendarCreate; // "hub.integrations.calendar.create"
HubIntegrationCalendarUpdate; // "hub.integrations.calendar.update"
HubIntegrationCalendarDelete; // "hub.integrations.calendar.delete"
HubIntegrationCalendarRSVP; // "hub.integrations.calendar.rsvp"
// Integration - Drive Operations
HubIntegrationDriveSearch; // "hub.integrations.drive.search"
HubIntegrationDriveGet; // "hub.integrations.drive.get"
// Integration - Setup
HubIntegrationSetupOrg; // "hub.integrations.setup.org"
API Gateway Routes
| Function | Method | Gateway Route |
|---|---|---|
| Agents | ||
| List | GET | /api/v1/agents |
| List Summary | GET | /api/v1/agents/summary |
| Get | GET | /api/v1/agents/{agentId} |
| Get Default | GET | /api/v1/agents/default |
| Get by Name | GET | /api/v1/agents/by-name |
| Create | POST | /api/v1/agents |
| Update | PUT | /api/v1/agents/{agentId} |
| Delete | DELETE | /api/v1/agents/{agentId} |
| Skills | ||
| List | GET | /api/v1/skills |
| Get | GET | /api/v1/skills/{skillId} |
| Get by IDs | POST | /api/v1/skills/by-ids |
| Search | GET | /api/v1/skills/search |
| Categories | GET | /api/v1/skills/categories |
| Create | POST | /api/v1/skills |
| Update | PUT | /api/v1/skills/{skillId} |
| Delete | DELETE | /api/v1/skills/{skillId} |
| Skill User Config | ||
| Get | GET | /api/v1/skills/{skillId}/user-config |
| Update | PUT | /api/v1/skills/{skillId}/user-config |
| Delete | DELETE | /api/v1/skills/{skillId}/user-config |
| List | GET | /api/v1/skills/user-configs |
| Resolve | GET | /api/v1/skills/{skillId}/resolve-config |
| Sub-Agents | ||
| List | GET | /api/v1/subagents |
| Get | GET | /api/v1/subagents/{subAgentId} |
| Create | POST | /api/v1/subagents |
| Update | PUT | /api/v1/subagents/{subAgentId} |
| Delete | DELETE | /api/v1/subagents/{subAgentId} |
| Tool Definitions | ||
| List | GET | /api/v1/tool-definitions |
| Get | GET | /api/v1/tool-definitions/{toolDefId} |
| Get by IDs | POST | /api/v1/tool-definitions/by-ids |
| Create | POST | /api/v1/tool-definitions |
| Update | PUT | /api/v1/tool-definitions/{toolDefId} |
| Delete | DELETE | /api/v1/tool-definitions/{toolDefId} |
| Agent Jobs | ||
| List | GET | /api/v1/agent-jobs |
| Get | GET | /api/v1/agent-jobs/{jobId} |
| Create | POST | /api/v1/agent-jobs |
| Update | PUT | /api/v1/agent-jobs/{jobId} |
| Delete | DELETE | /api/v1/agent-jobs/{jobId} |
| Pause | POST | /api/v1/agent-jobs/{jobId}/pause |
| Resume | POST | /api/v1/agent-jobs/{jobId}/resume |
| Widgets | ||
| List | GET | /api/v1/agents/{agentId}/widgets |
| Get Default | GET | /api/v1/agents/{agentId}/widgets/default |
| Create | POST | /api/v1/agents/{agentId}/widgets |
| Get | GET | /api/v1/widgets/{widgetId} |
| Get by Widget ID | GET | /api/v1/widgets/by-widget-id/{widgetId} |
| Update | PUT | /api/v1/widgets/{widgetId} |
| Delete | DELETE | /api/v1/widgets/{widgetId} |
| Set Default | POST | /api/v1/widgets/{widgetId}/default |
| Analytics | ||
| Chats | POST | /api/v1/analytics/agents/chats |
| CSAT | POST | /api/v1/analytics/agents/csat |
| Agent List | GET | /api/v1/analytics/agents |
| Task Outcomes | POST | /api/v1/analytics/tasks |
| Provisioning | ||
| Provision | POST | /api/v1/admin/provision/agents |
| Integrations | ||
| List | GET | /api/v1/integrations |
| Get | GET | /api/v1/integrations/{provider}/{type} |
| Connect | POST | /api/v1/integrations/connect |
| Callback | POST | /api/v1/integrations/callback |
| Disconnect | POST | /api/v1/integrations/disconnect |
| Refresh | POST | /api/v1/integrations/refresh |
| Update Triage | PUT | /api/v1/integrations/triage |
| Run Triage | POST | /api/v1/integrations/triage/run |
| Sandbox | ||
| Create | POST | /api/v1/sandbox |
| Get | GET | /api/v1/sandbox/{sandboxId} |
| Update | PUT | /api/v1/sandbox/{sandboxId} |
| List | GET | /api/v1/sandbox |
| Delete | DELETE | /api/v1/sandbox/{sandboxId} |
| Scheduler Tasks | ||
| List | GET | /api/v1/scheduler/tasks |
| Create | POST | /api/v1/scheduler/tasks |
| Get | GET | /api/v1/scheduler/tasks/{taskId} |
| Update | PUT | /api/v1/scheduler/tasks/{taskId} |
| Delete | DELETE | /api/v1/scheduler/tasks/{taskId} |
| Snooze | POST | /api/v1/scheduler/tasks/{taskId}/snooze |
| Complete | POST | /api/v1/scheduler/tasks/{taskId}/complete |
| Start | POST | /api/v1/scheduler/tasks/{taskId}/start |
| Scheduler Schedules | ||
| List | GET | /api/v1/scheduler/schedules |
| Create | POST | /api/v1/scheduler/schedules |
| Get | GET | /api/v1/scheduler/schedules/{scheduleId} |
| Update | PUT | /api/v1/scheduler/schedules/{scheduleId} |
| Delete | DELETE | /api/v1/scheduler/schedules/{scheduleId} |
| Pause | POST | /api/v1/scheduler/schedules/{scheduleId}/pause |
| Resume | POST | /api/v1/scheduler/schedules/{scheduleId}/resume |
| Run | POST | /api/v1/scheduler/schedules/{scheduleId}/run |
Type Generation
Agent types are generated from Go using tygo:
cd backend && tygo generate
| Go Package | TypeScript Output |
|---|---|
blazi/common/agents | @elqnt/agents/models/agent-models.ts |
blazi/common/hub | @elqnt/agents/models/hub.ts |
blazi/common/integration | @elqnt/agents/models/integration.ts |
See Also
- AI Agents - Agent architecture guide
- @elqnt/chat - Chat integration with agents
- @elqnt/kg - Knowledge graph for agent memory
- @elqnt/api-client - HTTP client used internally