Skip to content

one-covenant/sandbox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitsec Subnet v2

Discord Chat License: MIT


Security Agent MVP Design

DiscordNetworkResearch



Design overview

Refer to the Bitsec docs for the latest documentation.

run Run the agent execution and evaluation locally via Docker (recommended).
run-no-docker Run the agent execution and evaluation locally as a script execute-agent Run the miner agent script locally on a single project.

./bitsec.py miner execute-agent

Agent file is in miner/agent.py

project source files are fetched and stored in projects/

projects/

change project id in miner/agent.py to the project you want to run

report = agent_main('projects/code4rena_secondswap_2025_02', inference_api=inference_api)

Platform API (Central Hub): A FastAPI server acting as the "subnet platform."

  • Endpoint: /upload/agent (POST) – Accepts a single agent.py file upload. Validate it's Python, uses only stdlib (simple regex check). Store in local folder with metadata (e.g., miner_id as filename).
  • Endpoint: /tasks (GET) – Returns a list of simple coding tasks (hardcoded: e.g., "Implement a function reverse_string(s: str) -> str").

Miner Script: A simple Python script or CLI.

  • Takes a task prompt.
  • Optionally uses LLM to generate code (e.g., prompt: "Write Python code for [task] as a function in agent.py").
  • Uploads generated agent.py to the API.

Validator Script: The core evaluator (run manually or via cron-like loop).

  • Pulls all submitted agents from local storage.

  • For each agent and task:Spin up a Docker container.

  • Copy agent.py into it, run python agent.py --task [prompt] (assume agents have a main function).

  • Capture output, run basic tests (e.g., assert reverse_string("hello") == "olleh").

  • Score: 0-100 based on tests passed (e.g., 100 if all pass).

  • Output rankings to console/JSON (simulate "emissions/rewards").

Sandbox Execution: Use Docker SDK to:

  • Create container: docker run -v [host_dir]:/app python:3.11-slim python /app/agent.py
  • Limit resources (CPU/time) to prevent hangs.
  • Handle errors gracefully (e.g., timeout after 10s).

Demo workflow:

  1. Miner: Generate/submit 2-3 sample agents (one good, one bad).
  2. Validator: Run eval, show scores like "Agent1: 100 (reward: 50 'TAO')".

Validator: Run eval, show scores like "Agent1: 100 (reward: 50 'TAO')".

In order to simplify the building of subnets, this template abstracts away the complexity of the underlying blockchain and other boilerplate code. While the default behavior of the template is sufficient for a simple subnet, you should customize the template in order to meet your specific requirements.

python -m venv env; source env/bin/activate;
pip install -U pip
pip install -r requirements.txt

License

This repository is licensed under the MIT License.

# The MIT License (MIT)
# Copyright © 2025 Security Subnet Foundation

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.

# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

About

sandbox for bitsec v2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.7%
  • Shell 3.9%
  • Dockerfile 0.4%