Retrieve an agent
curl --request GET \
--url https://agp.eu.hcompany.ai/api/v2/agents/{agent_name} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyAgents
Retrieve an agent
Get the full specification of a single agent.
GET
/
api
/
v2
/
agents
/
{agent_name}
Retrieve an agent
curl --request GET \
--url https://agp.eu.hcompany.ai/api/v2/agents/{agent_name} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/agents/{agent_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyRetrieves the complete Agent object, including its full specification: environments, skills, instructions, and subagent configuration.
Returns the Agent object if the name is valid and you have access. Returns
404 otherwise.
Path parameters
string
required
The agent’s
name (e.g., h/web or my-custom-bot). Slash-containing names are supported.Query parameters
boolean
default:"false"
When
true, string references in environments, skills, and subagents are expanded into their full specs in the response. When false (the default), they are returned as stored, keeping catalog ids as plain strings.Examples
Retrieve an H catalog agent
curl "https://agp.eu.hcompany.ai/api/v2/agents/h/web-surfer-flash" \
-H "Authorization: Bearer $HAI_API_KEY"
from hai_agents import Client
client = Client()
agent = client.agents.get_agent(agent_name="h/web-surfer-flash")
print(agent.name)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const agent = await client.agents.getAgent({ agentName: "h/web-surfer-flash" });
console.log(agent.name);
Response
{
"name": "h/web-surfer-flash",
"description": "General-purpose web browsing agent. Navigates websites, extracts information, fills forms, and completes multi-step web tasks.",
"environments": [
{ "id": "h/browser", "kind": "web", "mode": {"type": "visual", "width": 1280, "height": 720}, "start_url": "https://www.bing.com" }
],
"model": null,
"instructions": null,
"skills": ["web-browse", "screenshot", "form-fill", "extract-data"],
"subagents": null,
"answer_format": null
}
Retrieve a custom agent
curl "https://agp.eu.hcompany.ai/api/v2/agents/price-checker" \
-H "Authorization: Bearer $HAI_API_KEY"
agent = client.agents.get_agent("price-checker")
const agent = await client.agents.getAgent({ agentName: "price-checker" });
Use case: inspect before using
Before using an agent in a session, you can inspect its capabilities:curl "https://agp.eu.hcompany.ai/api/v2/agents/$AGENT_NAME" \
-H "Authorization: Bearer $HAI_API_KEY" \
| jq '{name, description, environments, skills, subagents}'
agent = client.agents.get_agent(agent_name)
print(agent.description, agent.skills)
const agent = await client.agents.getAgent({ agentName });
console.log(agent.description, agent.skills);
Errors
| Status | Cause |
|---|---|
404 | Agent not found, or you don’t have access (e.g., querying another team’s custom agent). |
Was this page helpful?
⌘I