Skip to content

agentMapper

@waldiez/react v0.4.8


const agentMapper: object

Defined in: src/waldiez/models/mappers/agent/agentMapper.ts:62

Agent Mapper This module provides functions to import and export agents, as well as to convert agents to and from node format. It handles the conversion of agent data to a format suitable for storage or transmission, and ensures that all necessary fields are included.

Type declarationΒΆ

asNode()ΒΆ

asNode: (agent, position?, skipLinks?) => WaldiezNodeAgent

Converts a WaldiezAgent instance to a WaldiezNodeAgent format.

ParametersΒΆ
agentΒΆ

WaldiezAgent

position?ΒΆ
xΒΆ

number

yΒΆ

number

boolean

ReturnsΒΆ

WaldiezNodeAgent

A WaldiezNodeAgent instance representing the agent.

exportAgent()ΒΆ

exportAgent: (agentNode, skipLinks?) => any

Exports an agent to a format suitable for storage or transmission.

ParametersΒΆ
agentNodeΒΆ

WaldiezNodeAgent

boolean

ReturnsΒΆ

any

An object representing the exported agent.

importAgent()ΒΆ

importAgent: (thing, agentId?) => WaldiezAgent

Imports an agent from a JSON object or similar structure.

ParametersΒΆ
thingΒΆ

unknown

agentId?ΒΆ

string

ReturnsΒΆ

WaldiezAgent

A WaldiezAgent instance representing the imported agent.

ThrowsΒΆ

Error if the input is invalid or missing required fields.