Skip to Content

x

Module: vibex/x

XAgent - The space’s conversational representative

X is the interface between users and their spaces. Each space has an X agent that acts as its representative. When you need to interact with a space, you talk to X. XAgent merges TaskExecutor and Orchestrator functionality into a single, user-friendly interface.

Classes

XAgent

View source

Properties:

NameTypeDescription
spaceIdstring
singleAgentIdstring

Methods:

executeWorkflow

View source

Execute a complex task using the Workflow Engine

function executeWorkflow(goal: string): Promise<string>

Parameters:

NameTypeDescription
goalstring

getSpace

View source

Getter for space (needed for external access)

function getSpace(): Space

getSystemPrompt

View source

Override getSystemPrompt to include plan and artifacts context

function getSystemPrompt(context?: AgentContext): string

Parameters:

NameTypeDescription
contextAgentContext (optional)

generateText

View source

Generate text - uses new AI SDK-style signature

function generateText(options: { messages: XMessage[]; system?: string; [key: string]: unknown; }): Promise<AgentResponse>

Parameters:

NameTypeDescription
options\{ messages: XMessage[]; system?: string; [key: string]: unknown; \}

streamText

View source

XAgent streamText - Orchestration Layer Responsibilities: History management, agent delegation, persistence

function streamText(options: { messages: XMessage[]; system?: string; spaceId?: string; metadata?: Record<string, unknown>; [key: string]: unknown; }): Promise<StreamTextResultType>

Parameters:

NameTypeDescription
optionsobject

stop

View source

Stop current operation

function stop(): void

addMessage

View source

Add message to queue (soft interrupt)

function addMessage(message: string, metadata?: Record<string, unknown>): string

Parameters:

NameTypeDescription
messagestring
metadataRecord<string, unknown> (optional)

createPlan

View source

Create or update the space plan

function createPlan(goal?: string): Promise<Plan>

Parameters:

NameTypeDescription
goalstring (optional)

adaptPlan

View source

Adapt the plan based on new information or user feedback

function adaptPlan(feedback: string): Promise<Plan>

Parameters:

NameTypeDescription
feedbackstring

getSummary

View source

Get XAgent summary

function getSummary(): Record<string, unknown>

start

View source

Static factory to start a new space

function start(goal: string, options: XOptions = {}): Promise<XAgent>

Parameters:

NameTypeDescription
goalstring
optionsXOptions(default: {})

resume

View source

Static factory to resume an existing space

function resume(spaceId: string, options: XOptions = {}): Promise<XAgent>

Parameters:

NameTypeDescription
spaceIdstring
optionsXOptions(default: {})


Interfaces

XOptions

View source

Properties:

NameTypeDescription
modelstring(optional)
storageRootstring(optional)
defaultGoalstring(optional)
spaceIdstring(optional)
singleAgentIdstring(optional)

XStreamOptions

View source

Properties:

NameTypeDescription
messagesXMessage[](optional)
toolsRecord<string, unknown>(optional)
artifactIdstring(optional)

XAgentResponse

View source

Properties:

NameTypeDescription
planPlan(optional)
taskResultsunknown[](optional)
artifactsunknown[](optional)
preservedStepsstring[](optional)
regeneratedStepsstring[](optional)
planChangesRecord<string, unknown>(optional)