Agents
Create an agent
Create a reusable agent configuration in your catalog.
POST
/
api
/
v2
/
agents
from hai_agents import Client
client = Client()
agent = client.agents.create_agent(
name="my-web-agent",
description="Custom web researcher",
environments=[
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com",
}
],
)
print(agent.name)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const agent = await client.agents.createAgent({
body: {
name: "my-web-agent",
description: "Custom web researcher",
environments: [
{
id: "browser",
kind: "web",
mode: { type: "visual", width: 1280, height: 720 },
startUrl: "https://news.ycombinator.com",
},
],
},
});
console.log(agent.name);
curl -X POST https://agp.eu.hcompany.ai/api/v2/agents \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "my-web-agent",
"description": "Custom web researcher",
"environments": [
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com"
}
]
}'
{
"name": "my-web-agent",
"description": "Custom web researcher",
"environments": [
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com"
}
],
"model": null,
"reasoning_effort": null,
"instructions": null,
"subagents": null,
"skills": null,
"answer_format": null,
"tools": null
}
Behavior
Reference it byname (for example "agent": "my-research-bot") when creating a session. Its environments, skills, and subagents come from the stored configuration.
Query parameters
string
A note stored on revision 1, such as what the agent is for. Up to 500 characters. Shown by List revisions.
Request body
string
required
Catalog identifier, kebab-case with an optional single
org/ namespace prefix. The h/ prefix is reserved for H’s catalog (rejected with 403). Any other name creates a custom agent, private to your organization. 1 to 127 characters, immutable after creation.array
required
The surfaces the agent acts on, at most one per kind. Each item is a catalog ID string or an inline environment spec, such as a Browser. The field is always required, but it may be empty (
[]) only when the agent has subagents (a pure manager) or custom tools.string
Holo model that runs the agent: any Holo model ID listed in Models, for example
holo4-35b-a3b. Omit for the default, holo4-27b (stored as null).string
How long the model thinks before each step:
disabled (thinking off), low, medium, or xhigh. More effort is slower and more careful. Omit for medium on Holo4 models, and the model’s default thinking on Holo3 and Holo3.1. Only holo4-27b has effort levels: the other models honor just disabled.string
Steering text appended to the system prompt.
object
A JSON Schema the final answer must conform to. When set, the agent returns structured output instead of free-form text. Callers can set or override it per session with
overrides.object[]
Custom tools the agent can call from your own code.
string
required
Letters, digits, and underscores, up to 64 characters.
string
required
object
JSON Schema object.
Response
201 with the created agent object at revision 1, also in the ETag header ("1").
from hai_agents import Client
client = Client()
agent = client.agents.create_agent(
name="my-web-agent",
description="Custom web researcher",
environments=[
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com",
}
],
)
print(agent.name)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const agent = await client.agents.createAgent({
body: {
name: "my-web-agent",
description: "Custom web researcher",
environments: [
{
id: "browser",
kind: "web",
mode: { type: "visual", width: 1280, height: 720 },
startUrl: "https://news.ycombinator.com",
},
],
},
});
console.log(agent.name);
curl -X POST https://agp.eu.hcompany.ai/api/v2/agents \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "my-web-agent",
"description": "Custom web researcher",
"environments": [
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com"
}
]
}'
{
"name": "my-web-agent",
"description": "Custom web researcher",
"environments": [
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com"
}
],
"model": null,
"reasoning_effort": null,
"instructions": null,
"subagents": null,
"skills": null,
"answer_format": null,
"tools": null
}
Errors
| Status | Cause |
|---|---|
403 | Attempted to use the reserved h/ namespace. |
409 | An agent with this name already exists in your catalog. |
422 | Body failed validation. Common cases: environments missing, environments empty on an agent with no subagents or tools, a duplicate environment kind, or an invalid name shape. |
Was this page helpful?
⌘I
from hai_agents import Client
client = Client()
agent = client.agents.create_agent(
name="my-web-agent",
description="Custom web researcher",
environments=[
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com",
}
],
)
print(agent.name)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const agent = await client.agents.createAgent({
body: {
name: "my-web-agent",
description: "Custom web researcher",
environments: [
{
id: "browser",
kind: "web",
mode: { type: "visual", width: 1280, height: 720 },
startUrl: "https://news.ycombinator.com",
},
],
},
});
console.log(agent.name);
curl -X POST https://agp.eu.hcompany.ai/api/v2/agents \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "my-web-agent",
"description": "Custom web researcher",
"environments": [
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com"
}
]
}'
{
"name": "my-web-agent",
"description": "Custom web researcher",
"environments": [
{
"id": "browser",
"kind": "web",
"mode": {"type": "visual", "width": 1280, "height": 720},
"start_url": "https://news.ycombinator.com"
}
],
"model": null,
"reasoning_effort": null,
"instructions": null,
"subagents": null,
"skills": null,
"answer_format": null,
"tools": null
}