curl --request POST \
--url https://api.profy.cn/v1/agents/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": {
"id": "my-expert",
"model": "gpt-6-astra",
"rules": [
{
"type": "identity",
"content": "Be brief."
},
{
"type": "guard",
"content": "Do not reveal secrets."
}
],
"subagents": {
"model": "small",
"agents": [
{
"name": "researcher",
"description": "Looks things up",
"system_prompt": "Search before you answer.",
"tools": [
"web_search"
],
"model": "mini"
}
]
},
"expert_partner": [
{
"identifier": "researcher",
"name": "Researcher",
"brief": "Looks things up",
"needs_sandbox": false
}
],
"tools": [
{
"type": "knowledge"
},
{
"type": "web_search"
},
{
"type": "web_fetch"
},
{
"type": "mcp",
"server_label": "openai_docs",
"transport": {
"type": "http",
"server_url": "https://example.com/mcp"
}
}
]
},
"environment": {
"type": "profy_hosted",
"skills": [
{
"type": "built_in",
"name": "docx"
},
{
"type": "customize",
"name": "my-skill"
}
],
"plugins": [
{
"type": "built_in",
"id": "profy-sites"
}
],
"capability_directories": [
"/Users/me/.agents/skills"
]
},
"input": "Create tree.py and run it.",
"stream": true,
"session_id": "ses_abc123",
"attachment_file_ids": [
"file_abc123"
],
"tool_confirmations": [
{
"tool_call_id": "call_abc",
"tool_name": "ask",
"decision": "approved",
"modified_parameters": {
"result": "yes"
},
"original_parameters": {},
"result": "yes",
"rejection_reason": "",
"is_error": false
}
],
"enabled_plugins": [
"profy-sites"
],
"skill_names": [
"user/my-skill"
],
"enable_memory": false,
"permission_mode": "plan",
"working_directory": "/home/user/workspace",
"selected_image_model": "image-model",
"selected_video_model": "video-model",
"selected_speech_model": "speech-model",
"selected_music_model": "music-model",
"image_parameters": {},
"video_parameters": {}
}
'import requests
url = "https://api.profy.cn/v1/agents/run"
payload = {
"agent": {
"id": "my-expert",
"model": "gpt-6-astra",
"rules": [
{
"type": "identity",
"content": "Be brief."
},
{
"type": "guard",
"content": "Do not reveal secrets."
}
],
"subagents": {
"model": "small",
"agents": [
{
"name": "researcher",
"description": "Looks things up",
"system_prompt": "Search before you answer.",
"tools": ["web_search"],
"model": "mini"
}
]
},
"expert_partner": [
{
"identifier": "researcher",
"name": "Researcher",
"brief": "Looks things up",
"needs_sandbox": False
}
],
"tools": [
{ "type": "knowledge" },
{ "type": "web_search" },
{ "type": "web_fetch" },
{
"type": "mcp",
"server_label": "openai_docs",
"transport": {
"type": "http",
"server_url": "https://example.com/mcp"
}
}
]
},
"environment": {
"type": "profy_hosted",
"skills": [
{
"type": "built_in",
"name": "docx"
},
{
"type": "customize",
"name": "my-skill"
}
],
"plugins": [
{
"type": "built_in",
"id": "profy-sites"
}
],
"capability_directories": ["/Users/me/.agents/skills"]
},
"input": "Create tree.py and run it.",
"stream": True,
"session_id": "ses_abc123",
"attachment_file_ids": ["file_abc123"],
"tool_confirmations": [
{
"tool_call_id": "call_abc",
"tool_name": "ask",
"decision": "approved",
"modified_parameters": { "result": "yes" },
"original_parameters": {},
"result": "yes",
"rejection_reason": "",
"is_error": False
}
],
"enabled_plugins": ["profy-sites"],
"skill_names": ["user/my-skill"],
"enable_memory": False,
"permission_mode": "plan",
"working_directory": "/home/user/workspace",
"selected_image_model": "image-model",
"selected_video_model": "video-model",
"selected_speech_model": "speech-model",
"selected_music_model": "music-model",
"image_parameters": {},
"video_parameters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: {
id: 'my-expert',
model: 'gpt-6-astra',
rules: [
{type: 'identity', content: 'Be brief.'},
{type: 'guard', content: 'Do not reveal secrets.'}
],
subagents: {
model: 'small',
agents: [
{
name: 'researcher',
description: 'Looks things up',
system_prompt: 'Search before you answer.',
tools: ['web_search'],
model: 'mini'
}
]
},
expert_partner: [
{
identifier: 'researcher',
name: 'Researcher',
brief: 'Looks things up',
needs_sandbox: false
}
],
tools: [
{type: 'knowledge'},
{type: 'web_search'},
{type: 'web_fetch'},
{
type: 'mcp',
server_label: 'openai_docs',
transport: {type: 'http', server_url: 'https://example.com/mcp'}
}
]
},
environment: {
type: 'profy_hosted',
skills: [{type: 'built_in', name: 'docx'}, {type: 'customize', name: 'my-skill'}],
plugins: [{type: 'built_in', id: 'profy-sites'}],
capability_directories: ['/Users/me/.agents/skills']
},
input: 'Create tree.py and run it.',
stream: true,
session_id: 'ses_abc123',
attachment_file_ids: ['file_abc123'],
tool_confirmations: [
{
tool_call_id: 'call_abc',
tool_name: 'ask',
decision: 'approved',
modified_parameters: {result: 'yes'},
original_parameters: {},
result: 'yes',
rejection_reason: '',
is_error: false
}
],
enabled_plugins: ['profy-sites'],
skill_names: ['user/my-skill'],
enable_memory: false,
permission_mode: 'plan',
working_directory: '/home/user/workspace',
selected_image_model: 'image-model',
selected_video_model: 'video-model',
selected_speech_model: 'speech-model',
selected_music_model: 'music-model',
image_parameters: {},
video_parameters: {}
})
};
fetch('https://api.profy.cn/v1/agents/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.profy.cn/v1/agents/run",
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([
'agent' => [
'id' => 'my-expert',
'model' => 'gpt-6-astra',
'rules' => [
[
'type' => 'identity',
'content' => 'Be brief.'
],
[
'type' => 'guard',
'content' => 'Do not reveal secrets.'
]
],
'subagents' => [
'model' => 'small',
'agents' => [
[
'name' => 'researcher',
'description' => 'Looks things up',
'system_prompt' => 'Search before you answer.',
'tools' => [
'web_search'
],
'model' => 'mini'
]
]
],
'expert_partner' => [
[
'identifier' => 'researcher',
'name' => 'Researcher',
'brief' => 'Looks things up',
'needs_sandbox' => false
]
],
'tools' => [
[
'type' => 'knowledge'
],
[
'type' => 'web_search'
],
[
'type' => 'web_fetch'
],
[
'type' => 'mcp',
'server_label' => 'openai_docs',
'transport' => [
'type' => 'http',
'server_url' => 'https://example.com/mcp'
]
]
]
],
'environment' => [
'type' => 'profy_hosted',
'skills' => [
[
'type' => 'built_in',
'name' => 'docx'
],
[
'type' => 'customize',
'name' => 'my-skill'
]
],
'plugins' => [
[
'type' => 'built_in',
'id' => 'profy-sites'
]
],
'capability_directories' => [
'/Users/me/.agents/skills'
]
],
'input' => 'Create tree.py and run it.',
'stream' => true,
'session_id' => 'ses_abc123',
'attachment_file_ids' => [
'file_abc123'
],
'tool_confirmations' => [
[
'tool_call_id' => 'call_abc',
'tool_name' => 'ask',
'decision' => 'approved',
'modified_parameters' => [
'result' => 'yes'
],
'original_parameters' => [
],
'result' => 'yes',
'rejection_reason' => '',
'is_error' => false
]
],
'enabled_plugins' => [
'profy-sites'
],
'skill_names' => [
'user/my-skill'
],
'enable_memory' => false,
'permission_mode' => 'plan',
'working_directory' => '/home/user/workspace',
'selected_image_model' => 'image-model',
'selected_video_model' => 'video-model',
'selected_speech_model' => 'speech-model',
'selected_music_model' => 'music-model',
'image_parameters' => [
],
'video_parameters' => [
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.profy.cn/v1/agents/run"
payload := strings.NewReader("{\n \"agent\": {\n \"id\": \"my-expert\",\n \"model\": \"gpt-6-astra\",\n \"rules\": [\n {\n \"type\": \"identity\",\n \"content\": \"Be brief.\"\n },\n {\n \"type\": \"guard\",\n \"content\": \"Do not reveal secrets.\"\n }\n ],\n \"subagents\": {\n \"model\": \"small\",\n \"agents\": [\n {\n \"name\": \"researcher\",\n \"description\": \"Looks things up\",\n \"system_prompt\": \"Search before you answer.\",\n \"tools\": [\n \"web_search\"\n ],\n \"model\": \"mini\"\n }\n ]\n },\n \"expert_partner\": [\n {\n \"identifier\": \"researcher\",\n \"name\": \"Researcher\",\n \"brief\": \"Looks things up\",\n \"needs_sandbox\": false\n }\n ],\n \"tools\": [\n {\n \"type\": \"knowledge\"\n },\n {\n \"type\": \"web_search\"\n },\n {\n \"type\": \"web_fetch\"\n },\n {\n \"type\": \"mcp\",\n \"server_label\": \"openai_docs\",\n \"transport\": {\n \"type\": \"http\",\n \"server_url\": \"https://example.com/mcp\"\n }\n }\n ]\n },\n \"environment\": {\n \"type\": \"profy_hosted\",\n \"skills\": [\n {\n \"type\": \"built_in\",\n \"name\": \"docx\"\n },\n {\n \"type\": \"customize\",\n \"name\": \"my-skill\"\n }\n ],\n \"plugins\": [\n {\n \"type\": \"built_in\",\n \"id\": \"profy-sites\"\n }\n ],\n \"capability_directories\": [\n \"/Users/me/.agents/skills\"\n ]\n },\n \"input\": \"Create tree.py and run it.\",\n \"stream\": true,\n \"session_id\": \"ses_abc123\",\n \"attachment_file_ids\": [\n \"file_abc123\"\n ],\n \"tool_confirmations\": [\n {\n \"tool_call_id\": \"call_abc\",\n \"tool_name\": \"ask\",\n \"decision\": \"approved\",\n \"modified_parameters\": {\n \"result\": \"yes\"\n },\n \"original_parameters\": {},\n \"result\": \"yes\",\n \"rejection_reason\": \"\",\n \"is_error\": false\n }\n ],\n \"enabled_plugins\": [\n \"profy-sites\"\n ],\n \"skill_names\": [\n \"user/my-skill\"\n ],\n \"enable_memory\": false,\n \"permission_mode\": \"plan\",\n \"working_directory\": \"/home/user/workspace\",\n \"selected_image_model\": \"image-model\",\n \"selected_video_model\": \"video-model\",\n \"selected_speech_model\": \"speech-model\",\n \"selected_music_model\": \"music-model\",\n \"image_parameters\": {},\n \"video_parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.profy.cn/v1/agents/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": {\n \"id\": \"my-expert\",\n \"model\": \"gpt-6-astra\",\n \"rules\": [\n {\n \"type\": \"identity\",\n \"content\": \"Be brief.\"\n },\n {\n \"type\": \"guard\",\n \"content\": \"Do not reveal secrets.\"\n }\n ],\n \"subagents\": {\n \"model\": \"small\",\n \"agents\": [\n {\n \"name\": \"researcher\",\n \"description\": \"Looks things up\",\n \"system_prompt\": \"Search before you answer.\",\n \"tools\": [\n \"web_search\"\n ],\n \"model\": \"mini\"\n }\n ]\n },\n \"expert_partner\": [\n {\n \"identifier\": \"researcher\",\n \"name\": \"Researcher\",\n \"brief\": \"Looks things up\",\n \"needs_sandbox\": false\n }\n ],\n \"tools\": [\n {\n \"type\": \"knowledge\"\n },\n {\n \"type\": \"web_search\"\n },\n {\n \"type\": \"web_fetch\"\n },\n {\n \"type\": \"mcp\",\n \"server_label\": \"openai_docs\",\n \"transport\": {\n \"type\": \"http\",\n \"server_url\": \"https://example.com/mcp\"\n }\n }\n ]\n },\n \"environment\": {\n \"type\": \"profy_hosted\",\n \"skills\": [\n {\n \"type\": \"built_in\",\n \"name\": \"docx\"\n },\n {\n \"type\": \"customize\",\n \"name\": \"my-skill\"\n }\n ],\n \"plugins\": [\n {\n \"type\": \"built_in\",\n \"id\": \"profy-sites\"\n }\n ],\n \"capability_directories\": [\n \"/Users/me/.agents/skills\"\n ]\n },\n \"input\": \"Create tree.py and run it.\",\n \"stream\": true,\n \"session_id\": \"ses_abc123\",\n \"attachment_file_ids\": [\n \"file_abc123\"\n ],\n \"tool_confirmations\": [\n {\n \"tool_call_id\": \"call_abc\",\n \"tool_name\": \"ask\",\n \"decision\": \"approved\",\n \"modified_parameters\": {\n \"result\": \"yes\"\n },\n \"original_parameters\": {},\n \"result\": \"yes\",\n \"rejection_reason\": \"\",\n \"is_error\": false\n }\n ],\n \"enabled_plugins\": [\n \"profy-sites\"\n ],\n \"skill_names\": [\n \"user/my-skill\"\n ],\n \"enable_memory\": false,\n \"permission_mode\": \"plan\",\n \"working_directory\": \"/home/user/workspace\",\n \"selected_image_model\": \"image-model\",\n \"selected_video_model\": \"video-model\",\n \"selected_speech_model\": \"speech-model\",\n \"selected_music_model\": \"music-model\",\n \"image_parameters\": {},\n \"video_parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.profy.cn/v1/agents/run")
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 \"agent\": {\n \"id\": \"my-expert\",\n \"model\": \"gpt-6-astra\",\n \"rules\": [\n {\n \"type\": \"identity\",\n \"content\": \"Be brief.\"\n },\n {\n \"type\": \"guard\",\n \"content\": \"Do not reveal secrets.\"\n }\n ],\n \"subagents\": {\n \"model\": \"small\",\n \"agents\": [\n {\n \"name\": \"researcher\",\n \"description\": \"Looks things up\",\n \"system_prompt\": \"Search before you answer.\",\n \"tools\": [\n \"web_search\"\n ],\n \"model\": \"mini\"\n }\n ]\n },\n \"expert_partner\": [\n {\n \"identifier\": \"researcher\",\n \"name\": \"Researcher\",\n \"brief\": \"Looks things up\",\n \"needs_sandbox\": false\n }\n ],\n \"tools\": [\n {\n \"type\": \"knowledge\"\n },\n {\n \"type\": \"web_search\"\n },\n {\n \"type\": \"web_fetch\"\n },\n {\n \"type\": \"mcp\",\n \"server_label\": \"openai_docs\",\n \"transport\": {\n \"type\": \"http\",\n \"server_url\": \"https://example.com/mcp\"\n }\n }\n ]\n },\n \"environment\": {\n \"type\": \"profy_hosted\",\n \"skills\": [\n {\n \"type\": \"built_in\",\n \"name\": \"docx\"\n },\n {\n \"type\": \"customize\",\n \"name\": \"my-skill\"\n }\n ],\n \"plugins\": [\n {\n \"type\": \"built_in\",\n \"id\": \"profy-sites\"\n }\n ],\n \"capability_directories\": [\n \"/Users/me/.agents/skills\"\n ]\n },\n \"input\": \"Create tree.py and run it.\",\n \"stream\": true,\n \"session_id\": \"ses_abc123\",\n \"attachment_file_ids\": [\n \"file_abc123\"\n ],\n \"tool_confirmations\": [\n {\n \"tool_call_id\": \"call_abc\",\n \"tool_name\": \"ask\",\n \"decision\": \"approved\",\n \"modified_parameters\": {\n \"result\": \"yes\"\n },\n \"original_parameters\": {},\n \"result\": \"yes\",\n \"rejection_reason\": \"\",\n \"is_error\": false\n }\n ],\n \"enabled_plugins\": [\n \"profy-sites\"\n ],\n \"skill_names\": [\n \"user/my-skill\"\n ],\n \"enable_memory\": false,\n \"permission_mode\": \"plan\",\n \"working_directory\": \"/home/user/workspace\",\n \"selected_image_model\": \"image-model\",\n \"selected_video_model\": \"video-model\",\n \"selected_speech_model\": \"speech-model\",\n \"selected_music_model\": \"music-model\",\n \"image_parameters\": {},\n \"video_parameters\": {}\n}"
response = http.request(request)
puts response.read_bodyevent: run.created
data: {"type":"run.created","event_id":1}
event: output.text.delta
data: {"type":"output.text.delta","delta":"Hello","event_id":2}
event: tool_call.arguments.delta
data: {"type":"tool_call.arguments.delta","tool_name":"web_search","args_chunk":"query","event_id":3}
event: tool_call.result
data: {"type":"tool_call.result","tool_name":"web_search","event_id":4}
event: usage.token
data: {"type":"usage.token","prompt_tokens":10,"completion_tokens":4,"total_tokens":14,"event_id":5}
event: run.completed
data: {"type":"run.completed","event_id":6}
data: [DONE]
调用专家(SSE 流式)
Invoke a Profy Expert. SSE only: omit stream or set it true. stream false returns 400. The canonical body is agent + environment + input. expert_identifier aliases agent, and message aliases input. Persona is not accepted on this request.
curl --request POST \
--url https://api.profy.cn/v1/agents/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": {
"id": "my-expert",
"model": "gpt-6-astra",
"rules": [
{
"type": "identity",
"content": "Be brief."
},
{
"type": "guard",
"content": "Do not reveal secrets."
}
],
"subagents": {
"model": "small",
"agents": [
{
"name": "researcher",
"description": "Looks things up",
"system_prompt": "Search before you answer.",
"tools": [
"web_search"
],
"model": "mini"
}
]
},
"expert_partner": [
{
"identifier": "researcher",
"name": "Researcher",
"brief": "Looks things up",
"needs_sandbox": false
}
],
"tools": [
{
"type": "knowledge"
},
{
"type": "web_search"
},
{
"type": "web_fetch"
},
{
"type": "mcp",
"server_label": "openai_docs",
"transport": {
"type": "http",
"server_url": "https://example.com/mcp"
}
}
]
},
"environment": {
"type": "profy_hosted",
"skills": [
{
"type": "built_in",
"name": "docx"
},
{
"type": "customize",
"name": "my-skill"
}
],
"plugins": [
{
"type": "built_in",
"id": "profy-sites"
}
],
"capability_directories": [
"/Users/me/.agents/skills"
]
},
"input": "Create tree.py and run it.",
"stream": true,
"session_id": "ses_abc123",
"attachment_file_ids": [
"file_abc123"
],
"tool_confirmations": [
{
"tool_call_id": "call_abc",
"tool_name": "ask",
"decision": "approved",
"modified_parameters": {
"result": "yes"
},
"original_parameters": {},
"result": "yes",
"rejection_reason": "",
"is_error": false
}
],
"enabled_plugins": [
"profy-sites"
],
"skill_names": [
"user/my-skill"
],
"enable_memory": false,
"permission_mode": "plan",
"working_directory": "/home/user/workspace",
"selected_image_model": "image-model",
"selected_video_model": "video-model",
"selected_speech_model": "speech-model",
"selected_music_model": "music-model",
"image_parameters": {},
"video_parameters": {}
}
'import requests
url = "https://api.profy.cn/v1/agents/run"
payload = {
"agent": {
"id": "my-expert",
"model": "gpt-6-astra",
"rules": [
{
"type": "identity",
"content": "Be brief."
},
{
"type": "guard",
"content": "Do not reveal secrets."
}
],
"subagents": {
"model": "small",
"agents": [
{
"name": "researcher",
"description": "Looks things up",
"system_prompt": "Search before you answer.",
"tools": ["web_search"],
"model": "mini"
}
]
},
"expert_partner": [
{
"identifier": "researcher",
"name": "Researcher",
"brief": "Looks things up",
"needs_sandbox": False
}
],
"tools": [
{ "type": "knowledge" },
{ "type": "web_search" },
{ "type": "web_fetch" },
{
"type": "mcp",
"server_label": "openai_docs",
"transport": {
"type": "http",
"server_url": "https://example.com/mcp"
}
}
]
},
"environment": {
"type": "profy_hosted",
"skills": [
{
"type": "built_in",
"name": "docx"
},
{
"type": "customize",
"name": "my-skill"
}
],
"plugins": [
{
"type": "built_in",
"id": "profy-sites"
}
],
"capability_directories": ["/Users/me/.agents/skills"]
},
"input": "Create tree.py and run it.",
"stream": True,
"session_id": "ses_abc123",
"attachment_file_ids": ["file_abc123"],
"tool_confirmations": [
{
"tool_call_id": "call_abc",
"tool_name": "ask",
"decision": "approved",
"modified_parameters": { "result": "yes" },
"original_parameters": {},
"result": "yes",
"rejection_reason": "",
"is_error": False
}
],
"enabled_plugins": ["profy-sites"],
"skill_names": ["user/my-skill"],
"enable_memory": False,
"permission_mode": "plan",
"working_directory": "/home/user/workspace",
"selected_image_model": "image-model",
"selected_video_model": "video-model",
"selected_speech_model": "speech-model",
"selected_music_model": "music-model",
"image_parameters": {},
"video_parameters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: {
id: 'my-expert',
model: 'gpt-6-astra',
rules: [
{type: 'identity', content: 'Be brief.'},
{type: 'guard', content: 'Do not reveal secrets.'}
],
subagents: {
model: 'small',
agents: [
{
name: 'researcher',
description: 'Looks things up',
system_prompt: 'Search before you answer.',
tools: ['web_search'],
model: 'mini'
}
]
},
expert_partner: [
{
identifier: 'researcher',
name: 'Researcher',
brief: 'Looks things up',
needs_sandbox: false
}
],
tools: [
{type: 'knowledge'},
{type: 'web_search'},
{type: 'web_fetch'},
{
type: 'mcp',
server_label: 'openai_docs',
transport: {type: 'http', server_url: 'https://example.com/mcp'}
}
]
},
environment: {
type: 'profy_hosted',
skills: [{type: 'built_in', name: 'docx'}, {type: 'customize', name: 'my-skill'}],
plugins: [{type: 'built_in', id: 'profy-sites'}],
capability_directories: ['/Users/me/.agents/skills']
},
input: 'Create tree.py and run it.',
stream: true,
session_id: 'ses_abc123',
attachment_file_ids: ['file_abc123'],
tool_confirmations: [
{
tool_call_id: 'call_abc',
tool_name: 'ask',
decision: 'approved',
modified_parameters: {result: 'yes'},
original_parameters: {},
result: 'yes',
rejection_reason: '',
is_error: false
}
],
enabled_plugins: ['profy-sites'],
skill_names: ['user/my-skill'],
enable_memory: false,
permission_mode: 'plan',
working_directory: '/home/user/workspace',
selected_image_model: 'image-model',
selected_video_model: 'video-model',
selected_speech_model: 'speech-model',
selected_music_model: 'music-model',
image_parameters: {},
video_parameters: {}
})
};
fetch('https://api.profy.cn/v1/agents/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.profy.cn/v1/agents/run",
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([
'agent' => [
'id' => 'my-expert',
'model' => 'gpt-6-astra',
'rules' => [
[
'type' => 'identity',
'content' => 'Be brief.'
],
[
'type' => 'guard',
'content' => 'Do not reveal secrets.'
]
],
'subagents' => [
'model' => 'small',
'agents' => [
[
'name' => 'researcher',
'description' => 'Looks things up',
'system_prompt' => 'Search before you answer.',
'tools' => [
'web_search'
],
'model' => 'mini'
]
]
],
'expert_partner' => [
[
'identifier' => 'researcher',
'name' => 'Researcher',
'brief' => 'Looks things up',
'needs_sandbox' => false
]
],
'tools' => [
[
'type' => 'knowledge'
],
[
'type' => 'web_search'
],
[
'type' => 'web_fetch'
],
[
'type' => 'mcp',
'server_label' => 'openai_docs',
'transport' => [
'type' => 'http',
'server_url' => 'https://example.com/mcp'
]
]
]
],
'environment' => [
'type' => 'profy_hosted',
'skills' => [
[
'type' => 'built_in',
'name' => 'docx'
],
[
'type' => 'customize',
'name' => 'my-skill'
]
],
'plugins' => [
[
'type' => 'built_in',
'id' => 'profy-sites'
]
],
'capability_directories' => [
'/Users/me/.agents/skills'
]
],
'input' => 'Create tree.py and run it.',
'stream' => true,
'session_id' => 'ses_abc123',
'attachment_file_ids' => [
'file_abc123'
],
'tool_confirmations' => [
[
'tool_call_id' => 'call_abc',
'tool_name' => 'ask',
'decision' => 'approved',
'modified_parameters' => [
'result' => 'yes'
],
'original_parameters' => [
],
'result' => 'yes',
'rejection_reason' => '',
'is_error' => false
]
],
'enabled_plugins' => [
'profy-sites'
],
'skill_names' => [
'user/my-skill'
],
'enable_memory' => false,
'permission_mode' => 'plan',
'working_directory' => '/home/user/workspace',
'selected_image_model' => 'image-model',
'selected_video_model' => 'video-model',
'selected_speech_model' => 'speech-model',
'selected_music_model' => 'music-model',
'image_parameters' => [
],
'video_parameters' => [
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.profy.cn/v1/agents/run"
payload := strings.NewReader("{\n \"agent\": {\n \"id\": \"my-expert\",\n \"model\": \"gpt-6-astra\",\n \"rules\": [\n {\n \"type\": \"identity\",\n \"content\": \"Be brief.\"\n },\n {\n \"type\": \"guard\",\n \"content\": \"Do not reveal secrets.\"\n }\n ],\n \"subagents\": {\n \"model\": \"small\",\n \"agents\": [\n {\n \"name\": \"researcher\",\n \"description\": \"Looks things up\",\n \"system_prompt\": \"Search before you answer.\",\n \"tools\": [\n \"web_search\"\n ],\n \"model\": \"mini\"\n }\n ]\n },\n \"expert_partner\": [\n {\n \"identifier\": \"researcher\",\n \"name\": \"Researcher\",\n \"brief\": \"Looks things up\",\n \"needs_sandbox\": false\n }\n ],\n \"tools\": [\n {\n \"type\": \"knowledge\"\n },\n {\n \"type\": \"web_search\"\n },\n {\n \"type\": \"web_fetch\"\n },\n {\n \"type\": \"mcp\",\n \"server_label\": \"openai_docs\",\n \"transport\": {\n \"type\": \"http\",\n \"server_url\": \"https://example.com/mcp\"\n }\n }\n ]\n },\n \"environment\": {\n \"type\": \"profy_hosted\",\n \"skills\": [\n {\n \"type\": \"built_in\",\n \"name\": \"docx\"\n },\n {\n \"type\": \"customize\",\n \"name\": \"my-skill\"\n }\n ],\n \"plugins\": [\n {\n \"type\": \"built_in\",\n \"id\": \"profy-sites\"\n }\n ],\n \"capability_directories\": [\n \"/Users/me/.agents/skills\"\n ]\n },\n \"input\": \"Create tree.py and run it.\",\n \"stream\": true,\n \"session_id\": \"ses_abc123\",\n \"attachment_file_ids\": [\n \"file_abc123\"\n ],\n \"tool_confirmations\": [\n {\n \"tool_call_id\": \"call_abc\",\n \"tool_name\": \"ask\",\n \"decision\": \"approved\",\n \"modified_parameters\": {\n \"result\": \"yes\"\n },\n \"original_parameters\": {},\n \"result\": \"yes\",\n \"rejection_reason\": \"\",\n \"is_error\": false\n }\n ],\n \"enabled_plugins\": [\n \"profy-sites\"\n ],\n \"skill_names\": [\n \"user/my-skill\"\n ],\n \"enable_memory\": false,\n \"permission_mode\": \"plan\",\n \"working_directory\": \"/home/user/workspace\",\n \"selected_image_model\": \"image-model\",\n \"selected_video_model\": \"video-model\",\n \"selected_speech_model\": \"speech-model\",\n \"selected_music_model\": \"music-model\",\n \"image_parameters\": {},\n \"video_parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.profy.cn/v1/agents/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": {\n \"id\": \"my-expert\",\n \"model\": \"gpt-6-astra\",\n \"rules\": [\n {\n \"type\": \"identity\",\n \"content\": \"Be brief.\"\n },\n {\n \"type\": \"guard\",\n \"content\": \"Do not reveal secrets.\"\n }\n ],\n \"subagents\": {\n \"model\": \"small\",\n \"agents\": [\n {\n \"name\": \"researcher\",\n \"description\": \"Looks things up\",\n \"system_prompt\": \"Search before you answer.\",\n \"tools\": [\n \"web_search\"\n ],\n \"model\": \"mini\"\n }\n ]\n },\n \"expert_partner\": [\n {\n \"identifier\": \"researcher\",\n \"name\": \"Researcher\",\n \"brief\": \"Looks things up\",\n \"needs_sandbox\": false\n }\n ],\n \"tools\": [\n {\n \"type\": \"knowledge\"\n },\n {\n \"type\": \"web_search\"\n },\n {\n \"type\": \"web_fetch\"\n },\n {\n \"type\": \"mcp\",\n \"server_label\": \"openai_docs\",\n \"transport\": {\n \"type\": \"http\",\n \"server_url\": \"https://example.com/mcp\"\n }\n }\n ]\n },\n \"environment\": {\n \"type\": \"profy_hosted\",\n \"skills\": [\n {\n \"type\": \"built_in\",\n \"name\": \"docx\"\n },\n {\n \"type\": \"customize\",\n \"name\": \"my-skill\"\n }\n ],\n \"plugins\": [\n {\n \"type\": \"built_in\",\n \"id\": \"profy-sites\"\n }\n ],\n \"capability_directories\": [\n \"/Users/me/.agents/skills\"\n ]\n },\n \"input\": \"Create tree.py and run it.\",\n \"stream\": true,\n \"session_id\": \"ses_abc123\",\n \"attachment_file_ids\": [\n \"file_abc123\"\n ],\n \"tool_confirmations\": [\n {\n \"tool_call_id\": \"call_abc\",\n \"tool_name\": \"ask\",\n \"decision\": \"approved\",\n \"modified_parameters\": {\n \"result\": \"yes\"\n },\n \"original_parameters\": {},\n \"result\": \"yes\",\n \"rejection_reason\": \"\",\n \"is_error\": false\n }\n ],\n \"enabled_plugins\": [\n \"profy-sites\"\n ],\n \"skill_names\": [\n \"user/my-skill\"\n ],\n \"enable_memory\": false,\n \"permission_mode\": \"plan\",\n \"working_directory\": \"/home/user/workspace\",\n \"selected_image_model\": \"image-model\",\n \"selected_video_model\": \"video-model\",\n \"selected_speech_model\": \"speech-model\",\n \"selected_music_model\": \"music-model\",\n \"image_parameters\": {},\n \"video_parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.profy.cn/v1/agents/run")
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 \"agent\": {\n \"id\": \"my-expert\",\n \"model\": \"gpt-6-astra\",\n \"rules\": [\n {\n \"type\": \"identity\",\n \"content\": \"Be brief.\"\n },\n {\n \"type\": \"guard\",\n \"content\": \"Do not reveal secrets.\"\n }\n ],\n \"subagents\": {\n \"model\": \"small\",\n \"agents\": [\n {\n \"name\": \"researcher\",\n \"description\": \"Looks things up\",\n \"system_prompt\": \"Search before you answer.\",\n \"tools\": [\n \"web_search\"\n ],\n \"model\": \"mini\"\n }\n ]\n },\n \"expert_partner\": [\n {\n \"identifier\": \"researcher\",\n \"name\": \"Researcher\",\n \"brief\": \"Looks things up\",\n \"needs_sandbox\": false\n }\n ],\n \"tools\": [\n {\n \"type\": \"knowledge\"\n },\n {\n \"type\": \"web_search\"\n },\n {\n \"type\": \"web_fetch\"\n },\n {\n \"type\": \"mcp\",\n \"server_label\": \"openai_docs\",\n \"transport\": {\n \"type\": \"http\",\n \"server_url\": \"https://example.com/mcp\"\n }\n }\n ]\n },\n \"environment\": {\n \"type\": \"profy_hosted\",\n \"skills\": [\n {\n \"type\": \"built_in\",\n \"name\": \"docx\"\n },\n {\n \"type\": \"customize\",\n \"name\": \"my-skill\"\n }\n ],\n \"plugins\": [\n {\n \"type\": \"built_in\",\n \"id\": \"profy-sites\"\n }\n ],\n \"capability_directories\": [\n \"/Users/me/.agents/skills\"\n ]\n },\n \"input\": \"Create tree.py and run it.\",\n \"stream\": true,\n \"session_id\": \"ses_abc123\",\n \"attachment_file_ids\": [\n \"file_abc123\"\n ],\n \"tool_confirmations\": [\n {\n \"tool_call_id\": \"call_abc\",\n \"tool_name\": \"ask\",\n \"decision\": \"approved\",\n \"modified_parameters\": {\n \"result\": \"yes\"\n },\n \"original_parameters\": {},\n \"result\": \"yes\",\n \"rejection_reason\": \"\",\n \"is_error\": false\n }\n ],\n \"enabled_plugins\": [\n \"profy-sites\"\n ],\n \"skill_names\": [\n \"user/my-skill\"\n ],\n \"enable_memory\": false,\n \"permission_mode\": \"plan\",\n \"working_directory\": \"/home/user/workspace\",\n \"selected_image_model\": \"image-model\",\n \"selected_video_model\": \"video-model\",\n \"selected_speech_model\": \"speech-model\",\n \"selected_music_model\": \"music-model\",\n \"image_parameters\": {},\n \"video_parameters\": {}\n}"
response = http.request(request)
puts response.read_bodyevent: run.created
data: {"type":"run.created","event_id":1}
event: output.text.delta
data: {"type":"output.text.delta","delta":"Hello","event_id":2}
event: tool_call.arguments.delta
data: {"type":"tool_call.arguments.delta","tool_name":"web_search","args_chunk":"query","event_id":3}
event: tool_call.result
data: {"type":"tool_call.result","tool_name":"web_search","event_id":4}
event: usage.token
data: {"type":"usage.token","prompt_tokens":10,"completion_tokens":4,"total_tokens":14,"event_id":5}
event: run.completed
data: {"type":"run.completed","event_id":6}
data: [DONE]
授权
OAuth2 access token issued via POST /oauth/token
请求头
Required on API-key calls. A stable id for the terminal user. Omitting it returns 400. OAuth calls do not need it. Billing still charges the API key owner.
请求体
Expert object for this run. id is the expert. model, rules, subagents, expert_partner, and tools override the platform values when present. A bare string is also accepted and means the id only. Top-level expert_identifier is an alias and wins over agent.id.
Show child attributes
Show child attributes
{ "id": "my-expert", "model": "gpt-6-astra" }
Alias of agent. When both are set, this value wins.
Where this run executes. Omitted type means profy_hosted. openai_hosted and any other type return 400. skills does not load profy-skills unless you list built_in entries; name "*" loads the whole pack. plugins selects installed plugins for this run and does not load profy-skills. Omit plugins and a new session selects none.
Show child attributes
Show child attributes
What to send the Expert. Switch between a string and a message array. The last user message is used. Missing input returns Missing required field: input, unless tool_confirmations is non-empty.
Alias of input. Used only when input is omitted.
Must be true or omitted. false returns 400. This endpoint is SSE only.
Platform-issued session id from the X-Session-Id response header. An unknown id is replaced with a new session.
Alias of agent.model. The value inside agent wins.
File ids from POST /v1/files. Ids only — the platform never fetches a caller-supplied URL.
20HITL resume answers. When non-empty, input may be omitted. Reuse the session_id from the turn that emitted approval.required.
Show child attributes
Show child attributes
Plugin ids for this turn. Prefer environment.plugins. Empty array clears sticky selection.
Qualified skill names: user/ or expert/.
Opt-in memory for Platform invokes. Default false.
Only "plan" is accepted.
plan 响应
text/event-stream. Each event is an event: line, a data: line of JSON, then a blank line. Every JSON object has type and a monotonic event_id starting at 1. The stream ends with data: [DONE], which is not JSON. Read output text from delta, not content. tool_call.arguments.delta carries args_chunk. The tool result is tool_call.result, not a field on tool_call.completed. run.failed carries error, not message. usage.token carries prompt_tokens, completion_tokens, and total_tokens. Unknown event names are passed through. Response header X-Session-Id is the session id.
SSE text. Do not JSON.parse a line until you have skipped data: [DONE].

