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.
# 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
cd neoforge pip install -e ".[dev]"
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.
$ 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.
#!/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.
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.
- Write the script to
agents/summariser.pywith a PEP-723 header. - Register it in
agents/registry.yaml. - Test it directly:
echo '{"items":["foo","bar"]}' | uv run agents/summariser.py - Run it via agentctl:
agentctl exec summariser --input '{"items":["foo","bar"]}'
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.
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.
| Backend | Env value | When to use |
|---|---|---|
| file | file (default) | Local development; uses .neoforge/registry.cache.yaml |
| env | env | CI/CD pipelines; reads NF_SERVICE_<NAME> env vars |
| DNS SRV | dns | Service-mesh environments; queries _svc._tcp.neoforge.local |
| etcd | etcd | Production clusters; stores endpoints at /neoforge/services/<name> |
# 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.
| Command | Description |
|---|---|
| agentctl init [--force] | Bootstrap the current directory: creates agents/, workflows/, tests/, and a starter registry.yaml. Use --force to overwrite. |
| agentctl get agents | List 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:
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"}')
| Name | Type | Description |
|---|---|---|
| Registry | Pydantic model | Loads and validates agents/registry.yaml. Call Registry.load() or pass a custom path. |
| AgentMeta | Pydantic model | Represents a single agent entry: name, path, version, description, tags. |
| Resolver | Class | Facade over the discovery backends. Reads NEOFORGE_DISCOVERY to pick file / env / dns / etcd. |
| run_workflow | Function | Execute a YAML workflow spec synchronously. Args: spec_file: Path, input_json: str. |
| Workflow | Pydantic model | Parsed workflow DAG. Fields: name, steps, variables, description. |
| Step | Pydantic model | A single workflow step: name, agent, depends_on, input_mapping. |
Environment Variables
| Variable | Default | Description |
|---|---|---|
| NEOFORGE_DISCOVERY | file | Discovery backend: file, env, dns, or etcd. |
| NF_SERVICE_<NAME> | - | Service endpoint for the env backend, e.g. NF_SERVICE_MYAGENT=http://host:8080. |