Skip to main content

Function: importAgentFromYAML()

importAgentFromYAML(yamlStr, options?): Agent

Defined in: packages/agentos/src/api/agentExport.ts:412

Imports an agent from a YAML string.

Parses the string using the yaml npm package and delegates to importAgent.

Parameters​

yamlStr​

string

YAML string containing an AgentExportConfig.

options?​

ImportAgentOptions

Values for what the export redacted or replaced.

Returns​

Agent

A new Agent instance.

Throws​

If the YAML is malformed, the config fails validation, or it holds a value import cannot restore.

Example​

const agent = importAgentFromYAML(fs.readFileSync('agent.yaml', 'utf-8'));