Agent
The Agent class wraps LLM calls with instructions, memory, and tool support.
Interactive Demo
Run an agent with a prompt
Code Example
agent-demo.ts
import { Agent, Brain, OpenAIProvider } from "@shivamsharma11/agent-sdk";
const brain = new Brain({
providers: [new OpenAIProvider({ apiKey: process.env.OPENAI_API_KEY })],
});
const agent = new Agent(
{
name: "assistant",
instructions: "You are a helpful assistant.",
model: "gpt-4o-mini",
provider: "openai",
},
{ brain }
);
const result = await agent.run({
input: "What is TypeScript?",
sessionId: "session-1",
});
console.log(result.text);
console.log(result.usage);