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 sourceProperties:
| Name | Type | Description |
|---|---|---|
spaceId | string | |
singleAgentId | string |
Methods:
executeWorkflow
View sourceExecute a complex task using the Workflow Engine
function executeWorkflow(goal: string): Promise<string>Parameters:
| Name | Type | Description |
|---|---|---|
goal | string |
getSpace
View sourceGetter for space (needed for external access)
function getSpace(): SpacegetSystemPrompt
View sourceOverride getSystemPrompt to include plan and artifacts context
function getSystemPrompt(context?: AgentContext): stringParameters:
| Name | Type | Description |
|---|---|---|
context | AgentContext (optional) |
generateText
View sourceGenerate text - uses new AI SDK-style signature
function generateText(options: {
messages: XMessage[];
system?: string;
[key: string]: unknown;
}): Promise<AgentResponse>Parameters:
| Name | Type | Description |
|---|---|---|
options | \{ messages: XMessage[]; system?: string; [key: string]: unknown; \} |
streamText
View sourceXAgent 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:
| Name | Type | Description |
|---|---|---|
options | object |
stop
View sourceStop current operation
function stop(): voidaddMessage
View sourceAdd message to queue (soft interrupt)
function addMessage(message: string, metadata?: Record<string, unknown>): stringParameters:
| Name | Type | Description |
|---|---|---|
message | string | |
metadata | Record<string, unknown> (optional) |
createPlan
View sourceCreate or update the space plan
function createPlan(goal?: string): Promise<Plan>Parameters:
| Name | Type | Description |
|---|---|---|
goal | string (optional) |
adaptPlan
View sourceAdapt the plan based on new information or user feedback
function adaptPlan(feedback: string): Promise<Plan>Parameters:
| Name | Type | Description |
|---|---|---|
feedback | string |
getSummary
View sourceGet XAgent summary
function getSummary(): Record<string, unknown>start
View sourceStatic factory to start a new space
function start(goal: string, options: XOptions = {}): Promise<XAgent>Parameters:
| Name | Type | Description |
|---|---|---|
goal | string | |
options | XOptions | (default: {}) |
resume
View sourceStatic factory to resume an existing space
function resume(spaceId: string, options: XOptions = {}): Promise<XAgent>Parameters:
| Name | Type | Description |
|---|---|---|
spaceId | string | |
options | XOptions | (default: {}) |
Interfaces
XOptions
View sourceProperties:
| Name | Type | Description |
|---|---|---|
model | string | (optional) |
storageRoot | string | (optional) |
defaultGoal | string | (optional) |
spaceId | string | (optional) |
singleAgentId | string | (optional) |
XStreamOptions
View sourceProperties:
| Name | Type | Description |
|---|---|---|
messages | XMessage[] | (optional) |
tools | Record<string, unknown> | (optional) |
artifactId | string | (optional) |
XAgentResponse
View sourceProperties:
| Name | Type | Description |
|---|---|---|
plan | Plan | (optional) |
taskResults | unknown[] | (optional) |
artifacts | unknown[] | (optional) |
preservedSteps | string[] | (optional) |
regeneratedSteps | string[] | (optional) |
planChanges | Record<string, unknown> | (optional) |