Create an agent
beta.agents.create(**kwargs) -> Agent { id, created_at, instructions, 10 more }
POST/agents
Creates a reusable agent without storing credentials. See agent configuration.
Parameters
model: String
The model to use for the agent. The requested model name is preserved.
minLength0
maxLength1048576
instructions: String
Additional instructions appended to the agent’s default base instructions. Omit or set to null to add no custom instructions.
minLength0
maxLength1048576
metadata: Hash[Symbol, String]
Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map.
Create an agent
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
agent = openai.beta.agents.create(model: "model")
puts(agent){
"id": "id",
"created_at": 0,
"instructions": "instructions",
"metadata": {
"foo": "string"
},
"model": "model",
"multi_agent": {
"enabled": true,
"max_concurrent_subagents": 1
},
"name": "name",
"object": "agent",
"reasoning": {
"effort": "none",
"summary": "concise"
},
"service_tier": "auto",
"text": {
"format": {
"type": "text"
},
"verbosity": "low"
},
"tools": [
{
"defer_loading": true,
"description": "description",
"name": "name",
"parameters": {
"foo": "bar"
},
"type": "function"
}
],
"updated_at": 0
}Returns Examples
{
"id": "id",
"created_at": 0,
"instructions": "instructions",
"metadata": {
"foo": "string"
},
"model": "model",
"multi_agent": {
"enabled": true,
"max_concurrent_subagents": 1
},
"name": "name",
"object": "agent",
"reasoning": {
"effort": "none",
"summary": "concise"
},
"service_tier": "auto",
"text": {
"format": {
"type": "text"
},
"verbosity": "low"
},
"tools": [
{
"defer_loading": true,
"description": "description",
"name": "name",
"parameters": {
"foo": "bar"
},
"type": "function"
}
],
"updated_at": 0
}