Typed Python agent to inspect and manage SudoStake vaults on NEAR. Runs locally in view‑only mode by default and can sign transactions when you provide keys.
The agent must be built once before interactive use. The build copies code into your local NEAR‑AI registry. After building, simply run nearai agent interactive --local (the CLI defaults to mainnet). Switch networks via your profile or set NEAR_NETWORK inline.
- Python 3.9+ and
pip - Git
jq(for the build script)- Python package
semver(for version bumping) - macOS/Linux shell (Bash)
- Clone and create a virtualenv
git clone <your-fork-or-repo-url>cd sudostake_agent_nearpython3 -m venv .venv && source .venv/bin/activate
- Install dependencies (includes the
nearaiCLI)pip install -r requirements.txt
- Install build prerequisites
pip install semver- macOS:
brew install jq• Debian/Ubuntu:sudo apt install -y jq
- Build the agent (copies into
~/.nearai/registry/...)chmod +x agent/build.sh && ./agent/build.sh patch
- Run
- View‑only:
nearai agent interactive --local - With signing:
source ~/.near_agent_profile && nearai agent interactive --local - Testnet inline override:
NEAR_NETWORK=testnet nearai agent interactive --local
- View‑only:
Tip: In the REPL, type help to see available commands.
Create a single profile with your credentials and preferred network.
Profile template (~/.near_agent_profile)
# ~/.near_agent_profile
export NEAR_NETWORK=mainnet # or testnet
export NEAR_ACCOUNT_ID=<your-account>
export NEAR_PRIVATE_KEY=<ed25519:...>
Usage: source ~/.near_agent_profile && nearai agent interactive --local
- Run tests:
pytest -q - Edit code under
agent/src - Rebuild:
./agent/build.sh patch(orminor|major) - Run:
nearai agent interactive --local(uses the latest build)
- Add
.mdfiles underagent/docs/ - Ensure
nearaiCLI is configured - Build:
python agent/jobs/init_vector_store_job.py
agent/src— entrypoint (agent.py), helpers, toolsagent/tests— pytest suiteagent/jobs— ops jobs (e.g., vector store)agent/build.sh— build and versioningagent/metadata.json— stamped during build
- Initialization/network
nearaidefaults to mainnet; use a profile or inlineNEAR_NETWORKto switch.- This project uses built-in RPC URLs per network and does not accept custom RPC overrides.
- CLI not found
- Activate venv and reinstall deps:
source .venv/bin/activate && pip install -r requirements.txt.
- Activate venv and reinstall deps:
- Build errors (jq/semver)
pip install semverand installjqvia your package manager.
- No docs found when building vector store
- Add Markdown files under
agent/docs/first.
- Add Markdown files under
- Keep
NEAR_PRIVATE_KEYsecret; never commit it. - Prefer profile files and local shell secret management.
- Only the following env vars are honored:
NEAR_NETWORK(mainnet|testnet)NEAR_ACCOUNT_IDNEAR_PRIVATE_KEY
- All other settings are static in the app and not overridden by env vars.