Skip to main content

Agent API

The SekuireAgent class is the core interface for interacting with LLMs.

Loading Agents

getAgent()

Load a single agent by name from sekuire.yml:

import { getAgent } from '@sekuire/sdk';

// Load agent by name
const agent = await getAgent('assistant');

// Load with custom config path
const agent = await getAgent('assistant', './config/sekuire.yml');

getAgents()

Load all agents from the config:

import { getAgents } from '@sekuire/sdk';

const agents = await getAgents();
const researcher = agents['researcher'];
const coder = agents['coder'];

Chat Methods

chat()

Send a message and get a complete response:

const response = await agent.chat('Hello, how are you?');
console.log(response);

// With options
const response = await agent.chat('Explain quantum computing', {
temperature: 0.5,
maxTokens: 500,
});

chatStream()

Stream response tokens for real-time output. See Streaming for details.


Conversation History

// Get history
const history = agent.getHistory();
console.log(`Messages: ${history.length}`);

// Clear history
agent.clearHistory();

// History format
// [
// { role: 'user', content: 'Hello' },
// { role: 'assistant', content: 'Hi there!' },
// ]

Agent Metadata

// Get provider info
const provider = agent.getLlmProvider(); // "openai"
const model = agent.getModelName(); // "gpt-4-turbo"
const tools = agent.getTools(); // ["calculator", "web_search"]

API Reference

MethodDescription
chat(message, options?)Send message, get response
chatStream(message, options?)Stream response tokens
getHistory()Get conversation history
clearHistory()Clear conversation
getLlmProvider()Get LLM provider name
getModelName()Get model name
getTools()Get registered tool names

Next Steps