跳转到主要内容
POST
Invoke an Expert (SSE stream)

授权

Authorization
string
header
必填

OAuth2 access token issued via POST /oauth/token

请求头

X-Profy-End-User-Id
string

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.

请求体

application/json
agent

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.

示例:
expert_identifier
string

Alias of agent. When both are set, this value wins.

environment
object

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.

input

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.

message
string

Alias of input. Used only when input is omitted.

stream
boolean
默认值:true

Must be true or omitted. false returns 400. This endpoint is SSE only.

session_id
string

Platform-issued session id from the X-Session-Id response header. An unknown id is replaced with a new session.

model
string

Alias of agent.model. The value inside agent wins.

attachment_file_ids
string[]

File ids from POST /v1/files. Ids only — the platform never fetches a caller-supplied URL.

Maximum array length: 20
tool_confirmations
object[]

HITL resume answers. When non-empty, input may be omitted. Reuse the session_id from the turn that emitted approval.required.

enabled_plugins
string[]

Plugin ids for this turn. Prefer environment.plugins. Empty array clears sticky selection.

skill_names
string[]

Qualified skill names: user/ or expert/.

enable_memory
boolean
默认值:false

Opt-in memory for Platform invokes. Default false.

permission_mode
enum<string>

Only "plan" is accepted.

可用选项:
plan
working_directory
string
selected_image_model
string
selected_video_model
string
selected_speech_model
string
selected_music_model
string
image_parameters
object
video_parameters
object

响应

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].