Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/en/docs/integrations/deepagents.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,15 @@ Without the adapter, the gateway takes over what the adapter did:

`PC_GATEWAY_KEY` holds the gateway's `PC_GATEWAY_API_KEY` value. Use one stable ID per conversation, such as the
checkpointer's thread ID, of 1 to 256 visible ASCII characters; never one ID for every conversation. A combined
deployment (`PC_GATEWAY_CORE_UDS`) injects by default only into requests that carry this header or another recognized
session header. It then prepares once per user message and replays that context to the tool-loop steps of the message.
An application that cannot send the header needs `PC_GATEWAY_INJECTION=on`, which prepares each request separately; a
standalone gateway (`PC_GATEWAY_CORE_BASE`) injects only with that setting. See [Gateway context
injection](../operate/deploy-server.md#gateway-context-injection).
deployment (`PC_GATEWAY_CORE_UDS`) prepares once per user message of a conversation and replays that context to the
tool-loop steps of the message. Without the header, it infers the conversation from the opening of the request:
`ChatOpenAI` sends the thread's full history on every call unless `use_previous_response_id=True`, and a history that
opens with system messages and a user message qualifies. Without the header, a subagent task gets its own inferred
conversation, because it starts a new history; a subagent with `mode: "fork"` carries the parent's history and shares
its inferred conversation. The header still keeps apart conversations that open the same way, and gives capture and
prefix extraction a conversation identity that stays the same across gateway restarts; an inferred ID is local to the
gateway process and serves only preparation replay. A standalone gateway (`PC_GATEWAY_CORE_BASE`) injects only with
`PC_GATEWAY_INJECTION=on`. See [Gateway context injection](../operate/deploy-server.md#gateway-context-injection).

Use the Responses route (`use_responses_api=True`). There the gateway calls the model without streaming, captures the
checked response, and replays it as a stream to a client that streams. On the Chat Completions route, an enforcing Core
Expand Down
2 changes: 1 addition & 1 deletion docs/en/docs/integrations/dify.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ See the source [README](https://github.com/oceanbase/powercontext/blob/master/in

When Dify's model calls go through the PowerContext gateway, the gateway prepares and injects context for each model call. Core checks every request the gateway forwards and rejects a prepared-context block that the gateway did not inject, in every privacy mode: Core answers HTTP 422 and the gateway returns HTTP 503 `gate_paused`. The plugin is tools-only and has no prompt-time recall to turn off, but a `ready` `pc_prepare_context` result carries such a block, both in `result.content` and in the tool's text output. Behind the gateway, do not connect `result.content` to an LLM node's input, and do not offer `pc_prepare_context` to an Agent: the tool result stays in the Agent's messages, so Core rejects the request that returns it to the model and every later request that still carries it. The gateway's own preparation takes the place of the `pc_prepare_context` step described above. The other tools return no prepared-context block and are unaffected.

A combined deployment (`PC_GATEWAY_CORE_UDS`) injects by default only into requests that carry `X-PowerContext-Conversation-ID` or another recognized session header; if Dify's model provider sends none, set `PC_GATEWAY_INJECTION=on`. The gateway prepares and captures in the one Scope that `PC_GATEWAY_DEFAULT_SCOPE` names. Set it to the plugin's configured Scope, so that the gateway recalls the Memory the tools write. See [Gateway context injection](../operate/deploy-server.md#gateway-context-injection).
A combined deployment (`PC_GATEWAY_CORE_UDS`) injects into a request when it can identify the conversation: from `X-PowerContext-Conversation-ID` or another recognized session header, or from the opening of a request that carries the full history. It sends a request it cannot identify without injection; `PC_GATEWAY_INJECTION=on` prepares such a request on its own. A standalone gateway (`PC_GATEWAY_CORE_BASE`) injects only with that setting. The gateway prepares and captures in the one Scope that `PC_GATEWAY_DEFAULT_SCOPE` names. Set it to the plugin's configured Scope, so that the gateway recalls the Memory the tools write. See [Gateway context injection](../operate/deploy-server.md#gateway-context-injection).
11 changes: 7 additions & 4 deletions docs/en/docs/integrations/langchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ def gateway_agent(thread_id: str):

`PC_GATEWAY_KEY` holds the gateway's `PC_GATEWAY_API_KEY` value. Use one stable ID per conversation, such as the
checkpointer's thread ID, of 1 to 256 visible ASCII characters; never one ID for every conversation. A combined
deployment (`PC_GATEWAY_CORE_UDS`) injects by default only into requests that carry this header or another recognized
session header. It then prepares once per user message and replays that context to the tool-loop steps of the message.
An application that cannot send the header needs `PC_GATEWAY_INJECTION=on`, which prepares each request separately; a
standalone gateway (`PC_GATEWAY_CORE_BASE`) injects only with that setting. See [Gateway context
deployment (`PC_GATEWAY_CORE_UDS`) prepares once per user message of a conversation and replays that context to the
tool-loop steps of the message. Without the header, it infers the conversation from the opening of the request:
`ChatOpenAI` sends the thread's full history on every call unless `use_previous_response_id=True`, and a history that
opens with system messages and a user message qualifies. The header still keeps apart conversations that open the same
way, and gives capture and prefix extraction a conversation identity that stays the same across gateway restarts; an
inferred ID is local to the gateway process and serves only preparation replay. A standalone gateway
(`PC_GATEWAY_CORE_BASE`) injects only with `PC_GATEWAY_INJECTION=on`. See [Gateway context
injection](../operate/deploy-server.md#gateway-context-injection).

Use the Responses route (`use_responses_api=True`). There the gateway calls the model without streaming, captures the
Expand Down
11 changes: 7 additions & 4 deletions docs/en/docs/integrations/langgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,13 @@ the checkpointer keeps the last recalled context there.

`PC_GATEWAY_KEY` holds the gateway's `PC_GATEWAY_API_KEY` value. The header names the conversation: use the thread ID or
another stable ID per conversation, of 1 to 256 visible ASCII characters, and never one ID for every conversation. A
combined deployment (`PC_GATEWAY_CORE_UDS`) injects by default only into requests that carry this header or another
recognized session header, prepares once per user message, and replays that context to the tool-loop steps of the
message. An application that cannot send the header needs `PC_GATEWAY_INJECTION=on`, which prepares each request
separately; a standalone gateway (`PC_GATEWAY_CORE_BASE`) injects only with that setting. See [Gateway context
combined deployment (`PC_GATEWAY_CORE_UDS`) prepares once per user message of a conversation and replays that context to
the tool-loop steps of the message. Without the header, it infers the conversation from the opening of the request:
`ChatOpenAI` sends the thread's full history on every call unless `use_previous_response_id=True`, and a history that
opens with system messages and a user message qualifies. The header still keeps apart conversations that open the same
way, and gives capture and prefix extraction a conversation identity that stays the same across gateway restarts; an
inferred ID is local to the gateway process and serves only preparation replay. A standalone gateway
(`PC_GATEWAY_CORE_BASE`) injects only with `PC_GATEWAY_INJECTION=on`. See [Gateway context
injection](../operate/deploy-server.md#gateway-context-injection).

Use the Responses route (`use_responses_api=True`). There the gateway calls the model without streaming, captures the
Expand Down
14 changes: 8 additions & 6 deletions docs/en/docs/integrations/openclaw.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ Configure Core and the gateway as well:
- The gateway prepares and captures every conversation in the one Scope that `PC_GATEWAY_DEFAULT_SCOPE` names, not in
the Scope this plugin resolves for each session or project. Set the plugin's `scopeId` and `PC_GATEWAY_DEFAULT_SCOPE`
to the same existing Scope.
- Set `PC_GATEWAY_INJECTION=on`. A combined deployment injects by default only into requests that carry
`X-PowerContext-Conversation-ID` or another recognized session header. OpenClaw 2026.8.1 sends its session headers
only to OpenAI's own endpoints, and a provider's `headers` are the same for every session, so no OpenClaw request
names a conversation. With injection on, the gateway prepares each request separately, tool-loop steps included. Do
not put a fixed `X-PowerContext-Conversation-ID` in the provider's `headers`, because the gateway would then treat
every session as one conversation.
- OpenClaw 2026.8.1 sends its session headers only to OpenAI's own endpoints, and a provider's `headers` are the same
for every session, so no OpenClaw request names a conversation. A combined deployment (`PC_GATEWAY_CORE_UDS`) infers
it instead: on a custom provider OpenClaw sends the session's full history on every request, opening with its system
prompt and the first user message, so the gateway prepares once per user message and replays that context to the
tool-loop steps. Sessions that open with the same system prompt and first message share an inferred conversation. A
standalone gateway (`PC_GATEWAY_CORE_BASE`) injects only with `PC_GATEWAY_INJECTION=on`. Do not put a fixed
`X-PowerContext-Conversation-ID` in the provider's `headers`, because the gateway would then treat every session as
one conversation.

See [Gateway context injection](../operate/deploy-server.md#gateway-context-injection) and [Gateway authentication
boundaries](../operate/deploy-server.md#gateway-authentication-boundaries).
Expand Down
11 changes: 7 additions & 4 deletions docs/en/docs/integrations/pydantic-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,13 @@ result = await agent.run(

`PC_GATEWAY_KEY` holds the gateway's `PC_GATEWAY_API_KEY` value. The header names the conversation: use one stable ID
per conversation, of 1 to 256 visible ASCII characters, and never one ID for every conversation. A combined deployment
(`PC_GATEWAY_CORE_UDS`) injects by default only into requests that carry this header or another recognized session
header, prepares once per user message, and replays that context to the tool-loop steps of the run. An application that
cannot send the header needs `PC_GATEWAY_INJECTION=on`, which prepares each request separately; a standalone gateway
(`PC_GATEWAY_CORE_BASE`) injects only with that setting. See [Gateway context
(`PC_GATEWAY_CORE_UDS`) prepares once per user message of a conversation and replays that context to the tool-loop steps
of the run. Without the header, it infers the conversation from the opening of the request: Pydantic AI sends the full
message history on every request unless `openai_previous_response_id` or `openai_conversation_id` is set, and a history
that opens with system messages and a user prompt qualifies. The header still keeps apart conversations that open the
same way, and gives capture and prefix extraction a conversation identity that stays the same across gateway restarts;
an inferred ID is local to the gateway process and serves only preparation replay. A standalone gateway
(`PC_GATEWAY_CORE_BASE`) injects only with `PC_GATEWAY_INJECTION=on`. See [Gateway context
injection](../operate/deploy-server.md#gateway-context-injection).

Start behind the gateway with new message history. History from runs with the capability keeps the recalled context as a
Expand Down
9 changes: 6 additions & 3 deletions docs/zh/docs/integrations/deepagents.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,12 @@ def gateway_agent(thread_id: str):

`PC_GATEWAY_KEY` 保存 gateway 的 `PC_GATEWAY_API_KEY` 值。这个请求头标识会话:每个会话使用一个稳定的 ID,例如
checkpointer 的 thread ID,长度为 1~256 个可见 ASCII 字符;不要让所有会话共用一个 ID。组合部署(`PC_GATEWAY_CORE_UDS`)
默认只向带有这个请求头或其他可识别会话头的请求注入上下文,每条用户消息准备一次,并把结果重放给这条消息的工具循环步骤。
无法发送这个请求头的应用需要设置 `PC_GATEWAY_INJECTION=on`,此时 gateway 为每个请求分别准备;独立运行的
gateway(`PC_GATEWAY_CORE_BASE`)只有设置了这一项才会注入。
在一个会话中每条用户消息准备一次,并把结果重放给这条消息的工具循环步骤。没有这个请求头时,它根据请求的历史开头推导会话:
除非设置 `use_previous_response_id=True`,`ChatOpenAI` 每次调用都发送 thread 的完整历史;
以 system 消息和一条用户消息开头的历史即可推导。没有这个请求头时,subagent 任务从新的历史开始,
因此有自己推导出的会话;`mode: "fork"` 的 subagent 带着父 agent 的历史,与父 agent 共用推导出的会话。请求头仍能区分开头相同的会话,
并为采集和前缀提取提供在 gateway 重启后保持不变的会话标识;推导出的 ID 仅在当前 gateway 进程内用于重放准备结果。
独立运行的 gateway(`PC_GATEWAY_CORE_BASE`)只有设置 `PC_GATEWAY_INJECTION=on` 才会注入。
见[网关上下文注入](../operate/deploy-server.md#网关上下文注入)。

请使用 Responses 路由(`use_responses_api=True`)。在这个路由上,gateway 以非流式方式调用模型,采集通过检查的响应,
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/docs/integrations/dify.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ description: 通过实验性 Dify 工具插件连接独立的 PowerContext Serve

Dify 的模型调用经过 PowerContext gateway 时,gateway 为每次模型调用准备并注入上下文。Core 检查 gateway 转发的每个请求,拒绝不是 gateway 注入的 prepared-context 块,在每种隐私模式下都是如此:Core 返回 HTTP 422,gateway 返回 HTTP 503 `gate_paused`。插件只提供工具,没有需要关闭的提示词时召回;但 `ready` 状态的 `pc_prepare_context` 结果带有这样的块,`result.content` 和工具的文本输出中都有。经过 gateway 时,不要把 `result.content` 连接到 LLM 节点的输入,也不要把 `pc_prepare_context` 提供给 Agent:工具结果会留在 Agent 的消息中,因此 Core 会拒绝把结果返回给模型的请求,以及之后仍带有该结果的每个请求。gateway 自己的准备取代上文所说的 `pc_prepare_context` 步骤。其他工具不返回 prepared-context 块,不受影响。

组合部署(`PC_GATEWAY_CORE_UDS`)默认只向带有 `X-PowerContext-Conversation-ID` 或其他可识别会话头的请求注入上下文;如果 Dify 的模型供应商不发送这类请求头,请设置 `PC_GATEWAY_INJECTION=on`。gateway 在 `PC_GATEWAY_DEFAULT_SCOPE` 指定的同一个 Scope 中准备和采集。请把它设为插件配置的 Scope,使 gateway 能召回工具写入的 Memory。见[网关上下文注入](../operate/deploy-server.md#网关上下文注入)。
组合部署(`PC_GATEWAY_CORE_UDS`)能识别会话时才向请求注入上下文:会话来自 `X-PowerContext-Conversation-ID` 或其他可识别会话头,或者从携带完整历史的请求开头推导。无法识别会话的请求照常发送,不注入内容;设置 `PC_GATEWAY_INJECTION=on` 后,这类请求会各自准备。独立运行的 gateway(`PC_GATEWAY_CORE_BASE`)只有设置这一项才会注入。gateway 在 `PC_GATEWAY_DEFAULT_SCOPE` 指定的同一个 Scope 中准备和采集。请把它设为插件配置的 Scope,使 gateway 能召回工具写入的 Memory。见[网关上下文注入](../operate/deploy-server.md#网关上下文注入)。
8 changes: 5 additions & 3 deletions docs/zh/docs/integrations/langchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ def gateway_agent(thread_id: str):

`PC_GATEWAY_KEY` 保存 gateway 的 `PC_GATEWAY_API_KEY` 值。这个请求头标识会话:每个会话使用一个稳定的 ID,例如
checkpointer 的 thread ID,长度为 1~256 个可见 ASCII 字符;不要让所有会话共用一个 ID。组合部署(`PC_GATEWAY_CORE_UDS`)
默认只向带有这个请求头或其他可识别会话头的请求注入上下文,每条用户消息准备一次,并把结果重放给这条消息的工具循环步骤。
无法发送这个请求头的应用需要设置 `PC_GATEWAY_INJECTION=on`,此时 gateway 为每个请求分别准备;独立运行的
gateway(`PC_GATEWAY_CORE_BASE`)只有设置了这一项才会注入。
在一个会话中每条用户消息准备一次,并把结果重放给这条消息的工具循环步骤。没有这个请求头时,它根据请求的历史开头推导会话:
除非设置 `use_previous_response_id=True`,`ChatOpenAI` 每次调用都发送 thread 的完整历史;
以 system 消息和一条用户消息开头的历史即可推导。请求头仍能区分开头相同的会话,
并为采集和前缀提取提供在 gateway 重启后保持不变的会话标识;推导出的 ID 仅在当前 gateway 进程内用于重放准备结果。
独立运行的 gateway(`PC_GATEWAY_CORE_BASE`)只有设置 `PC_GATEWAY_INJECTION=on` 才会注入。
见[网关上下文注入](../operate/deploy-server.md#网关上下文注入)。

请使用 Responses 路由(`use_responses_api=True`)。在这个路由上,gateway 以非流式方式调用模型,采集通过检查的响应,
Expand Down
8 changes: 5 additions & 3 deletions docs/zh/docs/integrations/langgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ hook 从不把召回内容写入 checkpoint 历史,因此已有的 thread 可

`PC_GATEWAY_KEY` 保存 gateway 的 `PC_GATEWAY_API_KEY` 值。这个请求头标识会话:每个会话使用一个稳定的 ID,例如 thread
ID,长度为 1~256 个可见 ASCII 字符;不要让所有会话共用一个 ID。组合部署(`PC_GATEWAY_CORE_UDS`)
默认只向带有这个请求头或其他可识别会话头的请求注入上下文,每条用户消息准备一次,并把结果重放给这条消息的工具循环步骤。
无法发送这个请求头的应用需要设置 `PC_GATEWAY_INJECTION=on`,此时 gateway 为每个请求分别准备;独立运行的
gateway(`PC_GATEWAY_CORE_BASE`)只有设置了这一项才会注入。
在一个会话中每条用户消息准备一次,并把结果重放给这条消息的工具循环步骤。没有这个请求头时,它根据请求的历史开头推导会话:
除非设置 `use_previous_response_id=True`,`ChatOpenAI` 每次调用都发送 thread 的完整历史;
以 system 消息和一条用户消息开头的历史即可推导。请求头仍能区分开头相同的会话,
并为采集和前缀提取提供在 gateway 重启后保持不变的会话标识;推导出的 ID 仅在当前 gateway 进程内用于重放准备结果。
独立运行的 gateway(`PC_GATEWAY_CORE_BASE`)只有设置 `PC_GATEWAY_INJECTION=on` 才会注入。
见[网关上下文注入](../operate/deploy-server.md#网关上下文注入)。

请使用 Responses 路由(`use_responses_api=True`)。在这个路由上,gateway 以非流式方式调用模型,采集通过检查的响应,
Expand Down
Loading