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 taskObject = await client.tasks.cancel('task_id');
console.log(taskObject.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
)
task_object = client.tasks.cancel(
"task_id",
)
print(task_object.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"),
)
taskObject, err := client.Tasks.Cancel(context.TODO(), "task_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", taskObject.ID)
}
curl --request POST \
--url https://api.linxueyuan.online/v1/tasks/{task_id}/cancel \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.linxueyuan.online/v1/tasks/{task_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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/tasks/{task_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.linxueyuan.online/v1/tasks/{task_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "task",
"id": "<string>",
"session_id": "<string>",
"user_id": "<string>",
"created_at": 123,
"output": [
{
"type": "reasoning",
"id": "<string>",
"summary": [
{
"text": "<string>",
"id": 123,
"tags": [
"<string>"
],
"annotations": [
{
"type": "file_citation",
"file_id": "<string>",
"index": 123,
"filename": "<string>"
}
],
"logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
],
"content": [
{
"text": "<string>",
"id": 123,
"tags": [
"<string>"
],
"annotations": [
{
"type": "file_citation",
"file_id": "<string>",
"index": 123,
"filename": "<string>"
}
],
"logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
]
}
],
"usage": {},
"error": {
"code": 123,
"message": "<string>",
"data": {}
},
"input_required": {
"type": "tool_call",
"call_id": "<string>",
"name": "<string>",
"arguments": "<string>",
"id": "<string>"
},
"metadata": {},
"previous_task_id": "<string>",
"rollouts": [
{}
]
}{
"code": 123,
"message": "<string>",
"data": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Tasks
Cancel an agent task
Cancels a model task with the given ID. Only tasks created with
the background parameter set to true can be cancelled.
Learn more.
POST
/
tasks
/
{task_id}
/
cancel
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 taskObject = await client.tasks.cancel('task_id');
console.log(taskObject.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
)
task_object = client.tasks.cancel(
"task_id",
)
print(task_object.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"),
)
taskObject, err := client.Tasks.Cancel(context.TODO(), "task_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", taskObject.ID)
}
curl --request POST \
--url https://api.linxueyuan.online/v1/tasks/{task_id}/cancel \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.linxueyuan.online/v1/tasks/{task_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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/tasks/{task_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.linxueyuan.online/v1/tasks/{task_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "task",
"id": "<string>",
"session_id": "<string>",
"user_id": "<string>",
"created_at": 123,
"output": [
{
"type": "reasoning",
"id": "<string>",
"summary": [
{
"text": "<string>",
"id": 123,
"tags": [
"<string>"
],
"annotations": [
{
"type": "file_citation",
"file_id": "<string>",
"index": 123,
"filename": "<string>"
}
],
"logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
],
"content": [
{
"text": "<string>",
"id": 123,
"tags": [
"<string>"
],
"annotations": [
{
"type": "file_citation",
"file_id": "<string>",
"index": 123,
"filename": "<string>"
}
],
"logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
}
]
}
],
"usage": {},
"error": {
"code": 123,
"message": "<string>",
"data": {}
},
"input_required": {
"type": "tool_call",
"call_id": "<string>",
"name": "<string>",
"arguments": "<string>",
"id": "<string>"
},
"metadata": {},
"previous_task_id": "<string>",
"rollouts": [
{}
]
}{
"code": 123,
"message": "<string>",
"data": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the task to cancel
Response
Successful Response
The task object returned in JSON-RPC result.
固定为 task。
Available options:
task 任务 ID。
会话 ID。
用户 ID。
任务状态。
Available options:
created, queued, working, input-required, paused, completed, canceled, expired, failed 任务创建时间(Unix 秒)。
模型/代理生成的输出条目集合(多类型)。
An output item produced by the agent/model.
- OutputItem
- OutputItem
- OutputItem
- OutputItem
Show child attributes
Show child attributes
token 用量统计信息。
错误信息(失败时)。
Show child attributes
Show child attributes
若任务等待外部输入,则给出需要执行的工具调用(如等待用户参数)。
Show child attributes
Show child attributes
扩展元数据。
前置任务 ID(用于续写/衔接)。
任务推演/回溯事件集合(可选)。
Was this page helpful?
⌘I