Skip to main content

Function: importAgentFromYAML()

importAgentFromYAML(yamlStr): Agent

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

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.

Returns

Agent

A new Agent instance.

Throws

If the YAML is malformed or the config fails validation.

Example

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