Artificial intelligence (AI) is rapidly transforming how businesses and developers approach user interactions, support, and data-driven insights. Eliza—an open-source, multi-agent AI framework—enables you to create autonomous AI agents with unique personalities and robust memory capabilities. From handling customer queries to analyzing documents, Eliza’s advanced features let you streamline operations and free up resources for more strategic tasks.
Before diving into Eliza specifically, let’s clarify what AI agents are. An AI agent is a software entity designed to autonomously perceive its environment, make decisions, and take actions to achieve specific goals. In practical terms:
These agents can range from simple FAQ bots that recognize keywords and provide static responses, to advanced systems that continuously learn, adapt, and offer personalized insights. With Eliza, you can build multi-agent solutions where each agent can specialize in a different domain—such as customer support, data analysis, or social media engagement—all under one unified framework.
Eliza is a TypeScript-based framework designed to help you create, manage, and orchestrate multiple AI agents. It provides high-level tools and abstractions so you can focus on designing personalities and capabilities without worrying about the underlying complexity. Key elements include:
One of the most straightforward yet powerful uses of Eliza is in customer support.
Scenario: A software company receives frequent inquiries ranging from feature requests to bug reports.
One of Eliza’s greatest strengths is its extensibility. You can add new functionality by creating plugins that define custom actions, evaluators, or providers. Below is an example of a simple F1 Drivers Plugin that calls an external API to retrieve data about Formula 1 drivers.
A plugin in Eliza typically exports:
actions
: New actions that your agents can trigger.evaluators
(optional): Logic to extract or evaluate information from messages.providers
(optional): Services that feed the agent with data or context.In this F1 Drivers Plugin, we define an action named F1_DRIVERS
to handle requests about driver information.
// f1DriversPlugin.ts
import {
composeContext,
elizaLogger,
ModelClass,
generateObjectDeprecated,
} from "@ai16z/eliza";
import {
Action,
HandlerCallback,
IAgentRuntime,
Memory,
Plugin,
State,
} from "@ai16z/eliza";
import { f1DriversTemplate } from "./templates";
const f1Drivers: Action = {
name: "F1_DRIVERS",
similes: ["FORMULA_1_DRIVERS", "RACING_DRIVERS", "FASTEST_DRIVERS"],
description: "Perform an API call to get the latest F1 drivers.",
validate: async (runtime: IAgentRuntime, message: Memory) => {
// Decide if this action should be triggered
return true;
},
handler: async (
runtime: IAgentRuntime,
message: Memory,
state: State,
options: any,
callback: HandlerCallback
) => {
elizaLogger.log("Composing state for message:", message);
state = (await runtime.composeState(message)) as State;
// Build the context using a custom prompt template
const f1DriversContext = composeContext({
state,
template: f1DriversTemplate,
});
// Use Eliza's utility to parse user input into a structured object
const content = await generateObjectDeprecated({
runtime,
context: f1DriversContext,
modelClass: ModelClass.LARGE,
});
elizaLogger.log("F1 drivers content before API call:", content);
// Make an external call to retrieve F1 driver data
const f1DriversResponse = await fetch(
`https://api.openf1.org/v1/drivers?driver_number=${content.driver_number}`
);
const f1DriversData = (await f1DriversResponse.json())[0] as {
broadcast_name: string;
driver_number: number;
};
elizaLogger.log("F1 drivers data:", f1DriversData);
// Return a structured reply via callback
if (callback) {
callback({
text: `Driver with number ${content.driver_number} is ${f1DriversData.broadcast_name}`,
content: {
success: true,
broadcast_name: f1DriversData.broadcast_name,
driver_number: f1DriversData.driver_number,
},
});
}
return true;
},
examples: [
[
{
user: "{{user1}}",
content: { text: "Who is driving with number 44?" },
},
{
user: "{{agentName}}",
content: {
text: "Here is what I found about the driver with number 44:",
action: "F1_DRIVERS",
},
},
],
[
{
user: "{{user1}}",
content: { text: "Who is driving with number 1?" },
},
{
user: "{{agentName}}",
content: {
text: "Here is what I found about the driver with number 1:",
action: "F1_DRIVERS",
},
},
],
],
};
export const f1DriversPlugin: Plugin = {
name: "f1Drivers",
description: "Search F1 drivers",
actions: [f1Drivers],
evaluators: [],
providers: [],
};
Template for Parsing User Input
// templates.ts
export const f1DriversTemplate = `Given the recent messages and driver number below:
{{recentMessages}}
{{driverNumber}}
Extract the following information about the requested driver:
- Driver number
Respond with a JSON markdown block containing only the extracted values. All fields are required:
\`\`\`json
{
"driver_number": number
}
\`\`\`
`;
F1_DRIVERS
action is called, verifying it should handle the request.f1DriversTemplate
.generateObjectDeprecated
transforms the user’s question into a structured object containing driver_number
.https://api.openf1.org/v1/drivers
, passing in the driver_number.broadcast_name
and driver_number
to the user.That’s it! You have successfully extended Eliza with a custom action that fetches real-time data. This pattern can be adapted for any external API—e-commerce product lookups, weather forecasts, or dynamic knowledge bases.
With Eliza, you can tailor AI agents to fit almost any use case—from customer support and community engagement to data analysis and research. Here are a few steps to help you get started or move forward:
By harnessing Eliza’s multi-agent system, advanced memory management, and extensibility, you can create intelligent and highly specialized assistants that revolutionize user engagement and streamline workflows. The sky’s the limit—go forth and build!
Author:
Bartosz Solka