Run Agent
This example demonstrates how to run an agent with a user message.
Run Agent Example
Run Agent Example
import 'dotenv/config';
import { Langbase } from 'langbase';
const langbase = new Langbase({
apiKey: process.env.LANGBASE_API_KEY!,
});
async function main() {
const response = await langbase.agent.run({
stream: false,
name: 'summary-agent',
model: 'openai:gpt-4.1-mini',
apiKey: process.env.LLM_API_KEY!,
instructions: 'You are a helpful assistant that help users summarize text.',
input: [
{
role: 'user',
content: 'Who is an AI Engineer?',
},
],
});
console.log('response: ', response.output);
}
main();