Skip to main content

Developer's Guide to AgentForge Plugins

Welcome to the official documentation for creating plugins for AgentForge. This guide will walk you through everything you need to know to build, test, and publish powerful tools on our marketplace.

By building a plugin, you're not just creating a tool; you're creating a new capability for thousands of AI agents, empowering users to automate their world in new and exciting ways.

Getting Started

1. Install the SDK

The AgentForge SDK is a Python package that provides the CLI and base classes for development. Install it via pip:

pip install agentforge-sdk

2. Initialize Your Project

Use the ag-cli tool to bootstrap a new plugin project:

ag-cli init my-weather-plugin

This command creates a new directory with a sample tool and your manifest file, agentforge.json.


The Manifest File (agentforge.json)

The manifest is a JSON file that defines your plugin. It's the central configuration file that the AgentForge platform reads to understand your plugin's capabilities, dependencies, and metadata.

{
  "manifestVersion": "1.0.0",
  "name": "Weather Reporter",
  "pluginId": "com.yourname.weather-reporter", 
  "version": "1.0.0", 
  "author": "Your Name <your.email@example.com>",
  "description": "A plugin to get real-time weather information.",
  "roleName": "Weather Specialist", 
  "personaPrompt": "You are a friendly weather assistant. You provide clear and concise weather updates.",
  "tools": [ ... ],
  "requirements": [ "requests" ],
  "configurationSchema": [ ... ]
}

Key fields include pluginId, personaPrompt, and tools.


Creating a Tool

A tool is a single, executable function that an AI agent can call. Your tool code should reside in the tools/ directory. Every tool class must inherit from BaseTool and implement a run method.

from agentforge_sdk.base import BaseTool, ToolContext

class GetCurrentWeatherTool(BaseTool):
    def run(self, **kwargs) -> str:
        location = kwargs.get("location")
        if not location:
            return "Error: Please specify a location."
            
        # Your API call logic here...
        return f"The weather in {location} is sunny and 25°C."

Using User Configuration

If your tool needs sensitive information like an API key, define it in the configurationSchema section of your manifest. This creates a secure form for the user.

In your manifest:

"configurationSchema": [
    {
        "name": "weather_api_key",
        "label": "Weather API Key",
        "type": "secret",
        "required": true,
        "help_text": "Your API key from weatherapi.com"
    }
]

Access this value in your tool's code via the ToolContext:

class GetCurrentWeatherTool(BaseTool):
    def __init__(self, context: ToolContext):
        super().__init__(context)
        self.api_key = self.context.get_config("weather_api_key")

    def run(self, **kwargs) -> str:
        # Use self.api_key in your request
        ...

Handling File Uploads

Your plugin can process files directly uploaded by users, such as text files, CSVs, or images. This is achieved using the special parameter type file_id.

Step 1: Declare a file_id Parameter in Your Manifest

"tools": [
    {
      "name": "analyze_csv",
      "description": "Analyzes the data in a user-uploaded CSV file.",
      "entrypoint": "tools.csv_analyzer:CSVAnalyzerTool",
      "parameters": [ 
        {
          "name": "csv_file_ref",
          "type": "file_id",
          "description": "The reference ID of the CSV file to analyze.",
          "required": true
        }
      ]
    }
]

Step 2: Receive the File Path in Your Tool

When a user invokes your tool with a file, the AgentForge platform automatically resolves the file ID to a secure, temporary file path on the server. Your tool's run method will receive this path as a simple string.

import csv

class CSVAnalyzerTool(BaseTool):
    def run(self, **kwargs) -> str:
        # The argument name "csv_file_ref" matches the manifest
        file_path = kwargs.get("csv_file_ref")

        if not file_path:
            return "Error: File reference was not provided."

        try:
            with open(file_path, 'r', encoding='utf-8') as f:
                reader = csv.reader(f)
                row_count = sum(1 for row in reader)
            
            return f"Successfully analyzed the CSV file. It contains {row_count} rows."
        except FileNotFoundError:
            return "Error: The specified file could not be found on the server."
        except Exception as e:
            return f"An error occurred while processing the file: {str(e)}"

Saving Output Files (Artifacts)

If your plugin generates new files (e.g., reports, processed CSVs, or images), you should save them using the get_artifacts_path method from the context. This ensures files are stored in the correct location and are accessible to the user.

Example:

class CSVAnalyzerTool(BaseTool):
    def run(self, **kwargs) -> str:
        output_path = self.context.get_artifacts_path("summary.txt")
        output_path.write_text("Analysis complete: 120 rows processed.", encoding="utf-8")
        return f"Report saved to {output_path}"

How It Works Behind the Scenes

  1. A user uploads a file, e.g., sales_report.csv.
  2. The system displays it in the chat with a unique Reference ID, e.g., [File: sales_report.csv, ID: 123].
  3. The user prompts: "Analyze the data in file 123".
  4. The LLM intelligently calls your tool: analyze_csv(csv_file_ref="123").
  5. The AgentForge platform intercepts this call. It looks up ID "123", finds its secure path (/tmp/path/to/sales_report.csv), and replaces the ID with the path.
  6. Your tool's run method is finally executed with kwargs={'csv_file_ref': '/tmp/path/to/sales_report.csv'}.

Validating & Packaging

Before uploading, always validate your manifest to catch common errors:

cd my-weather-plugin
ag-cli validate

Once validation passes, package your plugin into an .afp file, ready for upload:

ag-cli package

Release files for agentforge-sdk 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentforge-sdk 0.1.4
File Size Uploaded
agentforge_sdk-0.1.4.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentforge-sdk 0.1.4
File Interpreter ABI Platform
agentforge_sdk-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / agentforge_sdk-0.1.4.tar.gz

Download URL agentforge_sdk-0.1.4.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eb58c0bb048a312ecab1176dd8a40c76c0509207972706681d3feed9e66cb943
BLAKE2b-256 checksum
How to use checksums
99ad9a10ea089f2775174a622f6d8c69a0cd3c84f0f92fc70e402816b96c45a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / agentforge_sdk-0.1.4-py3-none-any.whl

Download URL agentforge_sdk-0.1.4-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39fa9f4a2889592a9a33330f5cc78ce5ac5d64465b7115e20ccff6f8bffd9dbc
BLAKE2b-256 checksum
How to use checksums
0f492edd4a3a4b996084880d78cdbc8a2d8ac0e117c6a1b9982d2a7d94f8119f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page