AGENTIKA
  • Blog
  • Learn
  • AI Tools
  • FAQ
Menu
Blog→Learn→AI Tools→FAQ→
AGENTIKA

Platform AI untuk UMKM Indonesia. Tools AI, tutorial otomatisasi, dan strategi side hustle.

Platform

  • Blog
  • Learn
  • FAQ
  • Tentang
  • Kontak
  • Kebijakan Privasi

Community

  • Twitter / X
  • GitHub

© 2026 AGENTIKA. All rights reserved.

HomeBlogLearnAI ToolsFAQ

Ai Automation

  • Pengantar Otomatisasi untuk UMKM
  • WhatsApp Business: Balasan Otomatis Tanpa Ribet
  • Google Sheets sebagai Database Order
  • Workflow Otomatis dengan Make.com & Zapier
  • Studi Kasus: Otomatisasi Order Warung Bu Siti

Ai Basics

  • Pengantar AI Modern
  • Prompt Engineering Fundamentals
  • LLM API Primer
  • Machine Learning Overview
  • AI Tools untuk Produktivitas
  • AI Agents dan Autonomous Systems
  • Data & Pipeline ML
  • RAG & Vector Search
  • Evaluasi Model AI
  • Etika & Responsible AI
  • Dasar API LLM: Menghubungkan Aplikasi dengan AI
  • Prompt Design Patterns untuk Aplikasi
  • Streaming Response dari LLM
  • Error Handling untuk LLM Applications
  • Optimasi Biaya LLM API
  • Multi-Provider LLM Architecture
  • Kapan Harus Fine-tuning Model AI?
  • Menyiapkan Dataset untuk Fine-tuning
  • Proses Training Fine-tuning LLM
  • Evaluasi Model Fine-tuned
  • Deploy Model Fine-tuned ke Produksi
  • Arsitektur RAG: Retrieval-Augmented Generation
  • Embeddings untuk RAG
  • Vector Database untuk RAG
  • Retrieval Strategies untuk RAG
  • RAG di Produksi: Monitoring dan Optimasi
  • Arsitektur AI Agent
  • Tool Use untuk AI Agent
  • Memory Systems untuk AI Agent
  • Multi-Agent Systems
  • Evaluasi AI Agent
  • Safety untuk AI Agent

No Code Tools

  • Pengantar No-Code untuk UMKM
  • Bikin Landing Page Tanpa Coding
  • Katalog Produk Online yang Mudah
  • Chatbot Sederhana Tanpa Coding
  • Form Order Online & Pembayaran

Prompt Engineering Umkm

  • Pengantar: Kenapa Prompt Penting untuk UMKM
  • Anatomi Prompt yang Menjual: Formula 5 Elemen
  • Template Prompt untuk Usaha Kuliner
  • Template Prompt untuk Fashion & Retail
  • Template Prompt untuk Usaha Jasa
Learn / Ai Basics / Lessons / Tool Use untuk AI Agent

Tool Use untuk AI Agent

Tools membuat agent bisa berinteraksi dengan dunia nyata: mencari web, mengirim email, mengupdate database, menjalankan code.

Function Calling (OpenAI)

const tools = [
  {
    type: "function",
    function: {
      name: "search_web",
      description: "Cari informasi di web",
      parameters: {
        type: "object",
        properties: {
          query: { type: "string", description: "Search query" },
          num_results: { type: "number", description: "Jumlah hasil (default 5)" },
        },
        required: ["query"],
      },
    },
  },
  {
    type: "function",
    function: {
      name: "read_file",
      description: "Baca isi file",
      parameters: {
        type: "object",
        properties: {
          path: { type: "string", description: "Path ke file" },
        },
        required: ["path"],
      },
    },
  },
];

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages,
  tools,
  tool_choice: "auto",
});

Tool Execution

async function handleToolCalls(response: any) {
  const toolCalls = response.choices[0].message.tool_calls;
  if (!toolCalls) return null;

  const results = [];

  for (const call of toolCalls) {
    const { name, arguments: args } = call.function;
    const parsed = JSON.parse(args);

    let result;
    switch (name) {
      case "search_web":
        result = await webSearch(parsed.query, parsed.num_results);
        break;
      case "read_file":
        result = await readFile(parsed.path);
        break;
      default:
        result = { error: "Unknown tool: " + name };
    }

    results.push({
      tool_call_id: call.id,
      role: "tool",
      content: JSON.stringify(result),
    });
  }

  return results;
}

Tool Registry Pattern

class ToolRegistry {
  private tools = new Map<string, Tool>();

  register(tool: Tool) {
    this.tools.set(tool.name, tool);
  }

  async execute(name: string, params: any): Promise<any> {
    const tool = this.tools.get(name);
    if (!tool) throw new Error("Tool not found: " + name);

    // Safety check
    if (!tool.isAllowed(params)) {
      throw new Error("Tool call not allowed: " + name);
    }

    return await tool.execute(params);
  }

  getDefinitions() {
    return Array.from(this.tools.values()).map((t) => t.toFunctionDef());
  }
}

// Register tools
const registry = new ToolRegistry();
registry.register(new WebSearchTool());
registry.register(new ReadFileTool());
registry.register(new SendEmailTool({ allowedRecipients: ["@company.com"] }));

Safety Guardrails

class SafeTool implements Tool {
  constructor(
    private inner: Tool,
    private rules: SafetyRules
  ) {}

  async execute(params: any): Promise<any> {
    // 1. Rate limiting
    await this.checkRateLimit();

    // 2. Parameter validation
    this.validateParams(params);

    // 3. Dry run check
    if (this.rules.dryRun) {
      return { dryRun: true, wouldExecute: this.inner.name, params };
    }

    // 4. Human approval (untuk destructive actions)
    if (this.rules.requiresApproval) {
      const approved = await requestHumanApproval(this.inner.name, params);
      if (!approved) return { rejected: "User rejected action" };
    }

    // 5. Execute
    const result = await this.inner.execute(params);

    // 6. Log
    await this.log(this.inner.name, params, result);

    return result;
  }
}

Common Tools

ToolFunctionSafety Level
web_searchCari di internetLow risk
read_fileBaca fileLow risk
write_fileTulis fileMedium risk
execute_codeJalankan kodeHigh risk
send_emailKirim emailHigh risk
database_writeUpdate databaseCritical

Vercel AI SDK Tool Use

import { tool } from "ai";
import { z } from "zod";

const weatherTool = tool({
  description: "Get weather for a location",
  parameters: z.object({
    location: z.string().describe("City name"),
  }),
  execute: async ({ location }) => {
    const response = await fetch("https://api.weather.com/" + location);
    return response.json();
  },
});

const result = await generateText({
  model: openai("gpt-4o"),
  messages,
  tools: { weather: weatherTool },
  maxSteps: 5, // Allow multi-step tool use
});

Latihan

Buat 3 tools (search, read, summarize) dan implementasikan agent yang bisa menggunakannya untuk meriset topik.

← Previous Lesson

Arsitektur AI Agent

Next Lesson →

Memory Systems untuk AI Agent

Sponsored

Eksplorasi Modul Lain

Belajar Terstruktur

Ikuti kurikulum AI step-by-step di modul Learn.

AI Tools Directory

Bandingkan tools AI untuk kebutuhan konten dan produktivitas.

Tanya AI tentang lesson ini

Tool Use untuk AI Agent

Tanya apa saja seputar materi lesson ini. Jawaban dibuat hanya dari isi lesson.