Hosting API
Welcome to the Hosting API documentaiton.
Overview
The hosting API allows you to manage your agents that are hosted by Agentverse. This involves creating new agents, updating the code of existing agents, starting and stopping agents, and getting logs of agents.
GET /v1/hosting/agents
POST /v1/hosting/agents
GET /v1/hosting/agents/:agentAddress
DELETE /v1/hosting/agents/:agentAddress
GET /v1/hosting/agents/:agentAddress/code
PUT /v1/hosting/agents/:agentAddress/code
POST /v1/hosting/agents/:agentAddress/start
POST /v1/hosting/agents/:agentAddress/stop
GET /v1/hosting/agents/:agentAddress/logs/latest
DELETE /v1/hosting/agents/:agentAddress/logs
GET /v1/hosting/usage/current
GET /v1/hosting/usage/:year/:month
GET /v1/hosting/usage/agents/:address/current
GET /v1/hosting/usage/agents/:address/:year/:month
Notable Objects
The Agent Object
- Name
name
- Type
- string
- Description
The given name of the agent. This is only a label that is used internally so users can keep track of their agents.
- Name
address
- Type
- string
- Description
The address of the agent. This is also the current public key of the agent.
- Name
running
- Type
- boolean
- Description
The current state of the agent.
true
if the agent is currently running,false
otherwise.
- Name
compiled
- Type
- boolean | null
- Description
The current code compilation status for the agent.
true
if the agent is compiled,false
if the compilation failed,null
if the agent has not been compiled yet.
- Name
revision
- Type
- integer
- Description
The current revision of the agent. Everytime an update is made to the agent, the revision is incremented.
- Name
code_digest
- Type
- string | null
- Description
The current digest of the code of the agent. Useful for determining if there have been code changes that need to be applied to the agent.
This value can be
null
if the agent has not been compiled yet.
- Name
wallet_address
- Type
- string | null
- Description
The wallet address that is associated with the agent. If a wallet address is not associated with the agent, this value will be
null
.
{
"name": "My first agent",
"address": "agent1q2dfhywtt8xazrdyzgap6gzdd7uhk4e0wmc3gjqt42esauaegcm8cuvclpj",
"running": false,
"compiled": true,
"revision": 7,
"code_digest": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"wallet_address": "fetch1dtwgzm6km4394erexa8ka05wva306wt9cc3mwk"
}
The AgentCode Object
- Name
digest
- Type
- string
- Description
Digest of the Agent's code.
- Name
code
- Type
- string
- Description
The Agent's code.
- Name
timestamp
- Type
- string, date-time
- Description
Timestamp of when the code was updated.
{
"digest": "66089877730d0501a4ff1efedf545279d5db120d0960f1ea6a1c00f834ff9530",
"code": "alice = Agent(name="alice", seed="sample seed")",
"timestamp": "2023-08-22T14:09:48.259000"
}
The AgentCodeDigest Object
- Name
digest
- Type
- string
- Description
Digest of the Agent's code.
{
"digest": "66089877730d0501a4ff1efedf545279d5db120d0960f1ea6a1c00f834ff9530"
}
The AgentLog Object
- Name
log_timestamp
- Type
- string, date-time
- Description
Timestamp of the log entry.
- Name
log_entry
- Type
- string
- Description
Log entry text.
{
"log_timestamp": "2023-08-22T14:09:48.259000",
"log_entry": "[INFO]: My count is: 0"
}
The NewAgent Object
- Name
NewAgent
- Type
- string
- Description
Name of the new Agent.
{
"name": "My first agent"
}
The UpdateAgentCode Object
- Name
Code
- Type
- string
- Description
The code for the new Agent.
{
"code": "alice = Agent(name="alice", seed="sample seed")"
}
Request and response library
Getting a list of your agents
Endpoint: GET /v1/hosting/agents
Request
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agents
Responses
[ { "name": "My first agent", "address": "agent1q2dfhywtt8xazrdyzgap6gzdd7uhk4e0wmc3gjqt42esauaegcm8cuvclpj", "running": false, "compiled": true, "revision": 7, "code_digest": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "wallet_address": "fetch1dtwgzm6km4394erexa8ka05wva306wt9cc3mwk" } ]
Creating a new agent
Endpoint: POST /v1/hosting/agent
Request
- Name
name
- Type
- string
- Description
- The given name of the agent. This is only a label that is used internally so users can keep track of their agents.
curl \
-X POST \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agent \
-d '{"name":"My newest agent"}'
Responses
{ "name": "My newest agent", "address": "agent1q2dfhywtt8xazrdyzgap6gzdd7uhk4e0wmc3gjqt42esauaegcm8cuvclpj", "running": false, "compiled": true, "revision": 1, "code_digest": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "wallet_address": "fetch1dtwgzm6km4394erexa8ka05wva306wt9cc3mwk" }
Look up specific Agent
Endpoint: GET /v1/hosting/agents/{agentAddress}
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agents/{agentAddress} \
-d '{"address":"agent1qtw0hy4kj65fv6j7qyv5mgdecq7c4qyqfqnjgc25wz4vf5h47l9l6m7qqtg"}'
Responses
[ { "name": "InitialTest", "address": "agent1qtw0hy4kj65fv6j7qyv5mgdecq7c4qyqfqnjgc25wz4vf5h47l9l6m7qqtg", "domain": "None", "running": false, "compiled": null, "revision": 0, "code_digest": null, "wallet_address": "fetch1mh0zmyddgcvspz7ye5zdrzjcfjtz54cgafak67" } ]
Delete Specified Agent
Endpoint: DELETE /v1/hosting/agents/{agentAddress}
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent
curl \
-X DELETE \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agents/{agentAddress} \
-d '{"address":"agent1q2dfhywtt8xazrdyzgap6gzdd7uhk4e0wmc3gjqt42esauaegcm8cuvclpj"}'
Responses
{}
Look up Agent code
Endpoint: GET /v1/hosting/agents/{agentAddress}/code
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agents/{agentAddress}/code \
-d '{"address":"agent1q2dfhywtt8xazrdyzgap6gzdd7uhk4e0wmc3gjqt42esauaegcm8cuvclpj"}'
Responses
[ { "digest": "4a8d510d546de8ff74aa27abaa7ebd95bf7876d8b31b265f6022c49d7b49cf45", "code": "Example code", "timestamp": "2023-08-22T12:49:45.856000+00:00" } ]
Update Agent Code for a specific Agnet
Endpoint: PUT /v1/hosting/agents/{agentAddress}/code
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X PUT \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agents/{agentAddress}/code \
-d '{"address":"agent1q2dfhywtt8xazrdyzgap6gzdd7uhk4e0wmc3gjqt42esauaegcm8cuvclpj"}'
Responses
[ { "digest": "66089877730d0501a4ff1efedf545279d5db120d0960f1ea6a1c00f834ff9530" } ]
Start a specific agent, identified by address.
Endpoint: POST v1/hosting/agents/{address}/start
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X POST \
-H Authorization: bearer <your token here> \
https://agentverse.aiv1/hosting/agents/{address}/start \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7"}'
Responses
[ { "name": "InitialTest", "address": "agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7", "domain": "None", "running": "True", "compiled": "False", "revision": "4", "code_digest": "66089877730d0501a4ff1efedf545279d5db120d0960f1ea6a1c00f834ff9530", "wallet_address": "None" } ]
Stop a specific agent, identified by address.
Endpoint: POST v1/hosting/agents/{address}/stop
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X POST \
-H Authorization: bearer <your token here> \
https://agentverse.aiv1/hosting/agents/{address}/stop \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7"}'
Responses
[ { "name": "InitialTest", "address": "agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7", "domain": "None", "running": "False", "compiled": "False", "revision": "4", "code_digest": "66089877730d0501a4ff1efedf545279d5db120d0960f1ea6a1c00f834ff9530", "wallet_address": "None" } ]
Get Latest Logs For Agent
Endpoint: GET /v1/hosting/agents/{address}/logs/latest
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agents/{address}/logs/latest \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7"}'
Responses
[ { "log_timestamp": "2023-08-22T14:09:48.259000", "log_entry": "[INFO]: My count is: 0" } ]
Delete the latest logs for an Agent
Endpoint: DELETE /v1/hosting/agents/{address}/logs/latest
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X DELETE \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/agents/{address}/logs/latest \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7"}'
Responses
{}
Get current Agent usage
Endpoint: GET /v1/hosting/usage/current
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/usage/current \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7"}'
Responses
[ { "year": "2023", "month": "8", "computation_time": "2291", "num_messages": "12", "num_message_bytes": "0", "num_agents": "4", "quota_computation_time": "3100000000", "quota_num_messages": "31000000", "quota_message_bytes": "63488000000", "quota_agents": "1000" } ]
Get Agent Usage for a specific year and month
Endpoint: GET /v1/hosting/usage/{year}/{month}
Request
- Name
address
- Type
- string
- Description
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/usage/{year}/{month} \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7"}'
Responses
[ { "year": "2023", "month": "8", "computation_time": "2291", "num_messages": "12", "num_message_bytes": "0", "num_agents": "4", "quota_computation_time": "3100000000", "quota_num_messages": "31000000", "quota_message_bytes": "63488000000", "quota_agents": "1000" } ]
Get Agent Usage for a specific year and month
Endpoint: GET /v1/hosting/usage/agents/{address}/current
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/usage/agents/{address}/current \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7"}'
Responses
[ { "year": "2023", "month": "8", "computation_time": "1230", "num_messages": "4", "num_message_bytes": "0" } ]
Get current Agent usage selected by address year and month
Endpoint: GET /v1/hosting/usage/agents/{address}/{year}/{month}
Request
- Name
address
- Type
- string
- Description
- The address of the agent. This is also the current public key of the agent.
curl \
-X GET \
-H Authorization: bearer <your token here> \
https://agentverse.ai/v1/hosting/usage/agents/{address}/{year}/{month} \
-d '{"address":"agent1qvnppqyhk4hu0q64tnfkspux8hpd9zayyclhafvkz5340uqx3ax02txfll7","year":"2023","month":"3"}'
Responses
[ { "year": "2023", "month": "8", "computation_time": "1230", "num_messages": "4", "num_message_bytes": "0" } ]