Function: importAgent()
importAgent(
exportConfig):Agent
Defined in: packages/agentos/src/api/agentExport.ts:266
Imports an agent from an AgentExportConfig object.
For type: 'agent', calls the agent() factory with the stored config.
For type: 'agency', calls the agency() factory with the stored config
plus the sub-agent roster and strategy.
The imported agent is a fully functional instance with generate, stream,
session, and close methods.
Parameters
exportConfig
A validated export config object.
Returns
Agent
A new Agent instance constructed from the config.
Throws
If the config is invalid or missing required fields.
Example
const config = JSON.parse(fs.readFileSync('agent.json', 'utf-8'));
const agent = importAgent(config);
const reply = await agent.generate('Hello!');