मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)6.3k · #14240

create-atomic-tool

यह क्या करती है

यह बताती है कि टाइप्ड इनपुट और आउटपुट वाला टूल कैसे लिखें जिसे AI एजेंट चला सके, जिसमें वैकल्पिक async सपोर्ट और environment variables से गुप्त जानकारी लेना शामिल है। यह अपने एजेंट में क्षमताएँ जोड़ने वाले डेवलपर्स के लिए है।

कब इस्तेमाल करें

  • ✓जब डेवलपर चाहे कि एजेंट टाइप्ड टूल के ज़रिए किसी बाहरी API को कॉल करे।
  • ✓जब डेवलपर को एजेंट के लिए सरल कैलकुलेटर या खोज टूल चाहिए।
  • ✓जब डेवलपर को टूल से रेट लिमिट या गायब डेटा जैसी साफ़ त्रुटियाँ लौटानी हों।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-tool/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“ऐसा टूल बनाइए जो किसी शहर का मौसम देखे और तापमान व स्थिति लौटाए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह स्किल पूछती है कि टूल क्या करता है और किस पर निर्भर है, फिर इनपुट और आउटपुट schemas, एक config क्लास और run मेथड लिखती है, जिसमें गुप्त जानकारी environment variables से पढ़ी जाती है।

तकनीकी सामग्री (मूल 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 keys कहाँ रखी जाती हैं?

स्किल कहती है कि गुप्त जानकारी environment variables से पढ़ी जाती है, कोड में नहीं लिखी जाती।

क्या 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
अपडेट की गई
29/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

create-atomic-agent

6.3k

आपके एजेंट को टाइप्ड इनपुट और आउटपुट, सिस्टम प्रॉम्प्ट और चुने गए AI प्रदाता के साथ नया Atomic Agents एजेंट बनाने में मदद करती है।

AI और एजेंटएजेंट

create-atomic-context-provider

6.3k

आपके एजेंट को Atomic Agents एजेंट में context provider जोड़ने में मदद करती है, ताकि समय या मिली हुई दस्तावेज़ों जैसी ताज़ा जानकारी उसके प्रॉम्प्ट में दिखे।

AI और एजेंटएजेंट

create-atomic-schema

6.3k

आपके एजेंट को Atomic Agents एजेंट और टूल के लिए साफ़ फ़ील्ड विवरण वाले टाइप्ड इनपुट और आउटपुट schemas डिज़ाइन करने में मदद करती है।

कोडिंगसामान्य कोडिंग

framework

6.3k

आपके एजेंट को Atomic Agents Python फ़्रेमवर्क के साथ सही तरीके से काम करने में मदद करती है, जिसमें schemas, एजेंट, टूल, प्रॉम्प्ट और प्रदाता सेटअप शामिल हैं।

कोडिंगसामान्य कोडिंग

मिलती-जुलती skills