Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ANative Lab EvoAgentX APIToolkit

From Leeroopedia
Knowledge Sources
Domains Tools, API_Integration
Last Updated 2026-10-21 00:00 GMT

Overview

Concrete tool for converting REST API endpoints into callable EvoAgentX Tools and Toolkits.

Description

The APITool class wraps a single REST API endpoint as a Tool with input specs, HTTP method, authentication, and response processing. The APIToolkit groups multiple `APITool` instances. Together they handle request formatting, authentication (API key, Bearer, OAuth), response parsing (JSON, text), and error handling. Supports GET/POST/PUT/DELETE methods. This enables agents to call any REST API as a tool — the framework auto-converts API specs to callable tools.

Usage

  • API integration: Wrap external REST APIs as EvoAgentX tools for agent workflows.
  • Financial tools: Used by `stock_tool.py` and `finance_tool.py` to create financial data tools.
  • Company information: Used by `basic_information_tool.py` for company research tools.

Code Reference

Source Location

Signature

class APITool(Tool):
    def __init__(
        self,
        name: str,
        description: str,
        inputs: Dict[str, Dict[str, Any]],
        required: Optional[List[str]] = None,
        endpoint_config: Dict[str, Any] = None,
        auth_config: Dict[str, Any] = None,
        function: Callable = None
    )

    def __call__(self, **kwargs) -> Any

class APIToolkit(Toolkit):
    def __init__(self, name: str = "APIToolkit", tools: List[APITool] = None)
    def add_api_tool(self, tool: APITool) -> None

Import

from evoagentx.tools.api_converter import APITool, APIToolkit

I/O Contract

Inputs

Name Type Required Description
name str Yes Tool name
description str Yes Tool description
inputs Dict[str, Dict] Yes Input parameter schema
endpoint_config Dict[str, Any] No API endpoint config (url, method, headers)
auth_config Dict[str, Any] No Authentication config (API key, Bearer, etc.)
function Callable No Custom execution function

Outputs

Name Type Description
__call__ returns Any Parsed API response (JSON dict or raw text)

Usage Examples

Wrap a REST API as a Tool

from evoagentx.tools.api_converter import APITool, APIToolkit

# 1. Define an API tool
weather_tool = APITool(
    name="get_weather",
    description="Get weather for a city",
    inputs={"city": {"type": "string", "description": "City name"}},
    required=["city"],
    endpoint_config={
        "url": "https://api.weather.com/v1/current",
        "method": "GET",
    },
    auth_config={"type": "api_key", "key": "YOUR_KEY", "header": "X-API-Key"},
)

# 2. Group into a toolkit
toolkit = APIToolkit(name="weather", tools=[weather_tool])

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment