본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)6.3k · #14240

create-atomic-tool

하는 일

AI 에이전트가 호출할 수 있는 타입 있는 입력과 출력을 가진 도구를 작성하는 방법을 설명합니다. 선택적 async 지원과 환경 변수의 비밀 값도 포함합니다. 에이전트에 기능을 더하려는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓개발자가 에이전트가 타입이 있는 도구를 통해 외부 API를 호출하기를 원할 때.
  • ✓개발자가 에이전트를 위해 간단한 계산기나 조회 도구를 원할 때.
  • ✓개발자가 도구가 속도 제한이나 데이터 누락 같은 명확한 오류를 보고하기를 원할 때.

스킬 링크

https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-tool/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-tool/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“도시의 날씨를 조회해 기온과 날씨 상태를 반환하는 도구를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 도구가 무엇을 하고 무엇에 의존하는지 묻고, 입력 및 출력 스키마, 설정 클래스, run 메서드를 작성합니다. 비밀 값은 환경 변수에서 읽습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Create an Atomic Agents Tool

A tool is a deterministic capability an agent can invoke. In Atomic Agents, every tool is a BaseTool[InSchema, OutSchema] subclass with a typed run() (and optional run_async()). The input/output schemas double as the tool's signature for the LLM and as Pydantic validation at runtime.

For deep material (MCP interop, distributing as a standalone package, advanced error patterns), the authority is ../framework/references/tools.md. This skill is the action-oriented path: clarify → write → verify.

When this fires vs the umbrella framework skill

  • This skill: the user is creating a specific tool — wrapping an API, building a calculator, scraping a page, querying a DB.
  • framework skill: questions about Atomic Agents in general, or the user is doing something other than authoring a tool.

Phase 1 — Clarify

Bundle into one message:

  1. What does the tool do? One sentence. This becomes the class docstring and feeds the LLM's tool description.
  2. Inputs and outputs. Names, types, units. If unclear, propose a schema pair and confirm.
  3. External dependencies. HTTP API? DB? Local computation only? If HTTP, what auth (API key env var, OAuth, none)?
  4. Sync, async, or both? If the rest of the project is async or the call is I/O bound, plan a run_async() alongside run().
  5. Failure modes. Rate limits, not-found, network errors — how should the agent see them? Default: typed failure output, not raised exceptions.

Skip any question already answered in context.

Phase 2 — Plan

Confirm the location and shape in one short block, then proceed:

  • File: <project>/tools/<tool_name>_tool.py (in-project tool — see ../framework/references/project-structure.md).
  • Schemas: <ToolName>Input, <ToolName>Output, optionally a typed failure shape.
  • Config: <ToolName>Config(BaseToolConfig) if the tool needs API keys, base URLs, timeouts, retries.
  • Sync vs async: pick one or both.
  • Error pattern: typed failure output (preferred) vs raise (only for programmer error).

Phase 3 — Implement

Skeleton — local computation, no config

from pydantic import Field
from atomic_agents import BaseIOSchema, BaseTool


class CalculatorInput(BaseIOSchema):
    """Arithmetic expression to evaluate."""
    expression: str = Field(..., description="Python-style arithmetic, e.g. '2 + 2 * 3'.")


class CalculatorOutput(BaseIOSchema):
    """Result of evaluating the expression."""
    result: float = Field(..., description="Numeric result.")


class CalculatorTool(BaseTool[CalculatorInput, CalculatorOutput]):
    """Evaluate simple arithmetic expressions safely."""

    def run(self, params: CalculatorInput) -> CalculatorOutput:
        import ast, operator as op
        ops = {ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul, ast.Div: op.truediv}
        def ev(n):
            if isinstance(n, ast.Constant): return n.value
            if isinstance(n, ast.BinOp): return ops[type(n.op)](ev(n.left), ev(n.right))
            raise ValueError("unsupported")
        return CalculatorOutput(result=ev(ast.parse(params.expression, mode="eval").body))

Skeleton — HTTP-backed, with config and typed failure

import os
import httpx
from typing import Literal, Optional
from pydantic import Field
from atomic_agents import BaseIOSchema, BaseTool, BaseToolConfig


class WeatherConfig(BaseToolConfig):
    api_key: str = Field(
        default_factory=lambda: os.environ.get("WEATHER_API_KEY", ""),
        description="API key for the weather service.",
    )
    base_url: str = Field(
        default="https://api.weather.example/v1",
        description="Base URL for the weather API.",
    )
    timeout: float = Field(default=15.0, ge=1.0, le=120.0, description="Request timeout (s).")


class WeatherInput(BaseIOSchema):
    """A request for current weather conditions."""
    city: str = Field(..., description="City name, e.g. 'Brussels'.")


class WeatherOutput(BaseIOSchema):
    """Current weather conditions, or a typed failure."""
    status: Literal["ok", "error"] = Field(..., description="Outcome code.")
    temperature_c: Optional[float] = Field(default=None, description="Temperature in Celsius.")
    summary: Optional[str] = Field(default=None, description="Human-readable summary.")
    error: Optional[str] = Field(default=None, description="Failure message when status='error'.")


class WeatherTool(BaseTool[WeatherInput, WeatherOutput]):
    """
자주 묻는 질문

API 키는 어디에 두나요?

스킬은 비밀 값을 코드에 쓰지 않고 환경 변수에서 읽는다고 말합니다.

async 지원이 필요한가요?

프로젝트가 async이거나 호출이 I/O를 기다릴 때만 필요합니다. 스킬은 async 버전을 추가할 수 있습니다.

오류는 어떻게 반환되나요?

스킬은 타입이 있는 실패 출력을 설명해, 오류가 발생했을 때 에이전트가 명확한 결과를 받도록 합니다.

상세 정보

작성자의 원본 설명

Build a `BaseTool[InSchema, OutSchema]` subclass — input/output schemas, `BaseToolConfig`, `run()` (and optional `run_async()`), env-driven secrets, typed failure outputs. Use when the user asks to "add a tool", "create a tool", "wrap an API as a tool", "build a `BaseTool`", "make a calculator/search/weather tool", or runs `/atomic-agents:create-atomic-tool`.

repo: Eigenwise/atomic-agents

인기도

GitHub 스타
6.3k
순위
#14240
라이선스
MIT
업데이트
2026. 10. 29.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬