Skip to content

Instantly share code, notes, and snippets.

@bborn
Last active February 26, 2023 17:29
Show Gist options
  • Save bborn/5ef637eeca3330582ed73c63810955c9 to your computer and use it in GitHub Desktop.
Save bborn/5ef637eeca3330582ed73c63810955c9 to your computer and use it in GitHub Desktop.
BASE_URL=https://app.agent-hq.io/api/v1
API Documentation
------
The API endpoint /agents/AGENT_ID/run is used to run an Agent or ask it a question
Here's an example of a POST to the /agents/AGENT_ID/run endpoint
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY" -d '{
"input": "what is my name?",
"history": [
{"prompt": "I am bob", "response": "Hi bob! Nice to meet you."}
]
}' "BASE_URL/agents/AGENT_ID/run"
------
The API endpoint /teams/TEAM_ID/tools is used to list all the available tools
Here's an example of a GET to the /teams/TEAM_ID/tools endpoint
curl -X 'GET' \
'BASE_URL/teams/TEAM_ID/tools' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY'
------
The API endpoint /teams/TEAM_ID/tools is used to create a tool
Here's an example of a POST to the /teams/TEAM_ID/tools endpoint
curl -X 'POST' \
'BASE_URL/teams/TEAM_ID/tools' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"tool": {
"name": "API EXAMPLE TOOL",
"builtin_tool_name": "custom",
"func": "result = 'bruno is cool'",
"description": "Use this tool as an example",
"direct_return": true
}
}'
------
The API endpoint /agents/AGENT_ID/blocks is used to add a tool to an agent
Here's an example of a POST to the /agents/AGENT_ID/blocks endpoint, which adds a tool to the agent
curl -X 'POST' \
'BASE_URL/agents/AGENT_ID/blocks' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d ' {
"block": {
"blockable_id": "TOOL_ID",
"blockable_type": "Tool"
}
}'
------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment