Skip to main content

AI Agent Generation Library — Agents Building Agents

Project description

logosai-forge

FORGE: An AI Agent Code Builder — agents that create, fix, and evolve other agents.

15 agentic AI agents collaborate to autonomously generate, improve, enhance, and self-evolve agent code.

Installation

pip install logosai-forge

Quick Start

import asyncio
from logosai_forge import ForgeClient

async def main():
    forge = ForgeClient()

    # Generate a new agent
    result = await forge.create_agent(
        "Calculate BMI from weight and height",
        test_cases=[{
            "input": {"weight_kg": 70, "height_m": 1.75},
            "expected": {"bmi": 22.9, "category": "normal"}
        }]
    )
    print(result.code)

    # Fix a broken agent
    result = await forge.improve_agent(agent_code, {
        "error_type": "logic_error",
        "error_message": "Condition is inverted — score>700 should approve",
        "test_input": {"credit_score": 750},
        "expected_output": {"decision": "approved"},
        "actual_output": {"decision": "denied"},
    })
    print(result.changes)

    # Add missing functions
    result = await forge.enhance_agent(
        existing_code,
        "Add multiply and divide methods"
    )
    print(result.added_functions)  # ['_multiply', '_divide']

asyncio.run(main())

Features

Method Purpose Example
create_agent() Generate new agent from query "Calculate shipping cost"
improve_agent() Fix bugs from failure feedback Inverted condition, wrong formula
enhance_agent() Add missing logic/functions "Add caching", "Add error handling"

ACP-Compliant Code Generation

Generated agents automatically follow the ACP Agent Interface Specification:

  • process(query, context) with query str/dict normalization
  • AgentResponse with content["answer"] (string)
  • File creation agents return file_path + file_name
  • Search agents return files list with absolute paths
  • Uses python-pptx, openpyxl, subprocess (mdfind, pdfgrep) when appropriate

Function-Level Improve

improve_agent() works at function granularity — same approach as create_agent() and enhance_agent():

  1. Extract functions from existing code
  2. Diagnose which function is broken (LLM analysis)
  3. Regenerate only the broken function via CodeGeneratorAgent
  4. Replace in original code (other functions untouched)
  5. Heal syntax with ErrorHealerAgent (3 experts)
  6. Validate through multiple execution paths (best-match selection)
  7. Falls back to whole-code LLM fix if function-level approach fails

Setup

Google API Key (required)

FORGE uses Gemini LLM for code generation. A Google API Key is required.

export GOOGLE_API_KEY="your-google-api-key-here"

Get your API key: https://aistudio.google.com/apikey

Requirements

  • Python 3.10+
  • Google API Key (GOOGLE_API_KEY environment variable)
  • LogosAI framework (optional, for agent execution)

License

Source code will be open-sourced after paper publication. Part of the LogosAI ecosystem.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logosai_forge-0.2.9-py3-none-any.whl (13.4 MB view details)

Uploaded Python 3

File details

Details for the file logosai_forge-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: logosai_forge-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 13.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for logosai_forge-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f1270e08bae6d78ec4f707a222c518bdb53ca474022ea4abd6fb19ec12c494e7
MD5 289de9c68f9892598084963eb55cdf97
BLAKE2b-256 bf9359bf815ef5ee95b2f377cec6db0fa167c6bbccbcb64146c8ba93c5e03a33

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page