/** * Quickstart Example - Basic Agent Operations * * This example demonstrates the basic usage of the Lyzr SDK: * - Creating an agent * - Running the agent * - Updating agent configuration * - Deleting the agent */ import { Studio } from '../src'; async function main() { // Initialize the SDK // Note: Reads LYZR_API_KEY from environment if not provided const studio = new Studio({ apiKey: process.env.LYZR_API_KEY }); try { // Create an agent console.log('Creating agent...'); const agent = await studio.createAgent({ name: 'QuickStart Bot', provider: 'gpt-4o', role: 'Helpful assistant', goal: 'Provide accurate and helpful information', instructions: 'Be concise and friendly. Explain concepts clearly.' }); console.log(`✓ Agent created with ID: ${agent.id}`); // Run the agent console.log('\nRunning agent...'); const response = await agent.run('What is machine learning in simple terms?'); console.log('\nAgent response:'); console.log(response.response); // Update agent configuration console.log('\n\nUpdating agent temperature...'); const updated = await agent.update({ temperature: 0.3, instructions: 'Be very concise. Answer in 1-2 sentences.' }); console.log('✓ Agent updated'); // Run again with updated config const response2 = await updated.run('What is deep learning?'); console.log('\nUpdated response (more concise):'); console.log(response2.response); // Delete the agent console.log('\n\nDeleting agent...'); await agent.delete(); console.log('✓ Agent deleted'); } catch (error) { console.error('Error:', error); process.exit(1); } } main();