Create an agent environment
client.Beta.Agents.Environments.New(ctx, params) (*EnvironmentInfo, error)
POST
/agents/environmentsCreates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta.
Create an agent environment
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
environmentInfo, err := client.Beta.Agents.Environments.New(context.TODO(), openai.BetaAgentEnvironmentNewParams{
Environment: openai.BetaAgentEnvironmentNewParamsEnvironment{
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", environmentInfo.ID)
}
201 example
{
"id": "id",
"files": [
{
"id": "id",
"file_id": "file_id",
"path": "path",
"size_bytes": 0,
"type": "file_id"
}
],
"object": "agent.environment",
"plugins": [
{
"description": "description",
"name": "name",
"type": "inline"
}
],
"skills": [
{
"description": "description",
"name": "name",
"skill_id": "skill_id",
"type": "skill_reference",
"version": "version"
}
],
"status": "pending",
"type": "openai_hosted"
}Returns Examples
201 example
{
"id": "id",
"files": [
{
"id": "id",
"file_id": "file_id",
"path": "path",
"size_bytes": 0,
"type": "file_id"
}
],
"object": "agent.environment",
"plugins": [
{
"description": "description",
"name": "name",
"type": "inline"
}
],
"skills": [
{
"description": "description",
"name": "name",
"skill_id": "skill_id",
"type": "skill_reference",
"version": "version"
}
],
"status": "pending",
"type": "openai_hosted"
}