Saltar al contenido principal

Function: useRunAgent()

useRunAgent(goal, options?): Promise<AgentResult>

Defined in: src/core/services/agent.service.ts:306

Runs the tool-calling agent loop against a goal until it emits a final answer or exhausts maxSteps.

Parameters

goal

string

The natural-language objective.

options?

AgentRunOptions = {}

Tools, step budget and completion options.

Returns

Promise<AgentResult>

An AgentResult with the final message and executed steps.

Example

import { useRunAgent } from "katanakit-js";

const result = await useRunAgent("Fix the type errors reported by tsc", {
tools: [
{
name: "runCommand",
description: "Runs a shell command and returns its output",
parameters: { type: "object", properties: { command: { type: "string" } } },
execute: (input) => shell.run(input.command),
},
],
maxSteps: 12,
});