Update agent embed policy
Code Mode: praxis.agent.agents.updateEmbedPolicy
HTTP: POST /agent/v1/agents/{agent_id}/embed_policy
Change some of a service agent’s embed settings. Only the fields you send change: everything you leave out, including the budgets and the token lifetime set in the console, is kept exactly as it was. Send allowed_origins so the pages that load the agent are allowed — an application’s URL origin must be in the list before the application can embed the agent, or its Kit chat answers ORIGIN_NOT_ALLOWED. Send allow_localhost while developing on http://localhost, and uploads to open, close or bound file attachments for the embedded end user. Send share_links to let the agent be shared by link and to set the daily session and spending caps its share links count against; turning it on is refused unless the agent has an identity number. Values are checked by the service: an origin is normalized and must be https, and at most one leading wildcard label may match a single subdomain level. max_file_bytes is 1 to 104857600 bytes and max_files_per_session is 1 to 100. Example: POST /agent/v1/agents/{agent_id}/embed_policy with {“allowed_origins”: [“https://my-app.example.com”]}.
签名
praxis.agent.agents.updateEmbedPolicy(args:{path:{agent_id:string};body:{/** Replaces the whole allow list: the https origins whose pages may open this agent's Kit chat, with no path, query or fragment. */ allowed_origins?:Array<string>;/** Whether http://localhost or http://127.0.0.1 pages may open the chat during development. */ allow_localhost?:boolean;/** What an embedded end user may attach; only the fields you send are changed. */ uploads?:{/** Whether an embedded end user may attach files. */ enabled?:boolean;/** The largest single file, in bytes: 1 to 104857600 (100 MiB). */ max_file_bytes?:number;/** How many files one embedded end-user session may hold: 1 to 100. */ max_files_per_session?:number};/** Whether this agent may be shared by link, and its daily caps; every field is optional and only what you send is changed. */ share_links?:{/** Whether this agent may be shared by link. */ enabled?:boolean;/** The most primary sessions the agent's share links may start in one UTC day, a whole number, or null for no session cap. */ daily_session_cap?:number|null;/** The most the agent's share links may spend in one UTC day, in millionths of the account's currency (whole minor units; see `currency` on the share_links you rea */ daily_spend_cap_micro_usd?:number|null}}}):Promise<{/** The pages that may open this agent's Kit chat, each an https origin with no path, query or fragment (https://my-app.example.com). */ allowed_origins:Array<string>;/** Whether pages served from http://localhost or http://127.0.0.1 may open the chat during development. */ allow_localhost:boolean;/** What an embedded end user may attach to their own conversation. */ uploads:{/** Whether an embedded end user may attach files at all. */ enabled:boolean;/** The largest single file, in bytes: 1 to 104857600 (100 MiB). */ max_file_bytes:number;/** How many files one embedded end-user session may hold: 1 to 100. */ max_files_per_session:number};/** Whether this agent may be shared by link and the daily budget its share links may use. */ share_links:{/** Whether this agent may be shared by link. */ enabled:boolean;/** The most primary sessions this agent's share links may start in one UTC day, a whole number, or null for no session cap. */ daily_session_cap:number|null;/** The most this agent's share links may spend in one UTC day, in millionths of `currency` (whole minor units), or null for no spending cap. */ daily_spend_cap_micro_usd:number|null;/** The currency daily_spend_cap_micro_usd is in: the account's settlement currency (CNY for a mainland account, USD for a global one), or null for a policy saved b */ currency?:"USD"|"CNY"|null}}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| agent_id | path | string | 是 | Service agent id from agent creation or listing, the eight character identity number or the handle; the agent must be a service agent of your organization. Also accepts an 8-character identity number (0–9, A–Z); malformed, absent and foreign references return 404, and response ids always use agent_…. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | The agent’s embed settings. |
| 400 | INVALID_PARAMS: embed settings exist only for service agents, so a general or assume agent is refused; a value that breaks a rule (an origin that is not an https origin, max_file_bytes outside 1–104857600, max_files_per_session outside 1–100, share_links turned on for an agent with no identity number) is refused with the field named too. | |
| 401 | Authenticate with your API key or a console session. | |
| 403 | application/json | permission_error: the credential’s role or bound resources do not allow this operation. Use a key with access to the agent domain and its resources. |
| 404 | AGENT_NOT_FOUND: no service agent with this reference belongs to your organization. | |
| 409 | EMBED_POLICY_REQUIRED: this agent has no saved embed settings yet, so there is nothing to read or merge into; open the agent’s 嵌入设置 page in the console once and save, then retry. EMBED_POLICY_CONFLICT: the settings changed while this request was in flight; read them again and resend, which is not automatic. | |
| 502 | Agent service failed | |
| 503 | Agent service unavailable |