HostExports
Defined in: gadgets/types.ts:860
Host llmist exports provided to external gadgets via ExecutionContext.
This ensures external gadgets use the same class instances as the host CLI, enabling proper tree sharing and avoiding the “dual-package problem” where different versions of llmist have incompatible classes.
Properties
Section titled “Properties”AgentBuilder
Section titled “AgentBuilder”AgentBuilder: typeof
AgentBuilder
Defined in: gadgets/types.ts:862
AgentBuilder for creating subagents with proper tree sharing
createGadget()
Section titled “createGadget()”createGadget: <
TSchema>(config) =>AbstractGadget
Defined in: gadgets/types.ts:866
createGadget for functional gadget definitions
Creates a gadget from a function (simpler than class-based approach).
This is perfect for simple gadgets where you don’t need the full power of a class. Parameters are automatically typed from the schema.
Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
Parameters
Section titled “Parameters”config
Section titled “config”CreateGadgetConfig<TSchema>
Configuration with execute function and schema
Returns
Section titled “Returns”Gadget instance ready to be registered
Examples
Section titled “Examples”import { z } from 'zod';import { createGadget } from 'llmist';
// Simple calculator gadgetconst calculator = createGadget({ description: "Performs arithmetic operations", schema: z.object({ operation: z.enum(["add", "subtract", "multiply", "divide"]), a: z.number().describe("First number"), b: z.number().describe("Second number"), }), execute: ({ operation, a, b }) => { // Parameters are automatically typed! switch (operation) { case "add": return String(a + b); case "subtract": return String(a - b); case "multiply": return String(a * b); case "divide": return String(a / b); } },});// Async gadget with custom name and timeoutconst weather = createGadget({ name: "weather", description: "Fetches current weather for a city", schema: z.object({ city: z.string().min(1).describe("City name"), }), timeoutMs: 10000, execute: async ({ city }) => { const response = await fetch(`https://api.weather.com/${city}`); const data = await response.json(); return `Weather in ${city}: ${data.description}, ${data.temp}°C`; },});// Use with agentconst agent = LLMist.createAgent() .withGadgets(calculator, weather) .ask("What's the weather in Paris and what's 10 + 5?");ExecutionTree
Section titled “ExecutionTree”ExecutionTree: typeof
ExecutionTree
Defined in: gadgets/types.ts:868
ExecutionTree for tree operations
Gadget()
Section titled “Gadget()”Gadget: <
TSchema>(config) => () =>GadgetBase<TSchema> &object
Defined in: gadgets/types.ts:864
Gadget factory for defining gadgets
Factory function to create a typed gadget base class.
The returned class automatically infers parameter types from the Zod schema, eliminating the need for manual type assertions in the execute method.
Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
Parameters
Section titled “Parameters”config
Section titled “config”GadgetConfig<TSchema>
Configuration with description and schema
Returns
Section titled “Returns”Base class to extend with typed execute method
():
GadgetBase<TSchema> &object
Returns
Section titled “Returns”GadgetBase<TSchema> & object
Examples
Section titled “Examples”import { z } from 'zod';import { Gadget } from 'llmist';
class Calculator extends Gadget({ description: "Performs arithmetic operations", schema: z.object({ operation: z.enum(["add", "subtract", "multiply", "divide"]), a: z.number().describe("First number"), b: z.number().describe("Second number"), }),}) { execute(params: this['params']): string { // params is automatically typed as: // { operation: "add" | "subtract" | "multiply" | "divide"; a: number; b: number } const { operation, a, b } = params;
switch (operation) { case "add": return String(a + b); case "subtract": return String(a - b); case "multiply": return String(a * b); case "divide": return String(a / b); } }}// With async executionclass WeatherGadget extends Gadget({ description: "Fetches weather for a city", schema: z.object({ city: z.string().min(1).describe("City name"), }), timeoutMs: 10000,}) { async execute(params: this['params']): Promise<string> { const { city } = params; // Automatically typed as { city: string } const weather = await fetchWeather(city); return `Weather in ${city}: ${weather}`; }}LLMist
Section titled “LLMist”LLMist: typeof
LLMist
Defined in: gadgets/types.ts:870
LLMist client
z:
__module
Defined in: gadgets/types.ts:872
Zod schema builder