Warning
This technology has not yet undergone a formal audit. Please conduct your own due diligence and exercise caution before integrating or relying on it in production environments.
This agent detects House of Stake proposals, evaluates them using NEAR AI, and casts on-chain votes with veNEAR voting power delegated to it.
Built with the Shade Agent framework
- π LLM-Based Analysis: NEAR AI Cloud
- π Secure Execution: Phala (TEEs)
- π‘ Monitoring: Intear Events API
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.sh | shnpm i -g @neardefi/shade-agent-cliInstall Docker for Mac or Linux and set up an account.
Log in to docker, docker login for Mac or sudo docker login for Linux.
- Create NEAR testnet account:
near account create-account sponsor-by-faucet-service <example.testnet> autogenerate-new-keypair print-to-terminal network-config testnet createImportant
Be sure to record the account name and seed phrase!
- Get Phala Cloud API key:
- Sign up: https://cloud.phala.network/register
- Get API key: https://cloud.phala.network/dashboard/tokens
Phala Cloud is a service that offers secure and private hosting in a TEE using Dstack.
- Get NEAR AI Cloud API key:
- Sign up: https://cloud.near.ai
- Generate API key via dashboard
- Clone the repository:
git clone https://github.com/near-research/delegate-agent && cd delegate-agent- Install dependencies:
npm i- Configure environment:
cp .env.development.local.example .env.development.localEdit .env.development.local with your credentials:
NEAR_AI_CLOUD_API_KEY=your_near_ai_api_key
NEAR_ACCOUNT_ID=your_near_account_id
NEAR_SEED_PHRASE="your seed phrase"
NEXT_PUBLIC_contractId=ac-proxy.example.testnet
VOTING_CONTRACT_ID=vote.ballotbox.testnet
VENEAR_CONTRACT_ID=v.hos03.testnet
NEAR_RPC_JSON=https://rpc.testnet.fastnear.comSimply open the Docker Desktop application or run:
open -a Dockersudo systemctl start docker- Deploy proxy contract locally:
# Build contract
cd contract
docker run --rm -v "$(pwd)":/workspace pivortex/near-builder@sha256:cdffded38c6cff93a046171269268f99d517237fac800f58e5ad1bcd8d6e2418 cargo near build non-reproducible-wasm
# Deploy with Shade Agent CLI
cd ..
shade-agent-cli --wasm contract/target/near/contract.wasm --funding 5The CLI on Linux may prompt you to enter your sudo password.
- Start agent in another terminal:
npm run devThe app will be running here: https://localhost:3000
The proxy contract is in contract/:
src/lib.rs- Main contract logicsrc/traits.rs- Type definitions and external contract interfaces
-
Change the
NEXT_PUBLIC_contractIdprefix toac-sandbox.example.testnet -
Run the Shade Agent CLI
shade-agent-cli --wasm contract/target/near/contract.wasm --funding 5The CLI on Linux may prompt you to enter your sudo password.
The last URL the CLI outputs is where your app is hosted.
If your application is not working, head over to your App on Phala Dashboard and review the logs.
You can interact with your agent via the APIs directly or via a lightweight frontend contained in this repo.
For Phala deployments, swap localhost:3000 for your deployment URL.
To see the agent in action:
cd frontend
npm i
npm run devTo run the frontend with your Phala deployment, change the API_URL to Phala URL in your config.js file.
POST /api/vote
Content-Type: application/json
{
"proposalId": "0"
}POST /api/manual-vote
Content-Type: application/json
{
"proposalId": "0",
"vote": 0 # 0=For, 1=Against, 2=Abstain
}GET /api/vote/status
GET /api/vote/status/:proposalId
GET /api/agent-statusMIT