Skip to main content

Active-ARC Agents

Project description

Active-ARC

A Python SDK for building agents that solve Active-ARC tasks.

Installation

pip install active-arc

Or with uv:

uv add active-arc

Quick Start

from active_arc import Agent, Swarm, SessionState, Grid

class MyAgent(Agent):
    MAX_QUERIES = 50

    def query(self, session: SessionState) -> Grid | None:
        """Choose an input grid to query the oracle. Return None to stop querying."""
        # Your logic here
        return [[1, 2], [3, 4]]

    def submit(self, session: SessionState) -> Grid:
        """Predict the output grid for session.test_input."""
        # Your logic here
        return session.test_input

# Run on tasks
swarm = Swarm(
    tasks=["007bbfb7"],
    agent_class=MyAgent,
)
swarm.run()

Configuration

Set your API key as an environment variable:

export ACTIVE_ARC_API_KEY="your_api_key_here"

Or create a .env file:

ACTIVE_ARC_API_KEY=your_api_key_here

Agent API

Agents must implement two methods:

Method Purpose
query(session) -> Grid | None Choose an input grid to query the oracle. Return None to stop querying and proceed to test phase.
submit(session) -> Grid Predict the output grid for session.test_input.

Session State

The SessionState object provides:

  • session.task_id - Current task ID
  • session.query_count - Number of queries made
  • session.queries - List of QueryRecord objects (input/output pairs)
  • session.test_input - The test input grid (available in test phase)
  • session.phase - Current phase (learning, test, or completed)

Optional Methods

Override these for custom reasoning metadata:

def get_query_reasoning(self, session: SessionState, query_input: Grid) -> Any:
    """Return metadata to store with this query."""
    return {"model": "gpt-4o", "tokens": 150}

def get_submit_reasoning(self, session: SessionState, answer: Grid) -> Any:
    """Return metadata to store with the submission."""
    return {"confidence": 0.85}

Swarm API

The Swarm class runs agents on multiple tasks:

from active_arc import Swarm, Random

# Using a built-in agent
swarm = Swarm(tasks=["007bbfb7", "00d62c1b"], agent="random")

# Using a custom agent class
swarm = Swarm(tasks=["007bbfb7"], agent_class=MyAgent)

# With explicit configuration
swarm = Swarm(
    tasks=["007bbfb7"],
    root_url="https://api.active-arc.com",
    agent_class=MyAgent,
    tags=["experiment-1", "v1.0"],
)

scorecard = swarm.run()
print(f"Solved: {scorecard.solved}/{scorecard.attempted}")

Built-in Agents

Random Agent

Makes random queries and returns the test input as the answer:

from active_arc import Swarm

swarm = Swarm(tasks=["007bbfb7"], agent="random")
swarm.run()

LLM Agent

Uses OpenAI's API to make intelligent queries:

from active_arc import Swarm

# Requires OPENAI_API_KEY environment variable
swarm = Swarm(tasks=["007bbfb7"], agent="llm")
swarm.run()

CLI Usage

Run agents from the command line:

# Run random agent on a specific task
python main.py -a random -t 007bbfb7

# Run with custom tags
python main.py -a random -t 007bbfb7 --tags "experiment,v1.0"

Data Types

from active_arc import (
    Grid,          # list[list[int]] - 2D grid of integers 0-9
    SessionState,  # Current session state
    SessionPhase,  # Enum: LEARNING, TEST, COMPLETED
    Scorecard,     # Results for all tasks
    TaskCard,      # Results for a single task
    QueryRecord,   # Input/output pair from a query
)

License

MIT License

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

active_arc-0.1.1.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

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

active_arc-0.1.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file active_arc-0.1.1.tar.gz.

File metadata

  • Download URL: active_arc-0.1.1.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.0

File hashes

Hashes for active_arc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 28a7e4f3150a435297a66772ce75abb0e4327ac3865a635ec10ff5a3e8039d6f
MD5 5db192ebad0b2f44f8add580ddaec0fa
BLAKE2b-256 7cbbc5aaf0eac1075b2928db7bc87c0ef63b8fb42c4dd6c142d4cb126d2cdc01

See more details on using hashes here.

File details

Details for the file active_arc-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: active_arc-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.0

File hashes

Hashes for active_arc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bddad24b77cdc0bb30cd5acafca0162bbef2dd562e8745af491d196f0022dd7a
MD5 b2be427d625aa6a3c720713263de400d
BLAKE2b-256 8ee24a05bdcc063c793c5376d585278300193e5ec1d1dab232031e4e4b875b8a

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