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" |
Self-Evolution Infrastructure (v0.2.16)
FORGE now detects duplicate agents, composes agents from reusable blocks, and extracts blocks from existing agents:
# Duplicate detection — avoid creating redundant agents
# (Automatic in V6 pipeline Stage 0)
result = await forge.create_agent("File search agent")
# → Detects existing file_agent, asks: create_new / extend_existing / cancel
REST API endpoints:
GET /api/blocks/search?query=&category=— search 339 reusable blocksGET /api/blocks/{block_id}— block detailPOST /api/blocks/compose— compose agent from selected blocksPOST /api/agents/check-duplicate— similarity analysis (4-dim: purpose/function/tags/pattern)POST /api/agents/{id}/extract-blocks— extract reusable functions from existing agent
Registry: 339 building blocks (157 templates + 169 slices + 13 extracted), unified adapter over existing FORGE assets.
Desktop Library Integration (v0.2.15)
Generated agents automatically use logosai.desktop for messaging and desktop control:
# Messaging channels (API-based)
result = await forge.create_agent("Telegram으로 메시지 보내는 에이전트")
# → Uses: from logosai.desktop.channels.telegram import TelegramChannel
# Desktop app control (GUI automation)
result = await forge.create_agent("카카오톡으로 메시지 보내는 에이전트")
# → Uses: from logosai.desktop.apps.kakaotalk import KakaoTalkController
Supported: Telegram, Slack, Discord, LINE, Teams (API) + KakaoTalk, Gmail, Notion (GUI)
Natural Language Query Parsing (v0.2.15)
Generated agents parse natural language into structured parameters via LLM:
"5 킬로그램을 파운드로" → _parse_query(LLM) → {"kilograms": 5.0} → business function
No code changes needed — _parse_query() is auto-generated with exact parameter hints from function specs.
ACP-Compliant Code Generation
Generated agents automatically follow the ACP Agent Interface Specification:
process(query, context)with query str/dict normalization + LLM parameter extractionAgentResponsewithcontent["answer"](string)- File creation agents return
file_path+file_name - Search agents return
fileslist with absolute paths - Uses python-pptx, openpyxl, subprocess (mdfind, pdfgrep) when appropriate
Function Slice Architecture
Agents are built by combining reusable function slices (174 slices), not writing entire code from scratch.
improve_agent() works at function granularity with a dedicated repair pipeline:
- Extract functions (AST-based, sync + async)
- Diagnose: LLM identifies broken function + root cause
- Repair:
_repair_function()fixes in-place (preserves original signature, not regenerate) - Replace in original code (other functions untouched)
- Validate: quick execution check + full test case comparison
- Auto-register fixed version to function registry
E2E accuracy: create_agent 98%, improve_agent 100% (3-run average).
Supports large agents (15KB+) with size-based strategy and dynamic timeouts.
Function Template Library
153 reusable function templates across 21 categories, including:
- API Channels: Telegram, Slack, Discord, LINE, Teams (
logosai.desktop.channels) - Desktop Apps: KakaoTalk, Gmail, Notion AppControllers (
logosai.desktop.apps) - File Ops: PDF/Excel/PPTX/DOCX read/write, Spotlight search
- Vision: Screen capture, Vision AI analysis, ReAct loop
- Browser: Chrome automation, form fill, JS injection
Domain Expert Review (v0.2.12)
Pipeline Stage 6.5 — after code assembly, a dynamically created domain expert reviews the generated code:
- Automatic domain detection (finance, healthcare, legal, etc.)
- Confidence gate: low confidence → expert feedback injected into retry loop
- Enable/disable via YAML config (
domain_review.enabled)
Function Intelligence
- Telemetry: per-function call count, success rate, error types (SQLite)
- Version Management: auto-increment versions, quality comparison, rollback
- Composition Learning: tracks which functions work well together (function pairs)
- Pattern-Based Generation: successful functions as reference for new domains
- Quality Gate: success rate < 0.70 → blocked from library admission
- Function Graph: unified ontology connecting templates, pairs, metrics, and type compatibility
Persistent Memory & Observability
- Learned patterns survive server restarts (SQLite-backed)
- All reasoning traces persisted and queryable (agent, time, success)
- Configuration via YAML (
config/agentic_pipeline.yaml) + env var overrides - Tool Registry for LLM/library dependency injection
- Context Manager for priority-based LLM token fitting
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_KEYenvironment variable) - LogosAI framework (optional, for agent execution)
License
Source code will be open-sourced after paper publication. Part of the LogosAI ecosystem.
Metadata
Release files for logosai-forge 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logosai_forge-0.5.0.tar.gz | 1.9 MB | Without provenance | Details for logosai_forge-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logosai_forge-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for logosai_forge-0.5.0-py3-none-any.whl |
Total release size: 3.9 MB
Release files / logosai_forge-0.5.0.tar.gz
| Download URL | logosai_forge-0.5.0.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aab85f4db8937f84809415676a29418f75d541f05e53c3ea6c0bdadaa3097c79
|
|
BLAKE2b-256 checksum How to use checksums |
fa553b5c1038b3ea0a141184f25f95ef0527d15c90b102e74eee3ee249bf50a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / logosai_forge-0.5.0-py3-none-any.whl
| Download URL | logosai_forge-0.5.0-py3-none-any.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e8ef55c6ddb6fc8f537f6b3f7006d85a21a0ca7ef7a707010d8cc190ab887d8
|
|
BLAKE2b-256 checksum How to use checksums |
238e024771bd7a48c329ead576ba150dee527963a3732ee22186e8e30369e466
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Security for logosai-forge 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.