Skip to main content

ObjectiveAI SDK

Project description

{ai} | ObjectiveAI

npm version Crates.io License: MIT

The agentic collective judgment harness.

Your agent doesn't have to decide alone. ObjectiveAI lets any agent call out to a swarm of models for collective judgment — routing decisions through recursive scoring trees that map arbitrary input into a vector of scores across every option. Functions are invented by agents, trained on data, and deployed as reusable decision infrastructure that gets better over time.

Website | API | Discord | npm | crates.io | Built with ObjectiveAI

What this is

An agent faces a choice. Instead of relying on a single model's judgment, it calls an ObjectiveAI Function — a recursive decision tree hosted as a JSON file. The Function fans out to a swarm of models, each with its own perspective. They vote. Their votes combine with learned weights. Out comes a vector of scores that sums to 1, one per option. The agent takes the highest-scoring option and moves on.

The scoring pipeline itself is a composition of tasks — vector completions, nested functions, map operations — that can be arbitrarily deep. A Function can call other Functions. An agent can invent new Functions. The whole system is content-addressed, version-tracked, and trainable.

Agent has a decision
    -> Calls ObjectiveAI Function
        -> Function fans out to swarm of models
            -> Each model votes across all options
            -> Votes combine with learned weights
        -> Returns scores: [0.42, 0.31, 0.18, 0.09]
    -> Agent takes the best option

Install

CLI

Install the pre-built binary with one command:

curl -fsSL https://raw.githubusercontent.com/ObjectiveAI/objectiveai/main/install.sh | bash
. "$HOME/.objectiveai/env"

Leaner, no-viewer build:

curl -fsSL https://raw.githubusercontent.com/ObjectiveAI/objectiveai/main/install.sh | bash -s -- --no-viewer
. "$HOME/.objectiveai/env"

Sourcing ~/.objectiveai/env puts objectiveai on PATH for the current shell. New shells pick it up automatically (the installer wires ~/.bashrc / ~/.zshrc to source the same file).

Supported platforms: Linux x86_64, Linux aarch64 (Raspberry Pi 4+, Graviton), macOS x86_64, macOS aarch64 (Apple Silicon), Windows x86_64. The installer drops the binary at ~/.objectiveai/objectiveai; the CLI self-updates on startup from GitHub Releases.

SDK

npm install objectiveai-sdk
[dependencies]
objectiveai-sdk = "2.0.7"

Core primitives

Agents

An Agent is a fully-specified configuration of a single upstream model — model identity, prompt structure, decoding parameters, output mode, provider preferences. Content-addressed via XXHash3-128, so the same configuration always produces the same ID.

Agents are stored as agent.json in Git repositories. Reference them by owner/repo@commit or define them inline.

Swarms

A Swarm is a collection of Agents used together for collective judgment. Each agent can have its own personality, temperature, output mode, and count. Weights control each agent's influence on the final score.

{
  "description": "Balanced judgment panel",
  "agents": [
    {
      "upstream": "openrouter",
      "model": "openai/gpt-4o",
      "output_mode": "json_schema",
      "prefix_messages": [
        { "role": "system", "content": "You are a rational skeptic. Ground every choice in logic." }
      ],
      "count": 2
    },
    {
      "upstream": "openrouter",
      "model": "anthropic/claude-sonnet-4-20250514",
      "output_mode": "tool_call",
      "suffix_messages": [
        { "role": "system", "content": "You are an intuitive thinker. Trust your instincts." }
      ],
      "count": 1
    }
  ],
  "weights": [0.6, 0.4]
}

Swarms are stored as swarm.json in Git repositories — shareable, version-tracked, and reusable across Functions.

Vector Completions

The core primitive. Give a swarm a prompt and a set of possible responses. Each agent votes for what it thinks is the best response. Votes combine with weights to produce a score vector that sums to 1.

Prompt: "Which approach best handles edge cases?"
Responses: ["defensive coding", "fuzzing", "formal verification", "property testing"]

-> Scores: [0.12, 0.28, 0.19, 0.41]

Probabilistic voting via logprobs

LLMs are inherently probabilistic — the sampler makes the final discrete choice, destroying information. ObjectiveAI bypasses the sampler entirely using logprobs to capture each model's full preference distribution.

If a model is 70% confident in option A and 30% in option B, we capture both signals rather than losing one to sampling. For large response sets exceeding logprobs limits, a prefix tree captures preferences in stages — the tree width matches the logprobs count (typically 20), enabling voting over hundreds of options while preserving probability information at each level.

Traditional: Model outputs "A" (loses the 30% signal for B)
ObjectiveAI: Model vote = [0.70, 0.30, 0.00, 0.00] (full distribution preserved)

Functions

Functions are composable scoring pipelines. Data in, scores out. They're recursive decision trees that can contain vector completions, nested function calls, and map operations — arbitrarily composed.

Input -> [Task 1: Vector Completion] -> Score
         [Task 2: Nested Function]   -> Score
         [Task 3: Mapped Function]   -> Score
      -> Weighted average -> Final score

Functions are hosted as function.json in Git repositories. Reference them by owner/repo:

objectiveai/sentiment-scorer

Functions produce either a scalar (single score in [0, 1]) or a vector (array of scores summing to 1). A scalar function that calls a vector function that calls another scalar function — all valid, all composable.

Profiles

ObjectiveAI doesn't fine-tune models. It learns weights.

Give it a dataset of inputs with expected outputs. ObjectiveAI executes repeatedly, computes loss, and adjusts the weights across your swarm to match. The result is a Profile — a learned weight configuration stored as profile.json that makes your Function's judgments converge on ground truth.

The resource graph

Resources reference each other inline or remote:

agent.json  <-  swarm.json  <-  profile.json      function.json
                 (agents)        (swarms+weights)   (tasks + input_schema)

At execution: function.json + profile.json  ->  scores

Function and profile are independent files — execution takes both and combines them. All remote references use (owner, repository, commit) triples. Pin a commit SHA for reproducibility, or omit it to resolve to latest. The retrieval system resolves the entire graph, caching and deduplicating fetches along the way.

Function invention

Agents can invent new Functions. The invention system takes a description of what you want to score, generates the input schema, designs the task tree, and produces a complete function.json — ready to deploy, train, and use. Recursive invention builds multi-level decision trees where each node is itself an invented Function.

An agent that can invent its own judgment criteria, train them on data, and deploy them for future use. That's the loop.

Concepts

Concept What it is
Agent A configured model with prompt, params, output mode. Content-addressed. agent.json.
Swarm A collection of Agents with weights. swarm.json.
Vector Completion Prompt + responses -> score vector that sums to 1.
Function Recursive scoring pipeline. Data in, scores out. function.json.
Profile Learned weights for a Function. Trained on data. profile.json.
Invention Agent-driven creation of new Functions.

Repo structure

objectiveai/
├── objectiveai-rs/             # Rust SDK (core crate: types, validation, compilation)
├── objectiveai-api/            # API server (self-hostable)
├── objectiveai-cli/            # CLI tool
├── objectiveai-mcp-cli/        # MCP server exposing the CLI as an MCP tool
├── objectiveai-mcp-filesystem/ # MCP filesystem server (Docker-injected into lab executions)
├── objectiveai-mcp-proxy/      # MCP multiplexing proxy (sidecar of objectiveai-api)
├── objectiveai-viewer/         # Local Tauri viewer (optional, embedded in CLI)
├── objectiveai-web/            # Web interface (production)
├── objectiveai-js/             # TypeScript SDK (npm: objectiveai)
├── objectiveai-rs-wasm-js/     # WASM bindings for browser/Node.js
├── objectiveai-py/             # Python package
├── objectiveai-rs-pyo3/        # Rust crate behind objectiveai-py
├── objectiveai-go/             # Go SDK
├── objectiveai-dotnet/         # .NET SDK (in progress)
├── objectiveai-rs-cffi/        # C FFI bindings (foundation for other langs)
└── objectiveai-json-schema/    # Generated JSON Schema files

Related

ObjectiveAI-claude-code-1

An autonomous Claude Code agent that invents and publishes ObjectiveAI Functions without human intervention. Uses the Agent SDK to create, test, and deploy new scoring pipelines.

License

MIT

Project details


Download files

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

Source Distribution

objectiveai_sdk-2.0.7.tar.gz (489.6 kB view details)

Uploaded Source

Built Distributions

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

objectiveai_sdk-2.0.7-cp310-abi3-win_amd64.whl (4.9 MB view details)

Uploaded CPython 3.10+Windows x86-64

objectiveai_sdk-2.0.7-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

objectiveai_sdk-2.0.7-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

objectiveai_sdk-2.0.7-cp310-abi3-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file objectiveai_sdk-2.0.7.tar.gz.

File metadata

  • Download URL: objectiveai_sdk-2.0.7.tar.gz
  • Upload date:
  • Size: 489.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for objectiveai_sdk-2.0.7.tar.gz
Algorithm Hash digest
SHA256 8d0a3367a0aff39f248c34902cc2b8fb85eec5e1b16a5934208bb9bb8754d33d
MD5 fa9ebd710b1a940bdf8803a1d5a8b3fa
BLAKE2b-256 d0d5f93d633ab53cf76a949c308c459019d4ad193b08411acc3174aa718fcc81

See more details on using hashes here.

File details

Details for the file objectiveai_sdk-2.0.7-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for objectiveai_sdk-2.0.7-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2b87cb7c1362a72b40bedb88ae3ebc3e246d080f64df6f6bea92acd3793463a9
MD5 b2f47de68c90623148402aac97388500
BLAKE2b-256 75aca7fcc4361c12b2809f8c2161679cd99fa8d880a8769d3a10ae48986e5c47

See more details on using hashes here.

File details

Details for the file objectiveai_sdk-2.0.7-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for objectiveai_sdk-2.0.7-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c00cbc0d5582cde09264fcb29f995dc3569c13de0cd386806ec62bd4c3f31404
MD5 ed59acfbfe481a55e497139b8954e812
BLAKE2b-256 07c9b2ba7a41674f7fbdc1d5742a1ab70f50f1c80674f2a81a9d4a9a289a7f19

See more details on using hashes here.

File details

Details for the file objectiveai_sdk-2.0.7-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for objectiveai_sdk-2.0.7-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aec67454d6080d3663d71a673dd5402be4a0a4ce5a01fb2ce9f51c5e2c4ee0a0
MD5 98e0d40d7d0e73f072eae0ae6b016cdb
BLAKE2b-256 ca0e06298f1a03019c1b8912ee237da1f1da23501c761567e622515a490b16ca

See more details on using hashes here.

File details

Details for the file objectiveai_sdk-2.0.7-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for objectiveai_sdk-2.0.7-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 72f8172f2b6d4fd916ae5b8cf203e0752bf626f61c9a0732850ffac752dbb600
MD5 ddf9415f59b16cc0808b402f4d9ad02b
BLAKE2b-256 a980b4b6f0347e665c5afaca580b7804b24c370d23417a3b0356ca7ccd74f6ac

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