This repository contains various scripts and examples demonstrating how to interact with the Agentverse Hosting API for deploying, managing, and testing agents. It provides implementations using Node.js, curl, and Python.
.
├── js_deployer/ # Node.js implementations using fetch API
│ ├── add_secret_fetch.js
│ ├── deploy_agent_fetch.js
│ ├── js_deployer_docs.md # Detailed documentation for Node.js scripts
│ ├── test_deployment.js
│ ├── test_secret_verification.js
│ └── verify_secret_avctl.js
├── other/ # Implementations using curl and Python
│ ├── deploy_agent_curl.sh
│ ├── deploy_agent_guide.md # General deployment guide with curl/Python examples
│ ├── deploy_agent_requests.py
│ ├── get_logs.py
│ └── update_code.py
└── README.md # This file
The project is divided into two main approaches:
-
js_deployer: Contains Node.js scripts that utilize the built-infetchAPI (Node.js v18+) for interacting with the Agentverse Hosting API.deploy_agent_fetch.js: Deploys a new agent (create, update code, start).add_secret_fetch.js: Adds or updates a secret for an agent.test_deployment.js: An end-to-end test script for the deployment and secret addition workflow, including validation and cleanup.test_secret_verification.js: Tests secret updates by deploying an agent that logs the secret value and verifying logs usingavctl.verify_secret_avctl.js: Attempts to verify secret existence (by name) usingavctl.- See
js_deployer/js_deployer_docs.mdfor detailed usage instructions and API examples.
-
other: Contains examples usingcurland Python'srequestslibrary.deploy_agent_curl.sh: A shell script likely implementing thecurldeployment steps.deploy_agent_requests.py: A Python script likely implementing therequestsdeployment steps.get_logs.py: A Python script likely for fetching agent logs.update_code.py: A Python script likely focused on the code update step.- See
other/deploy_agent_guide.mdfor a general guide and specificcurl/Python examples.
Depending on the scripts you intend to use, you might need:
- Agentverse API Token: Obtainable from your Agentverse profile. Scripts may look for the
AGENTVERSE_API_TOKENenvironment variable or use hardcoded fallbacks (use environment variables for security). - Node.js: Version 18+ recommended for native
fetchsupport (forjs_deployerscripts). - curl: Command-line tool for transferring data with URLs (for
deploy_agent_curl.sh). - Python 3: With the
requestslibrary installed (pip install requests) (for Python scripts inother/). - jq: Command-line JSON processor (potentially required by
deploy_agent_curl.shfor robust JSON handling). - avctl: The Agentverse Command Line tool, installed and authenticated (
avctl auth login) (required byverify_secret_avctl.jsandtest_secret_verification.js).
- Code Payload Format: When updating agent code (
PUT /agents/{address}/code), the API expects thecodefield in the JSON payload to be a stringified JSON array of file objects, not the raw array itself. The provided scripts handle this correctly. - Stopping Agent Before Code Update: An agent must be stopped before its code can be updated. Ensure you include a "stop" step if updating an existing, running agent.
- Clone this repository.
- Ensure you have the necessary prerequisites installed for the scripts you want to use.
- Set up your Agentverse API Token (preferably via the
AGENTVERSE_API_TOKENenvironment variable). - Navigate to the relevant subdirectory (
js_deployerorother). - Consult the corresponding documentation (
js_deployer_docs.mdordeploy_agent_guide.md) for detailed instructions on configuring and running the scripts.