# NEXUS Agent Utilities (`aluminum_fonio/nexus-agent-utilities-apify`) Actor

Deterministic utilities for AI agents: JSON normalization and diff, line cleanup, text QA, and defensive code-risk scanning.

- **URL**: https://apify.com/aluminum_fonio/nexus-agent-utilities-apify.md
- **Developed by:** [Ilario Coppola](https://apify.com/aluminum_fonio) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / 1,000 utility calls

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## NEXUS Agent Utilities — Apify Actor

Deterministic utilities for AI agents, automation pipelines, CI/QA workflows, and machine-to-machine data processing.

The Actor runs without external paid AI APIs. Each operation is predictable, lightweight, and produces structured output in the default dataset.

### Operations

- `normalize_json` — recursively sorts object keys and normalizes strings for stable machine-to-machine comparisons.
- `clean_lines` — trims text, removes blank lines, and deduplicates lines while preserving order.
- `json_diff` — produces a path-based structural diff between two JSON objects.
- `text_qa` — checks duplicate lines, trailing whitespace, long lines, and control characters.
- `code_risk_scan` — performs a defensive static pattern scan for code-review signals. It never executes supplied code.

### Quick examples

#### Normalize JSON

```json
{
  "operation": "normalize_json",
  "data": {
    "z": " value ",
    "a": 1
  }
}
```

#### Clean lines

```json
{
  "operation": "clean_lines",
  "text": "alpha\n\n beta \nalpha\ngamma"
}
```

#### Compare JSON

```json
{
  "operation": "json_diff",
  "left": {"status": "draft", "count": 1},
  "right": {"status": "ready", "count": 2}
}
```

#### Text QA

```json
{
  "operation": "text_qa",
  "text": "first line\nsecond line  \nsecond line"
}
```

#### Defensive code-risk scan

```json
{
  "operation": "code_risk_scan",
  "code": "const input = process.env.USER_INPUT;"
}
```

### Good use cases

- AI-agent preprocessing and post-processing
- deterministic QA before an LLM call
- stable JSON normalization for caching, hashing, and regression tests
- text cleanup before ingestion or embeddings
- JSON change detection in automation pipelines
- lightweight defensive checks in CI/review workflows

### Pricing

NEXUS Agent Utilities uses Apify Pay Per Event.

- Utility call: **$0.20 per 1,000 calls**
- Actor start: **$0.00005**
- Apify platform usage is included in the event pricing shown in the Store

The primary billable event is `utility-call`, emitted only for completed deterministic utility operations.

### Output

Each successful operation writes one structured result to the default dataset. The output includes the selected operation, success state, and deterministic result payload.

### Design principles

- no external paid AI APIs
- no execution of user-supplied code
- deterministic behavior
- small, composable operations
- suitable for API, workflow, and agent integration
- limited Actor permissions

### API and automation

Use the Actor from Apify Console, the Apify API, tasks, schedules, or other Actors. The input schema exposes only the fields required by the selected operation.

### Support

If an operation produces an unexpected result, open an issue from the Actor page and include the operation name plus a minimal reproducible input. Do not include secrets or credentials.

# Actor input Schema

## `operation` (type: `string`):

Utility to execute.

## `data` (type: `object`):

Used by Normalize JSON.

## `text` (type: `string`):

Used by Clean lines and Text QA.

## `left` (type: `object`):

First object for JSON diff.

## `right` (type: `object`):

Second object for JSON diff.

## `code` (type: `string`):

Used by the defensive code-risk scan.

## Actor input object example

```json
{
  "operation": "normalize_json"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("aluminum_fonio/nexus-agent-utilities-apify").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("aluminum_fonio/nexus-agent-utilities-apify").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call aluminum_fonio/nexus-agent-utilities-apify --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,aluminum_fonio/nexus-agent-utilities-apify"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Nynpi4RFBCYUFxRbW/builds/A6KamwKZvSoHKvlT5/openapi.json
