Tools and knowledge
Knowledge answers a question with one answer. A tool answers one that depends on who is asking.
Updated
Two ways to give an agent something it doesn't otherwise have. Which one you want depends on a single question: is the answer the same for everybody?
Knowledge answers a question that has one answer. Opening hours, the returns policy, whether you service e-bikes. A tool answers a question whose answer depends on who is asking. Where their order is, whether that slot is free.
Knowledge
cURL
curl -X POST https://api.voxcore.net/api/v1/orgs/<org_id>/agents/<agent_id>/knowledge/ \
-H "Authorization: Bearer vox_sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"title": "Opening hours",
"kind": "text",
"body": "Ten to six Tuesday through Saturday. Closed Sunday and Monday."
}'Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
source = httpx.post(
f"{BASE}/api/v1/orgs/{ORG}/agents/{agent_id}/knowledge/",
headers=AUTH,
json={
"title": "Opening hours",
"kind": "text",
"body": "Ten to six Tuesday through Saturday. Closed Sunday and Monday.",
},
).json()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
# Knowledge hangs off an agent, so it goes through request() rather than
# a top-level collection.
source = vox.request(
"POST",
f"/api/v1/orgs/{vox.org}/agents/{agent_id}/knowledge/",
json={
"title": "Opening hours",
"kind": "text",
"body": "Ten to six Tuesday through Saturday. Closed Sunday and Monday.",
},
)kind is text (the default), qa for a
question-and-answer pair, or url for a web page. A url
source needs source_url; anything else needs body.
Titles are unique per agent. enabled defaults to true, and only
enabled sources get frozen into a published version.
Deleting a knowledge source is a soft delete, so a version published while it existed stays reconstructable.
Tools
cURL
curl -X POST https://api.voxcore.net/api/v1/orgs/<org_id>/agents/<agent_id>/tools/ \
-H "Authorization: Bearer vox_sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"name": "order_status",
"description": "Look up an order by its number.",
"parameters_schema": {
"type": "object",
"properties": {"order_number": {"type": "string"}},
"required": ["order_number"]
},
"http_method": "POST",
"endpoint_url": "https://example.com/api/orders/lookup",
"auth_header_name": "X-Api-Key",
"auth_header_value": "...",
"timeout_ms": 4000,
"speak_during_execution": "Let me pull that up."
}'Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
tool = httpx.post(
f"{BASE}/api/v1/orgs/{ORG}/agents/{agent_id}/tools/",
headers=AUTH,
json={
"name": "order_status",
"description": "Look up an order by its number.",
"parameters_schema": {
"type": "object",
"properties": {"order_number": {"type": "string"}},
"required": ["order_number"],
},
"http_method": "POST",
"endpoint_url": "https://example.com/api/orders/lookup",
"auth_header_name": "X-Api-Key",
"auth_header_value": os.environ["ORDER_LOOKUP_KEY"],
"timeout_ms": 4000,
"speak_during_execution": "Let me pull that up.",
},
).json()Python (voxcore)
import os
from voxcore import Voxcore
vox = Voxcore()
tool = vox.request(
"POST",
f"/api/v1/orgs/{vox.org}/agents/{agent_id}/tools/",
json={
"name": "order_status",
"description": "Look up an order by its number.",
"parameters_schema": {
"type": "object",
"properties": {"order_number": {"type": "string"}},
"required": ["order_number"],
},
"http_method": "POST",
"endpoint_url": "https://example.com/api/orders/lookup",
"auth_header_name": "X-Api-Key",
"auth_header_value": os.environ["ORDER_LOOKUP_KEY"],
"timeout_ms": 4000,
"speak_during_execution": "Let me pull that up.",
},
)| Field | Default | Notes |
|---|---|---|
name | required | Letters, numbers and underscores only. Unique per agent. |
parameters_schema | none | A JSON Schema object. This is what the model is told the tool takes. |
http_method | POST | Also GET, PUT, PATCH. |
endpoint_url | required | Must start https://. A tool call carries conversation data to your server. |
auth_header_value | none | Write-only. It is never returned; the read payload carries has_auth instead. |
timeout_ms | 4000 | The caller is on the phone while this runs. |
speak_during_execution | none | What to say so the line is not silent. |
enabled | true | Only enabled tools go into a published version. |
On update, sending auth_header_value as an empty string means
"leave the credential alone" rather than "clear it". That way a console form
which cannot show the secret can still save the rest of the row.
Both creates above are dashboard work today. Key-authenticated writes come
back 403 or 500.