Skip to main content

Function: importAgentFromJSON()

importAgentFromJSON(json): Agent

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

Imports an agent from a JSON string.

Parses the string and delegates to importAgent.

Parameters​

json​

string

JSON string containing an AgentExportConfig.

Returns​

Agent

A new Agent instance.

Throws​

If the JSON is malformed.

Throws​

If the parsed config fails validation.

Example​

const agent = importAgentFromJSON(fs.readFileSync('agent.json', 'utf-8'));