JavaScript
import Client from 'agentlin_client';
const client = new Client({
apiKey: process.env['AGENTLIN_API_KEY'], // This is the default and can be omitted
});
const env = await client.env.create();
console.log(env.env_id);import os
from agentlin_client import Client
client = Client(
api_key=os.environ.get("AGENTLIN_API_KEY"), # This is the default and can be omitted
)
env = client.env.create()
print(env.env_id)package main
import (
"context"
"fmt"
"github.com/LinXueyuanStdio/agentlin-client-go"
"github.com/LinXueyuanStdio/agentlin-client-go/option"
)
func main() {
client := agentlin.NewClient(
option.WithAPIKey("My API Key"),
)
env, err := client.Env.New(context.TODO(), agentlin.EnvNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", env.EnvID)
}
curl --request POST \
--url https://api.linxueyuan.online/v1/env/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"session_id": "<string>",
"env_id": "<string>",
"user_id": "<string>",
"client_id": "default",
"env_vars": {},
"env_class_path": "<string>",
"env_init_kwargs": {}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.linxueyuan.online/v1/env/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'session_id' => '<string>',
'env_id' => '<string>',
'user_id' => '<string>',
'client_id' => 'default',
'env_vars' => [
],
'env_class_path' => '<string>',
'env_init_kwargs' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.linxueyuan.online/v1/env/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"<string>\",\n \"env_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_id\": \"default\",\n \"env_vars\": {},\n \"env_class_path\": \"<string>\",\n \"env_init_kwargs\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.linxueyuan.online/v1/env/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"session_id\": \"<string>\",\n \"env_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_id\": \"default\",\n \"env_vars\": {},\n \"env_class_path\": \"<string>\",\n \"env_init_kwargs\": {}\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"env_id": "<string>",
"initial_state": {},
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": false
}
}
],
"done": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Environment
Create Environment
创建新的环境实例
POST
/
env
/
create
JavaScript
import Client from 'agentlin_client';
const client = new Client({
apiKey: process.env['AGENTLIN_API_KEY'], // This is the default and can be omitted
});
const env = await client.env.create();
console.log(env.env_id);import os
from agentlin_client import Client
client = Client(
api_key=os.environ.get("AGENTLIN_API_KEY"), # This is the default and can be omitted
)
env = client.env.create()
print(env.env_id)package main
import (
"context"
"fmt"
"github.com/LinXueyuanStdio/agentlin-client-go"
"github.com/LinXueyuanStdio/agentlin-client-go/option"
)
func main() {
client := agentlin.NewClient(
option.WithAPIKey("My API Key"),
)
env, err := client.Env.New(context.TODO(), agentlin.EnvNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", env.EnvID)
}
curl --request POST \
--url https://api.linxueyuan.online/v1/env/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"session_id": "<string>",
"env_id": "<string>",
"user_id": "<string>",
"client_id": "default",
"env_vars": {},
"env_class_path": "<string>",
"env_init_kwargs": {}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.linxueyuan.online/v1/env/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'session_id' => '<string>',
'env_id' => '<string>',
'user_id' => '<string>',
'client_id' => 'default',
'env_vars' => [
],
'env_class_path' => '<string>',
'env_init_kwargs' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.linxueyuan.online/v1/env/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"<string>\",\n \"env_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_id\": \"default\",\n \"env_vars\": {},\n \"env_class_path\": \"<string>\",\n \"env_init_kwargs\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.linxueyuan.online/v1/env/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"session_id\": \"<string>\",\n \"env_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_id\": \"default\",\n \"env_vars\": {},\n \"env_class_path\": \"<string>\",\n \"env_init_kwargs\": {}\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"env_id": "<string>",
"initial_state": {},
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": false
}
}
],
"done": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?
⌘I