1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35import { readFile } from "node:fs/promises";
import OpenAI from "openai";
const client = new OpenAI();
const agent = await client.beta.agents.create({
name: "Herringbone forward-deployed engineer",
model: "gpt-6.2-astra",
instructions: await readFile("herringbone-fde.md", "utf8"),
tools: [
{
type: "function",
name: "get_integration_context",
description:
"Read integration code, constraints, and saved notes for the current customer.",
parameters: {
type: "object",
properties: {},
additionalProperties: false,
},
},
{
type: "function",
name: "save_integration_context",
description:
"Save a note for future sessions about this customer or integration, such as a contact, constraint, or design decision.",
parameters: {
type: "object",
properties: { note: { type: "string" } },
required: ["note"],
additionalProperties: false,
},
},
],
});
console.log(agent.id);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36from pathlib import Path
from openai import OpenAI
client = OpenAI()
agent = client.beta.agents.create(
name="Herringbone forward-deployed engineer",
model="gpt-6.2-astra",
instructions=Path("herringbone-fde.md").read_text(encoding="utf-8"),
tools=[
{
"type": "function",
"name": "get_integration_context",
"description": (
"Read integration code, constraints, and saved notes for the current customer."
),
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": False,
},
},
{
"type": "function",
"name": "save_integration_context",
"description": "Save a note for future sessions about this customer or integration, such as a contact, constraint, or design decision.",
"parameters": {
"type": "object",
"properties": {"note": {"type": "string"}},
"required": ["note"],
"additionalProperties": False,
},
},
],
)
print(agent.id)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47import (
"context"
"fmt"
"os"
"github.com/openai/openai-go/v3"
)
instructions, err := os.ReadFile("herringbone-fde.md")
if err != nil {
panic(err)
}
client := openai.NewClient()
agent, err := client.Beta.Agents.New(context.Background(), openai.BetaAgentNewParams{
Name: openai.String("Herringbone forward-deployed engineer"),
Model: "gpt-6.2-astra",
Instructions: openai.String(string(instructions)),
Tools: []openai.PersistedAgentToolParamUnion{
{
OfParamFunction: &openai.PersistedAgentToolParamFunction{
Name: "get_integration_context",
Description: "Read integration code, constraints, and saved notes for the current customer.",
Parameters: map[string]any{
"type": "object",
"properties": map[string]any{},
"additionalProperties": false,
},
},
},
{
OfParamFunction: &openai.PersistedAgentToolParamFunction{
Name: "save_integration_context",
Description: "Save a note for future sessions about this customer or integration, such as a contact, constraint, or design decision.",
Parameters: map[string]any{
"type": "object",
"properties": map[string]any{"note": map[string]any{"type": "string"}},
"required": []string{"note"},
"additionalProperties": false,
},
},
},
},
})
if err != nil {
panic(err)
}
fmt.Println(agent.ID)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.core.JsonValue;
import com.openai.models.beta.agents.AgentCreateParams;
import com.openai.models.beta.agents.PersistedAgentToolParam;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
var agent =
client
.beta()
.agents()
.create(
AgentCreateParams.builder()
.name("Herringbone forward-deployed engineer")
.model("gpt-6.2-astra")
.instructions(Files.readString(Path.of("herringbone-fde.md")))
.addTool(
PersistedAgentToolParam.Function.builder()
.name("get_integration_context")
.description(
"Read integration code, constraints, and saved notes for the current customer.")
.parameters(
PersistedAgentToolParam.Function.Parameters.builder()
.putAdditionalProperty("type", JsonValue.from("object"))
.putAdditionalProperty("properties", JsonValue.from(Map.of()))
.putAdditionalProperty(
"additionalProperties", JsonValue.from(false))
.build())
.build())
.addTool(
PersistedAgentToolParam.Function.builder()
.name("save_integration_context")
.description(
"Save a note for future sessions about this customer or integration, such as a contact, constraint, or design decision.")
.parameters(
PersistedAgentToolParam.Function.Parameters.builder()
.putAdditionalProperty("type", JsonValue.from("object"))
.putAdditionalProperty(
"properties",
JsonValue.from(Map.of("note", Map.of("type", "string"))))
.putAdditionalProperty(
"required", JsonValue.from(List.of("note")))
.putAdditionalProperty(
"additionalProperties", JsonValue.from(false))
.build())
.build())
.build());
System.out.println(agent.id());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32require "openai"
client = OpenAI::Client.new
agent = client.beta.agents.create(
name: "Herringbone forward-deployed engineer",
model: "gpt-6.2-astra",
instructions: File.read("herringbone-fde.md", encoding: "UTF-8"),
tools: [
{
type: "function",
name: "get_integration_context",
description: "Read integration code, constraints, and saved notes for the current customer.",
parameters: {
type: "object",
properties: {},
additionalProperties: false
}
},
{
type: "function",
name: "save_integration_context",
description: "Save a note for future sessions about this customer or integration, such as a contact, constraint, or design decision.",
parameters: {
type: "object",
properties: { note: { type: "string" } },
required: ["note"],
additionalProperties: false
}
}
]
)
puts agent.id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32#!/bin/sh
set -eu
payload=$(jq -n --rawfile instructions herringbone-fde.md '{
name: "Herringbone forward-deployed engineer",
model: "gpt-6.2-astra",
instructions: $instructions,
tools: [
{
type: "function",
name: "get_integration_context",
description: "Read integration code, constraints, and saved notes for the current customer.",
parameters: { type: "object", properties: {}, additionalProperties: false }
},
{
type: "function",
name: "save_integration_context",
description: "Save a note for future sessions about this customer or integration, such as a contact, constraint, or design decision.",
parameters: {
type: "object",
properties: { note: { type: "string" } },
required: ["note"],
additionalProperties: false
}
}
]
}')
curl --fail-with-body https://api.openai.com/v1/agents \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: agents=v1" \
--json "$payload"