NeoForge Documentation

This is the archived reference for the NeoForge CLI toolkit. The original public package and source repository are unavailable. The commands below are preserved for existing installations and source checkouts.

NeoForge is a Unix-style multi-agent toolkit. Agents are single-file Python scripts; orchestration is declarative YAML; everything is pipe-able. This page covers installation, a quick-start walkthrough, and the full CLI and Python API reference.

Installation

Historical PyPI installation

NeoForge requires Python 3.12+ and uv for running individual agent scripts.

shell
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install NeoForge
pip install neoforge

From an existing source checkout

shell
cd neoforge
pip install -e ".[dev]"
Tip

After installation, the agentctl command is available on your PATH. Run agentctl --help to verify.

Quick Start

Bootstrap a NeoForge workspace in any directory and run the included hello-world workflow in under two minutes.

shell
$ mkdir my-agents && cd my-agents

# Scaffold workspace: creates agents/, workflows/, and agents/registry.yaml
$ agentctl init
✓ registry.yaml scaffolded
Workspace initialised.

# Verify agents are registered
$ agentctl get agents
NAME           PATH                    VERSION
hello-world    ./agents/hello_world.py   0.1.0

# Run a workflow
$ agentctl run workflows/hello-world.yaml
▶ greet (hello-world)
✓ greet complete

Core Concepts

Agents

An agent is a standalone Python script with an inline PEP-723 header. It reads JSON from stdin and writes JSON to stdout. No imports from NeoForge are required - the script is self-contained.

agents/hello_world.py
#!/usr/bin/env -S uv run --quiet
# /// script
# requires-python = ">=3.12"
# dependencies = []
# ///

import json, sys
from datetime import datetime, timezone

payload = json.load(sys.stdin)
name = payload.get("name", "world")
result = {"greeting": f"Hello, {name}!", "ts": datetime.now(timezone.utc).isoformat()}
sys.stdout.write(json.dumps(result))

Registry

Agents are declared in agents/registry.yaml. The registry maps a logical name to a script path, version, and optional metadata.

agents/registry.yaml
registry:
  version: "1.0"
  agents:
    - name: hello-world
      path: ./agents/hello_world.py
      version: 0.1.0
      description: Return greeting with timestamp

Your First Agent

Create a new agent that summarises a list of strings.

  1. Write the script to agents/summariser.py with a PEP-723 header.
  2. Register it in agents/registry.yaml.
  3. Test it directly: echo '{"items":["foo","bar"]}' | uv run agents/summariser.py
  4. Run it via agentctl: agentctl exec summariser --input '{"items":["foo","bar"]}'
Important

Agent scripts must be executable (chmod +x agents/summariser.py) when running via the exec command, because NeoForge launches them as subprocesses using the shebang line.

Workflow YAML

A workflow is a YAML file that declares a DAG of steps. Each step maps to a registered agent. NeoForge topologically sorts steps using depends_on and runs them sequentially, piping outputs into the environment for downstream steps.

workflows/example.yaml
name: example-pipeline
description: "Fetch data, then summarise it"
variables:
  limit: 10

steps:
  - name: fetch
    agent: data-fetcher
    depends_on: []
    input_mapping:
      limit: "{{ variables.limit }}"

  - name: summarise
    agent: summariser
    depends_on: [fetch]

Service Discovery

NeoForge supports three discovery backends, selected via the NEOFORGE_DISCOVERY environment variable.

BackendEnv valueWhen to use
filefile (default)Local development; uses .neoforge/registry.cache.yaml
envenvCI/CD pipelines; reads NF_SERVICE_<NAME> env vars
DNS SRVdnsService-mesh environments; queries _svc._tcp.neoforge.local
etcdetcdProduction clusters; stores endpoints at /neoforge/services/<name>
shell
# Use env-var discovery in CI
$ export NEOFORGE_DISCOVERY=env
$ export NF_SERVICE_SUMMARISER=http://summariser.svc:8080
$ agentctl discover summariser
http://summariser.svc:8080

CLI Reference

All commands are available via the agentctl binary installed with the package.

CommandDescription
agentctl init [--force]Bootstrap the current directory: creates agents/, workflows/, tests/, and a starter registry.yaml. Use --force to overwrite.
agentctl get agentsList all agents registered in agents/registry.yaml, showing name, path, and version.
agentctl run <spec> [--input JSON]Execute a YAML workflow. Optionally pass a JSON string as the initial workflow input.
agentctl exec <agent> [--input JSON]Execute a single agent directly, bypassing workflow orchestration. Writes agent stdout to the terminal.
agentctl logs <agent> [-f]Print the log file for an agent (written to .neoforge/logs/<agent>.log). Pass -f to follow in real time.
agentctl discover [service]Query the active discovery backend. If service is given, resolve its endpoint; otherwise list all known services.
agentctl start <agent>Start a long-running agent (placeholder - daemon mode in v0.2).
agentctl stop <agent>Stop a running agent (placeholder - daemon mode in v0.2).

Python API

NeoForge exposes a small importable surface for programmatic use:

python
from neoforge import Registry, AgentMeta, Resolver, run_workflow, Workflow, Step

# Load the registry
reg = Registry.load()           # reads agents/registry.yaml
agent = reg.get("hello-world")  # returns AgentMeta or None
print(agent.path, agent.version)

# Resolve a service endpoint
resolver = Resolver()           # respects NEOFORGE_DISCOVERY env var
endpoint = resolver.resolve("my-service")

# Run a workflow programmatically
from pathlib import Path
run_workflow(Path("workflows/hello-world.yaml"), '{"name": "Alice"}')
NameTypeDescription
RegistryPydantic modelLoads and validates agents/registry.yaml. Call Registry.load() or pass a custom path.
AgentMetaPydantic modelRepresents a single agent entry: name, path, version, description, tags.
ResolverClassFacade over the discovery backends. Reads NEOFORGE_DISCOVERY to pick file / env / dns / etcd.
run_workflowFunctionExecute a YAML workflow spec synchronously. Args: spec_file: Path, input_json: str.
WorkflowPydantic modelParsed workflow DAG. Fields: name, steps, variables, description.
StepPydantic modelA single workflow step: name, agent, depends_on, input_mapping.

Environment Variables

VariableDefaultDescription
NEOFORGE_DISCOVERYfileDiscovery backend: file, env, dns, or etcd.
NF_SERVICE_<NAME>-Service endpoint for the env backend, e.g. NF_SERVICE_MYAGENT=http://host:8080.