When you run agents for many clients or users, you need to know which agent belongs to whom. molted.net gives every instance two kinds of labels.
Tags
Tags are key / value pairs. Use them for anything you want to sort or filter by:
| Key | Example values |
|---|---|
client |
acme, dupont-sarl |
plan |
starter, pro |
role |
sales-agent, support-agent, management-agent |
env |
production, staging |
user.email |
the email of the end user |
Rules:
- up to 50 tags per instance;
- keys up to 128 characters, values up to 256;
- keys starting with
molted:are reserved; - filters are exact and case-sensitive:
Acmeis notacme.
The tag role=management-agent has a meaning of its own: it marks the instance the dashboard opens as your
management agent.
ownerPath
The ownerPath is a path that places an instance in a tree, like folders:
/clients/acme
/clients/acme/sales
/clients/dupont
/internal/tests
Templates can carry an ownerPath too, so you can keep each client's templates next to its agents.
Neither tags nor ownerPath change who can access what. They are labels, not permissions.
Setting them
At creation, in the dashboard or with the API:
curl -X POST "https://api.<region>.molted.net/v2/instances" \
-H "Authorization: Bearer $MOLTED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"handle": "acme-sales",
"tenantId": "<your account id>",
"instanceType": "small",
"templates": [{ "name": "sales-agent" }],
"ownerPath": "/clients/acme",
"tags": [
{ "key": "client", "value": "acme" },
{ "key": "plan", "value": "pro" }
]
}'
Later, from the dashboard (Rename → Tags on the instance), by asking the management agent ("Add the tag plan=pro to the acme agent"), or with the API:
curl -X PATCH "https://api.<region>.molted.net/v2/instances/<instance id>/tags" \
-H "Authorization: Bearer $MOLTED_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "set": [{ "key": "plan", "value": "pro" }], "remove": ["trial"] }'
Changing tags adds, replaces or removes only the keys you name. The others stay.
Finding instances
List the instances that carry a tag:
curl "https://api.<region>.molted.net/v2/instances?tagKey=client&tagValue=acme" \
-H "Authorization: Bearer $MOLTED_API_KEY"
Or those under a path:
curl "https://api.<region>.molted.net/v2/instances?ownerPath=/clients/acme" \
-H "Authorization: Bearer $MOLTED_API_KEY"
tagKeyalone lists every instance that has the key, whatever its value.tagValueneedstagKey.- Combining a tag filter and
ownerPathreturns the instances that match both. - Results are paginated: pass
limit(up to 100) and thecursorreturned asnextCursor.
Ideas
- One tag
clientper client, and per-client costs with Resell and re-bill. - A tag
planto apply different usage caps by plan. - A tag
user.emailto find a user's agent from your own product's backend.