Type Definitions
TypeScript type definitions for API objects.
Core Types
Agent
typescript
interface Agent {
id: string
name: string
description: string | null
status: 'active' | 'paused' | 'disabled'
owner_email: string | null
created_at: string
updated_at: string
}AgentSettings
typescript
interface AgentSettings {
id: number
agent_id: string
// LLM Configuration
llm_provider: 'workers-ai' | 'openai' | 'anthropic'
llm_model: string
llm_temperature: number
llm_max_tokens: number
llm_system_prompt: string | null
// Calendar Settings
calendar_timezone: string
calendar_working_hours_start: string
calendar_working_hours_end: string
calendar_default_duration: number
// Workflow Settings
workflow_max_concurrent: number
workflow_default_timeout: number
workflow_retry_attempts: number
workflow_retry_delay: number
// Browser Settings
browser_headless: boolean
browser_viewport_width: number
browser_viewport_height: number
browser_user_agent: string | null
browser_default_timeout: number
updated_at: string
}Workflow Types
Workflow
typescript
interface Workflow {
id: string
agent_id: string
name: string
description: string | null
nodes: WorkflowNode[]
edges: WorkflowEdge[]
status: 'draft' | 'active' | 'paused' | 'archived'
created_at: string
updated_at: string
}WorkflowNode
typescript
interface WorkflowNode {
id: string
type: NodeType
position: { x: number; y: number }
data: Record<string, any>
}
type NodeType =
| 'trigger'
| 'if-else'
| 'switch'
| 'loop'
| 'wait'
| 'http-request'
| 'email'
| 'telegram'
| 'slack'
| 'discord'
| 'navigate'
| 'click'
| 'type'
| 'extract'
| 'screenshot'
| 'chat'
| 'code'
// ... more typesWorkflowEdge
typescript
interface WorkflowEdge {
id: string
source: string
target: string
sourceHandle?: string
targetHandle?: string
label?: string
}WorkflowExecution
typescript
interface WorkflowExecution {
id: string
workflow_id: string
agent_id: string
status: ExecutionStatus
input: Record<string, any> | null
output: Record<string, any> | null
error: string | null
started_at: string | null
completed_at: string | null
created_at: string
}
type ExecutionStatus =
| 'queued'
| 'running'
| 'complete'
| 'errored'
| 'terminated'Schedule Types
Schedule
typescript
interface Schedule {
id: string
agent_id: string
name: string
type: 'once' | 'delayed' | 'cron'
cron_expression: string | null
delay_seconds: number | null
next_run: string | null
last_run: string | null
callback_type: 'workflow' | 'function'
callback_id: string
status: 'active' | 'paused' | 'completed'
created_at: string
updated_at: string
}CalendarTask
typescript
interface CalendarTask {
id: string
agent_id: string
title: string
description: string | null
start_time: string
end_time: string
recurrence: 'none' | 'daily' | 'weekly' | 'monthly'
recurrence_days: number[] | null
workflow_id: string | null
status: 'pending' | 'completed' | 'cancelled'
created_at: string
updated_at: string
}Chat Types
ChatMessage
typescript
interface ChatMessage {
id: number
agent_id: string
conversation_id: string | null
role: 'user' | 'assistant' | 'system' | 'tool'
content: string
tool_calls: ToolCall[] | null
tool_call_id: string | null
metadata: Record<string, any> | null
created_at: string
}ToolCall
typescript
interface ToolCall {
id: string
type: 'function'
function: {
name: string
arguments: string
}
}Contact Types
Contact
typescript
interface Contact {
id: string
agent_id: string
name: string
email: string | null
phone: string | null
telegram: string | null
whatsapp: string | null
twitter: string | null
external_id: string | null
notes: string | null
tags: string[]
metadata: Record<string, any>
created_at: string
updated_at: string
}Gateway
typescript
interface Gateway {
id: string
agent_id: string
type: GatewayType
name: string
config: Record<string, any>
is_default: boolean
status: 'active' | 'inactive' | 'error'
created_at: string
updated_at: string
}
type GatewayType =
| 'email'
| 'telegram'
| 'whatsapp'
| 'slack'
| 'discord'
| 'sms'
| 'webhook'Browser Types
BrowserSession
typescript
interface BrowserSession {
id: string
agent_id: string
status: SessionStatus
headless: boolean
viewport: {
width: number
height: number
}
user_agent: string | null
browserbase_session_id: string | null
created_at: string
last_activity: string
}
type SessionStatus =
| 'active'
| 'paused'
| 'takeover'
| 'closed'
| 'error'BrowserAction
typescript
interface BrowserAction {
action: ActionType
selector?: string
url?: string
text?: string
key?: string
timeout?: number
// ... action-specific fields
}
type ActionType =
| 'navigate'
| 'click'
| 'type'
| 'press'
| 'screenshot'
| 'extract'
| 'scroll'
| 'wait'
| 'hover'
| 'select'
| 'upload'
| 'evaluate'Data Types
DataSource
typescript
interface DataSource {
id: string
agent_id: string
type: 'file' | 'url' | 'database' | 'api'
name: string
url: string | null
file_path: string | null
config: Record<string, any> | null
status: 'pending' | 'processing' | 'ready' | 'error'
created_at: string
updated_at: string
}DataChunk
typescript
interface DataChunk {
id: string
source_id: string
content: string
embedding_id: string | null
metadata: Record<string, any> | null
created_at: string
}SearchResult
typescript
interface SearchResult {
id: string
source_id: string
content: string
score: number
metadata: {
source_name: string
page?: number
section?: string
[key: string]: any
}
}Integration Types
MCPServer
typescript
interface MCPServer {
id: string
agent_id: string
name: string
url: string
auth: MCPAuth | null
headers: Record<string, string> | null
status: 'connected' | 'disconnected' | 'error'
created_at: string
}
interface MCPAuth {
type: 'bearer' | 'api-key' | 'oauth'
token?: string
key?: string
value?: string
// oauth fields
}Tool
typescript
interface Tool {
id: string
agent_id: string
name: string
description: string
type: 'api' | 'function' | 'mcp'
config: ToolConfig
created_at: string
updated_at: string
}
interface ToolConfig {
parameters: JSONSchema
handler?: string
endpoint?: string
mcp_server_id?: string
}State Types
AgentState
typescript
interface AgentState {
config: {
name: string
description: string
model: string
temperature: number
}
connectedClients: number
mcpServers: MCPServer[]
pendingSchedules: Schedule[]
}StateUpdate
typescript
interface StateUpdate {
type: 'client' | 'server' | 'sync'
timestamp: number
changes: Partial<AgentState>
}API Response Types
ListResponse
typescript
interface ListResponse<T> {
data: T[]
meta: {
total: number
limit: number
offset: number
has_more?: boolean
next_cursor?: string
}
}ErrorResponse
typescript
interface ErrorResponse {
error: {
code: string
message: string
details?: Record<string, any>
}
}