diff --git a/CHANGELOG.md b/CHANGELOG.md
index d03c0ac..b027b6e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,10 +5,38 @@ existing `0.1.0` release; earlier development prereleases are not listed.
## [Unreleased]
+### Added
+
+- Add Forward Session `auto_title` on creation and nullable `config.multiagent` on update. Omit `auto_title` for the server's false default; when true, omit `title` entirely. Clearing a roster with `None` does not restore Template inheritance, and create config still does not accept a roster.
+- Add independent Forward Template A2A publication settings and synchronous/asynchronous `templates.retrieve_agent_card()` discovery for A2A 0.3 and 1.0, with typed protocol fields and unknown-field preservation. PAT callers can select a runtime Identity; SAT callers omit it. No task invocation client is included.
+- Add typed Forward Environment config, packages and OSS bucket storage with separate write credentials and safe read models. Updates replace the whole config; omit a bucket credential to retain it, or use `buckets=[]` to remove future mounts without changing existing Sessions. Forward supports up to seven buckets through the existing `oss-bucket-2026-09-23` beta header.
+- Add Managed `AlwaysDenyPolicy`/`AlwaysDenyPolicyParam` and `always_deny` to all built-in and MCP request policy unions, including defaults.
+- Add Managed ImageGen, ImageSearch, VideoGen and DeliverArtifacts config types with required canonical or supported snake-case names. Add type-only BrowserToolset20260714 request/response types across Agent and Session snapshots; use the existing `betas=["browser-use-2026-07-14"]` option when configuring Browser Use.
+
### Fixed
+- Preserve historical string `configs[].permission_policy` values when leniently parsing Managed Agent, Session and Thread tool snapshots. Tools and configs retain model attribute access instead of becoming Browser models or raw dictionaries; known Browser/media variants keep their concrete types and strict validation still rejects invalid payloads.
+- Expose Managed MCP toolsets' top-level `permission_policy` in requests and Agent/Session/Thread responses, including `always_deny` without `configs`. Set server-wide defaults here: nested `default_config.permission_policy` is retained unchanged for compatibility but does not set the MCP default; omitting the top-level policy defaults to allow.
- Accept `"latest"` and positive integer strings for child Agent `version` in Managed Agent multiagent rosters through the new `MultiagentAgentParams` type, and parse saved `"latest"` versions in Agent responses, including with `_strict_response_validation=True`. `MultiagentAgentUnion.version` is now typed `int | str`; Session and Deployment Agent references keep numeric versions.
+### Breaking changes
+
+- Managed Agent, Session and Thread tool snapshots now return `BrowserToolset20260714` for Browser entries instead of a generic tool model. Browser supports only `type`, so attributes such as `configs` and `mcp_server_name` are not available on that variant.
+
+### Migration
+
+- Check each tool's variant before reading toolset-specific fields. The same branching applies to Agent, Session and Thread snapshots in synchronous and asynchronous clients:
+
+```python
+from qca.managed.types import BrowserToolset20260714
+
+for tool in agent.tools or []:
+ if isinstance(tool, BrowserToolset20260714):
+ continue
+ for config in tool.configs or []:
+ print(config.name)
+```
+
## [0.15.0]
### Added
diff --git a/README.md b/README.md
index 83886ae..aa86fa7 100644
--- a/README.md
+++ b/README.md
@@ -173,6 +173,114 @@ See the official [Forward](https://docs.qoder.com/cloud-agents/api/forward/envir
and [Managed](https://docs.qoder.com/cloud-agents/api/environments/schemas#environment-startup-script)
contracts.
+## Capability configuration
+
+These functions are runnable with an authenticated client and accessible resource
+IDs. All calls also have async counterparts. The SDK leaves service validation
+and merge semantics to the API; no model execution is needed for Card discovery.
+
+```python
+from qca import Forward
+from qca.forward.types import A2AConfigParam
+
+
+def configure_forward(client: Forward, template_id: str, identity_id: str) -> None:
+ publication: A2AConfigParam = {
+ "enabled": True,
+ "description": "Summarize supplied text",
+ "skills": [{"id": "summary", "name": "Summarize", "description": "Summarize text"}],
+ }
+ client.templates.update(template_id, a2a=publication)
+ card = client.templates.retrieve_agent_card(
+ template_id, identity_id=identity_id, a2a_version="1.0"
+ )
+ print(card.name, card.default_input_modes, card.supported_interfaces)
+ session = client.sessions.create(
+ template_id=template_id, identity_id=identity_id, auto_title=True
+ ) # Do not supply title, even None, when auto_title is true.
+ client.sessions.update(session.id, config={"multiagent": None})
+```
+
+Omitting `auto_title` uses the server's false default. Session update roster
+omission keeps the current roster; `None` clears it without restoring inheritance.
+Do not put `multiagent` in Session create config. Template `a2a` is independent
+of `multiagent`: omitted members or `{}` keep saved A2A settings, `skills=[]`
+clears advertised skills, and `a2a=None` clears/disables publication. Individual
+A2A members cannot be null. Card fields use Python snake-case attributes with
+wire aliases (`defaultInputModes`, `supportedInterfaces`); unknown fields are
+retained. With SAT, omit `identity_id` from Card retrieval. The SDK does not
+invoke A2A tasks or follow URLs from Cards.
+
+```python
+from qca import Forward
+from qca.forward.types import EnvironmentConfigParam
+
+
+def mount_oss(client: Forward, environment_id: str, bucket: str, role_arn: str) -> None:
+ config: EnvironmentConfigParam = {
+ "type": "cloud",
+ "storage": {"buckets": [{
+ "name": "datasets", "provider": "aliyun-oss", "region": "cn-hangzhou",
+ "bucket": bucket, "access": "read_only",
+ "credential": {"type": "ram_role", "role_arn": role_arn},
+ }]},
+ }
+ env = client.environments.update(
+ environment_id, config=config,
+ extra_headers={"X-Qoder-Beta": "oss-bucket-2026-09-23"},
+ )
+ print(env.config.storage.buckets[0].credential.type)
+```
+
+Forward supports up to seven cloud bucket mounts. Config updates replace the
+whole config, so retain any packages/scripts you still need. New buckets require
+credentials; updates may omit `credential` to keep stored credentials. Responses
+expose only credential type and an optional masked AccessKey ID, never a secret
+or role ARN. `storage={"buckets": []}` removes mounts for future Sessions;
+existing Session snapshots are unchanged.
+
+```python
+from qca import Managed
+from qca.managed.types import AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams
+
+
+def configure_tools(client: Managed, agent_id: str) -> None:
+ builtins: AgentToolset20260401Params = {
+ "type": "agent_toolset_20260401",
+ "enabled_tools": ["ImageGen", "ImageSearch", "DeliverArtifacts"],
+ "default_config": {"permission_policy": {"type": "always_deny"}},
+ "configs": [
+ {"name": "ImageGen", "permission_policy": {"type": "always_ask"}},
+ {"name": "ImageSearch", "permission_policy": {"type": "always_allow"}},
+ {"name": "VideoGen", "enabled": False},
+ {"name": "DeliverArtifacts", "permission_policy": {"type": "always_ask"}},
+ ],
+ }
+ mcp: MCPToolsetParams = {
+ "type": "mcp_toolset",
+ "mcp_server_name": "weather",
+ "permission_policy": {"type": "always_deny"},
+ }
+ browser: BrowserToolset20260714Params = {"type": "browser_toolset_20260714"}
+ client.agents.update(
+ agent_id, tools=[builtins, mcp, browser], betas=["browser-use-2026-07-14"]
+ )
+```
+
+Media config entries require `name` (canonical name or supported snake-case
+alias); generation prompts and media parameters belong in Session messages, not
+tool config. Browser request entries contain only `type`, not `enabled` or
+`configs`. Agent updates do not require `version` and affect future Session
+snapshots, not existing ones.
+
+For MCP, set the server-wide default in the toolset's **top-level**
+`permission_policy`: `always_allow`, `always_ask`, or `always_deny`, even without
+`configs`. Use `configs[].permission_policy` for per-tool policies. Omitting the
+top-level policy defaults to allow, not the built-in tool default.
+`default_config` remains available for raw payload compatibility, but its nested
+`permission_policy` does not set the MCP server-wide default. The example assumes
+`weather` is already configured in the Agent's `mcp_servers`.
+
## Streaming
Streaming responses are consumed incrementally. Close the stream when finished and handle interruption explicitly; closing a local stream does not cancel server-side work.
@@ -216,6 +324,12 @@ except APIStatusError as exc:
By default, responses are constructed into models without requiring every field to match the declared schema, matching Anthropic's Python SDK. Nested objects are still converted to models and unknown fields are retained. Unexpected field values may keep their original type, so type annotations describe the expected API schema rather than guaranteeing the runtime value.
+Managed Agent, Session and Thread snapshots with historical string
+`configs[].permission_policy` values keep tool/config model attribute access and
+preserve those strings unchanged. Known Browser and media variants retain their
+concrete response classes; unknown tools use the generic model. This compatibility
+does not relax strict response validation.
+
To require Pydantic response validation and raise `APIResponseValidationError` on a schema mismatch, enable the constructor option:
```python
diff --git a/docs/api/reference.md b/docs/api/reference.md
index 8b65d20..e5502ff 100644
--- a/docs/api/reference.md
+++ b/docs/api/reference.md
@@ -4313,7 +4313,8 @@ def create(
*,
name: str,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None,
+ NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
idempotency_key: Union[str, None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
@@ -4362,7 +4363,8 @@ def update(
*,
name: Union[str, None, NotGiven] = NOT_GIVEN,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None,
+ NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
@@ -4495,7 +4497,8 @@ async def create(
*,
name: str,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None,
+ NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
idempotency_key: Union[str, None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
@@ -4544,7 +4547,8 @@ async def update(
*,
name: Union[str, None, NotGiven] = NOT_GIVEN,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None,
+ NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
@@ -8501,6 +8505,7 @@ def create(
identity_id: str,
template_id: str,
budget: Union[BudgetLimitParam, None, NotGiven] = NOT_GIVEN,
+ auto_title: Union[bool, NotGiven] = NOT_GIVEN,
title: Union[str, None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
config: Union[SessionCreateParamsConfigParam, None,
@@ -8691,6 +8696,7 @@ async def create(
identity_id: str,
template_id: str,
budget: Union[BudgetLimitParam, None, NotGiven] = NOT_GIVEN,
+ auto_title: Union[bool, NotGiven] = NOT_GIVEN,
title: Union[str, None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
config: Union[SessionCreateParamsConfigParam, None,
@@ -9782,6 +9788,7 @@ def create(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None,
NotGiven] = NOT_GIVEN,
@@ -9826,6 +9833,27 @@ def retrieve(
GET /templates/{template_id}.
+
+
+#### retrieve\_agent\_card
+
+```python
+def retrieve_agent_card(
+ template_id: str,
+ *,
+ identity_id: Union[str, NotGiven] = NOT_GIVEN,
+ a2a_version: Union[Literal["0.3", "1.0"], NotGiven] = NOT_GIVEN,
+ extra_headers: Dict[str, str] | None = None,
+ extra_query: Dict[str, Any] | None = None,
+ extra_body: Dict[str, Any] | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN
+) -> AgentCard
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/resources/templates.py)
+
+GET /templates/{template_id}/a2a/agent-card.json. Omit identity_id with SAT; version defaults to 0.3.
+
#### update
@@ -9842,6 +9870,7 @@ def update(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None,
NotGiven] = NOT_GIVEN,
@@ -9960,6 +9989,7 @@ async def create(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None,
NotGiven] = NOT_GIVEN,
@@ -10004,6 +10034,27 @@ async def retrieve(
GET /templates/{template_id}.
+
+
+#### retrieve\_agent\_card
+
+```python
+async def retrieve_agent_card(
+ template_id: str,
+ *,
+ identity_id: Union[str, NotGiven] = NOT_GIVEN,
+ a2a_version: Union[Literal["0.3", "1.0"], NotGiven] = NOT_GIVEN,
+ extra_headers: Dict[str, str] | None = None,
+ extra_query: Dict[str, Any] | None = None,
+ extra_body: Dict[str, Any] | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN
+) -> AgentCard
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/resources/templates.py)
+
+GET /templates/{template_id}/a2a/agent-card.json. Omit identity_id with SAT; version defaults to 0.3.
+
#### update
@@ -10020,6 +10071,7 @@ async def update(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None,
NotGiven] = NOT_GIVEN,
@@ -11171,6 +11223,195 @@ async def test(
POST /webhook/endpoints/{endpoint_id}/test. Queues a test event; 202 does not confirm delivery.
+
+
+# qca.forward.types.a2a\_config
+
+
+
+## A2ASkill
+
+```python
+class A2ASkill(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/a2a_config.py)
+
+
+
+#### id
+
+
+
+#### name
+
+
+
+#### description
+
+
+
+#### tags
+
+
+
+#### examples
+
+
+
+## A2AConfig
+
+```python
+class A2AConfig(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/a2a_config.py)
+
+Saved publication settings may be sparse; missing enabled means false.
+
+
+
+#### enabled
+
+
+
+#### description
+
+
+
+#### skills
+
+
+
+# qca.forward.types.a2a\_config\_param
+
+
+
+## A2ASkillParam
+
+```python
+class A2ASkillParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/a2a_config_param.py)
+
+
+
+#### id
+
+
+
+#### name
+
+
+
+#### description
+
+
+
+#### tags
+
+
+
+#### examples
+
+
+
+## A2AConfigParam
+
+```python
+class A2AConfigParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/a2a_config_param.py)
+
+Publication settings, not a multiagent roster. Members cannot be null.
+
+On update, omitted members and {} preserve existing settings; skills=[]
+clears advertised skills. Set the whole a2a field to None to disable/clear.
+
+
+
+#### enabled
+
+
+
+#### description
+
+
+
+#### skills
+
+
+
+# qca.forward.types.agent\_card
+
+
+
+## AgentCardInterface
+
+```python
+class AgentCardInterface(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/agent_card.py)
+
+
+
+#### url
+
+
+
+#### protocol\_binding
+
+
+
+#### protocol\_version
+
+
+
+## AgentCard
+
+```python
+class AgentCard(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/agent_card.py)
+
+A2A 0.3/1.0 discovery document; unknown protocol fields are retained.
+
+
+
+#### name
+
+
+
+#### description
+
+
+
+#### version
+
+
+
+#### skills
+
+
+
+#### default\_input\_modes
+
+
+
+#### default\_output\_modes
+
+
+
+#### url
+
+
+
+#### supported\_interfaces
+
# qca.forward.types.batch
@@ -11583,6 +11824,188 @@ class BatchUsage(BaseModel)
#### total\_credits
+
+
+# qca.forward.types.bucket\_storage
+
+
+
+## OSSRAMRoleCredentialParam
+
+```python
+class OSSRAMRoleCredentialParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/bucket_storage.py)
+
+
+
+#### type
+
+
+
+#### role\_arn
+
+
+
+## OSSAccessKeyCredentialParam
+
+```python
+class OSSAccessKeyCredentialParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/bucket_storage.py)
+
+
+
+#### type
+
+
+
+#### access\_key\_id
+
+
+
+#### access\_key\_secret
+
+
+
+#### OSSBucketCredentialParam
+
+
+
+## OSSBucketParam
+
+```python
+class OSSBucketParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/bucket_storage.py)
+
+
+
+#### name
+
+
+
+#### provider
+
+
+
+#### region
+
+
+
+#### bucket
+
+
+
+#### prefix
+
+
+
+#### access
+
+
+
+#### accelerator\_endpoint
+
+
+
+#### credential
+
+Required for a new mount; omit on update to retain stored credentials.
+
+
+
+## BucketStorageParam
+
+```python
+class BucketStorageParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/bucket_storage.py)
+
+
+
+#### buckets
+
+
+
+## OSSBucketCredential
+
+```python
+class OSSBucketCredential(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/bucket_storage.py)
+
+Read view: the service returns no role ARN or AccessKey secret.
+
+
+
+#### type
+
+
+
+#### access\_key\_id
+
+
+
+## OSSBucket
+
+```python
+class OSSBucket(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/bucket_storage.py)
+
+
+
+#### name
+
+
+
+#### provider
+
+
+
+#### region
+
+
+
+#### bucket
+
+
+
+#### prefix
+
+
+
+#### access
+
+
+
+#### accelerator\_endpoint
+
+
+
+#### credential
+
+
+
+## BucketStorage
+
+```python
+class BucketStorage(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/bucket_storage.py)
+
+
+
+#### buckets
+
# qca.forward.types.budget\_limit
@@ -13564,6 +13987,10 @@ class EnvironmentConfig(BaseModel)
#### packages
+
+
+#### storage
+
# qca.forward.types.environment\_config\_packages
@@ -13606,6 +14033,79 @@ class EnvironmentConfigPackages(BaseModel)
#### pip
+
+
+# qca.forward.types.environment\_config\_param
+
+
+
+## EnvironmentConfigPackagesParam
+
+```python
+class EnvironmentConfigPackagesParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/environment_config_param.py)
+
+
+
+#### apt
+
+
+
+#### cargo
+
+
+
+#### gem
+
+
+
+#### go
+
+
+
+#### npm
+
+
+
+#### pip
+
+
+
+## EnvironmentConfigParam
+
+```python
+class EnvironmentConfigParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/environment_config_param.py)
+
+The entire config replaces the previous config on update.
+
+Cloud storage supports up to seven mounts, gated by oss-bucket-2026-09-23.
+buckets=[] removes mounts for future Sessions, not existing snapshots.
+
+
+
+#### type
+
+
+
+#### setup\_script
+
+
+
+#### startup\_script
+
+
+
+#### packages
+
+
+
+#### storage
+
# qca.forward.types.environment\_create\_params
@@ -15618,6 +16118,10 @@ class MultiagentEntry(BaseModel)
[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/multiagent_entry.py)
+
+
+#### id
+
#### type
@@ -15648,6 +16152,10 @@ class MultiagentEntryParam(TypedDict)
[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/multiagent_entry_param.py)
+
+
+#### id
+
#### type
@@ -17550,6 +18058,10 @@ class SessionConfig(BaseModel)
#### environment\_variables
+
+
+#### multiagent
+
# qca.forward.types.session\_create\_params
@@ -17576,6 +18088,12 @@ class SessionCreateParams(TypedDict)
#### template\_id
+
+
+#### auto\_title
+
+Omit for false. When true, do not supply title (including null).
+
#### title
@@ -18556,6 +19074,12 @@ class SessionUpdateParamsConfigParam(TypedDict)
#### environment\_variables
+
+
+#### multiagent
+
+Omit to keep the roster; None clears it without restoring inheritance.
+
# qca.forward.types.session\_usage
@@ -19174,6 +19698,10 @@ class Template(BaseModel)
#### multiagent
+
+
+#### a2a
+
#### environment\_id
@@ -19324,6 +19852,10 @@ class TemplateCreateParams(TypedDict)
#### multiagent
+
+
+#### a2a
+
#### vaults
@@ -19382,6 +19914,32 @@ class TemplateListParams(TypedDict)
#### before\_id
+
+
+# qca.forward.types.template\_retrieve\_agent\_card\_params
+
+
+
+## TemplateRetrieveAgentCardParams
+
+```python
+class TemplateRetrieveAgentCardParams(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/forward/types/template_retrieve_agent_card_params.py)
+
+
+
+#### identity\_id
+
+Runtime identity selector for PAT authentication. Omit with SAT.
+
+
+
+#### a2a\_version
+
+Sent as A2A-Version; omission uses the server's 0.3 default.
+
# qca.forward.types.template\_update\_params
@@ -19436,6 +19994,10 @@ class TemplateUpdateParams(TypedDict)
#### multiagent
+
+
+#### a2a
+
#### environment\_id
@@ -20814,9 +21376,13 @@ def create(
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None,
NotGiven] = NOT_GIVEN,
- tools: Union[List[Union[AgentToolset20260401Params, MCPToolsetParams,
- CustomToolParams]], None,
- NotGiven] = NOT_GIVEN,
+ tools: Union[
+ List[Union[AgentToolset20260401Params,
+ BrowserToolset20260714Params, MCPToolsetParams,
+ CustomToolParams]],
+ None,
+ NotGiven,
+ ] = NOT_GIVEN,
betas: Union[List[str], None, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
extra_query: Dict[str, Any] | None = None,
@@ -20867,9 +21433,13 @@ def update(
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None,
NotGiven] = NOT_GIVEN,
- tools: Union[List[Union[AgentToolset20260401Params, MCPToolsetParams,
- CustomToolParams]], None,
- NotGiven] = NOT_GIVEN,
+ tools: Union[
+ List[Union[AgentToolset20260401Params,
+ BrowserToolset20260714Params, MCPToolsetParams,
+ CustomToolParams]],
+ None,
+ NotGiven,
+ ] = NOT_GIVEN,
model: Union[Union[str, ModelConfigParams], None,
NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
@@ -20998,9 +21568,13 @@ async def create(
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None,
NotGiven] = NOT_GIVEN,
- tools: Union[List[Union[AgentToolset20260401Params, MCPToolsetParams,
- CustomToolParams]], None,
- NotGiven] = NOT_GIVEN,
+ tools: Union[
+ List[Union[AgentToolset20260401Params,
+ BrowserToolset20260714Params, MCPToolsetParams,
+ CustomToolParams]],
+ None,
+ NotGiven,
+ ] = NOT_GIVEN,
betas: Union[List[str], None, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
extra_query: Dict[str, Any] | None = None,
@@ -21051,9 +21625,13 @@ async def update(
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None,
NotGiven] = NOT_GIVEN,
- tools: Union[List[Union[AgentToolset20260401Params, MCPToolsetParams,
- CustomToolParams]], None,
- NotGiven] = NOT_GIVEN,
+ tools: Union[
+ List[Union[AgentToolset20260401Params,
+ BrowserToolset20260714Params, MCPToolsetParams,
+ CustomToolParams]],
+ None,
+ NotGiven,
+ ] = NOT_GIVEN,
model: Union[Union[str, ModelConfigParams], None,
NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
@@ -27705,6 +28283,12 @@ class AgentToolUnion(BaseModel)
#### mcp\_server\_name
+
+
+#### permission\_policy
+
+For MCP, the server-wide default is read from this top-level field, not default_config.
+
#### description
@@ -27987,6 +28571,42 @@ class AlwaysAskPolicyParam(TypedDict)
#### type
+
+
+# qca.managed.types.always\_deny\_policy
+
+
+
+## AlwaysDenyPolicy
+
+```python
+class AlwaysDenyPolicy(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/always_deny_policy.py)
+
+
+
+#### type
+
+
+
+# qca.managed.types.always\_deny\_policy\_param
+
+
+
+## AlwaysDenyPolicyParam
+
+```python
+class AlwaysDenyPolicyParam(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/always_deny_policy_param.py)
+
+
+
+#### type
+
# qca.managed.types.base64\_document\_source\_param
@@ -28091,6 +28711,46 @@ class BranchCheckoutParam(TypedDict)
#### type
+
+
+# qca.managed.types.browser\_toolset20260714
+
+
+
+## BrowserToolset20260714
+
+```python
+class BrowserToolset20260714(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/browser_toolset20260714.py)
+
+Browser snapshot; future response fields remain available as extras.
+
+
+
+#### type
+
+
+
+# qca.managed.types.browser\_toolset20260714\_params
+
+
+
+## BrowserToolset20260714Params
+
+```python
+class BrowserToolset20260714Params(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/browser_toolset20260714_params.py)
+
+Type-only toolset, gated by the browser-use-2026-07-14 beta header.
+
+
+
+#### type
+
# qca.managed.types.bucket\_storage
@@ -28919,6 +29579,58 @@ class DeletedVault(BaseModel)
#### type
+
+
+# qca.managed.types.deliver\_artifacts\_tool\_config
+
+
+
+## DeliverArtifactsToolConfig
+
+```python
+class DeliverArtifactsToolConfig(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/deliver_artifacts_tool_config.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
+
+
+# qca.managed.types.deliver\_artifacts\_tool\_config\_params
+
+
+
+## DeliverArtifactsToolConfigParams
+
+```python
+class DeliverArtifactsToolConfigParams(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/deliver_artifacts_tool_config_params.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
# qca.managed.types.delta\_content
@@ -31663,6 +32375,110 @@ class ImageBlockParam(TypedDict)
#### type
+
+
+# qca.managed.types.image\_gen\_tool\_config
+
+
+
+## ImageGenToolConfig
+
+```python
+class ImageGenToolConfig(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/image_gen_tool_config.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
+
+
+# qca.managed.types.image\_gen\_tool\_config\_params
+
+
+
+## ImageGenToolConfigParams
+
+```python
+class ImageGenToolConfigParams(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/image_gen_tool_config_params.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
+
+
+# qca.managed.types.image\_search\_tool\_config
+
+
+
+## ImageSearchToolConfig
+
+```python
+class ImageSearchToolConfig(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/image_search_tool_config.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
+
+
+# qca.managed.types.image\_search\_tool\_config\_params
+
+
+
+## ImageSearchToolConfigParams
+
+```python
+class ImageSearchToolConfigParams(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/image_search_tool_config_params.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
# qca.managed.types.injection\_location\_params
@@ -31913,6 +32729,8 @@ class MCPToolsetDefaultConfigParams(TypedDict)
[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/mcp_toolset_default_config_params.py)
+Legacy payload compatibility; MCP defaults use the toolset's top-level permission_policy.
+
#### enabled
@@ -31921,6 +32739,8 @@ class MCPToolsetDefaultConfigParams(TypedDict)
#### permission\_policy
+Retained as-is; this nested field does not set the MCP server-wide policy.
+
# qca.managed.types.mcp\_toolset\_params
@@ -31935,6 +32755,8 @@ class MCPToolsetParams(TypedDict)
[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/mcp_toolset_params.py)
+MCP governance reads the server-wide policy from top-level permission_policy.
+
#### mcp\_server\_name
@@ -31943,6 +32765,12 @@ class MCPToolsetParams(TypedDict)
#### type
+
+
+#### permission\_policy
+
+Server-wide default: always_allow, always_ask or always_deny; omission defaults to allow.
+
#### configs
@@ -31951,6 +32779,8 @@ class MCPToolsetParams(TypedDict)
#### default\_config
+Legacy payload compatibility only; nested permission_policy does not set the MCP default.
+
# qca.managed.types.mcpo\_auth\_create\_params
@@ -34419,6 +35249,12 @@ class SessionAgentToolUnion(BaseModel)
#### mcp\_server\_name
+
+
+#### permission\_policy
+
+For MCP, the server-wide default is read from this top-level field, not default_config.
+
#### description
@@ -36163,6 +36999,12 @@ class SessionThreadAgentToolUnion(BaseModel)
#### mcp\_server\_name
+
+
+#### permission\_policy
+
+For MCP, the server-wide default is read from this top-level field, not default_config.
+
#### description
@@ -38639,6 +39481,58 @@ class VaultSearchParams(TypedDict)
#### betas
+
+
+# qca.managed.types.video\_gen\_tool\_config
+
+
+
+## VideoGenToolConfig
+
+```python
+class VideoGenToolConfig(BaseModel)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/video_gen_tool_config.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
+
+
+# qca.managed.types.video\_gen\_tool\_config\_params
+
+
+
+## VideoGenToolConfigParams
+
+```python
+class VideoGenToolConfigParams(TypedDict)
+```
+
+[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/video_gen_tool_config_params.py)
+
+
+
+#### name
+
+
+
+#### enabled
+
+
+
+#### permission\_policy
+
# qca.managed.types.web\_fetch\_tool\_config\_params
diff --git a/src/qca/common/_models.py b/src/qca/common/_models.py
index 79c4b62..605d5e4 100644
--- a/src/qca/common/_models.py
+++ b/src/qca/common/_models.py
@@ -2,7 +2,7 @@
from datetime import date, datetime
from types import UnionType
-from typing import Annotated, Any, Union, get_args, get_origin
+from typing import Annotated, Any, Literal, Union, get_args, get_origin
from pydantic import BaseModel as PydanticBaseModel
from pydantic import ConfigDict, PrivateAttr, TypeAdapter, ValidationError
@@ -33,6 +33,35 @@ def _construct_response(cast_to: Any, data: Any) -> Any:
try:
return TypeAdapter(cast_to).validate_python(data)
except (ValidationError, ValueError):
+ if isinstance(data, dict):
+ fallback = None
+ has_discriminator = False
+ for candidate in args:
+ model = get_args(candidate)[0] if get_origin(candidate) is Annotated else candidate
+ if not isinstance(model, type) or not issubclass(model, BaseModel):
+ continue
+ model.model_rebuild()
+ discriminators = []
+ for name, field in model.model_fields.items():
+ if name not in ("type", "name") and field.alias not in ("type", "name"):
+ continue
+ annotation = field.annotation
+ if get_origin(annotation) in (Union, UnionType):
+ non_null = [arg for arg in get_args(annotation) if arg is not type(None)]
+ if len(non_null) != 1:
+ continue
+ annotation = non_null[0]
+ if get_origin(annotation) is Literal:
+ key = field.alias if field.alias in data else name
+ discriminators.append((key, get_args(annotation)))
+ if discriminators:
+ has_discriminator = True
+ if all(key in data and data[key] in values for key, values in discriminators):
+ return _construct_response(candidate, data)
+ elif fallback is None:
+ fallback = candidate
+ if has_discriminator and fallback is not None:
+ return _construct_response(fallback, data)
return _construct_response(args[0], data)
if origin is dict and isinstance(data, dict):
return {key: _construct_response(args[1] if args else Any, value) for key, value in data.items()}
diff --git a/src/qca/forward/resources/environments.py b/src/qca/forward/resources/environments.py
index d9a8e24..fa35a45 100644
--- a/src/qca/forward/resources/environments.py
+++ b/src/qca/forward/resources/environments.py
@@ -10,6 +10,7 @@
from qca.common._utils import make_request_options, path_template
from qca.common.pagination import AsyncPaginator, SyncPage
from qca.forward.types.environment import Environment
+from qca.forward.types.environment_config_param import EnvironmentConfigParam
__all__ = ["Environments", "AsyncEnvironments"]
@@ -99,7 +100,7 @@ def create(
*,
name: str,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
idempotency_key: Union[str, None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
@@ -156,7 +157,7 @@ def update(
*,
name: Union[str, None, NotGiven] = NOT_GIVEN,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
@@ -322,7 +323,7 @@ async def create(
*,
name: str,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
idempotency_key: Union[str, None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
@@ -379,7 +380,7 @@ async def update(
*,
name: Union[str, None, NotGiven] = NOT_GIVEN,
description: Union[str, None, NotGiven] = NOT_GIVEN,
- config: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
+ config: Union[EnvironmentConfigParam, Dict[str, Any], None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
identity_id: Union[str, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
diff --git a/src/qca/forward/resources/sessions/sessions.py b/src/qca/forward/resources/sessions/sessions.py
index 6d1e84a..b74d633 100644
--- a/src/qca/forward/resources/sessions/sessions.py
+++ b/src/qca/forward/resources/sessions/sessions.py
@@ -98,6 +98,7 @@ def create(
identity_id: str,
template_id: str,
budget: Union[BudgetLimitParam, None, NotGiven] = NOT_GIVEN,
+ auto_title: Union[bool, NotGiven] = NOT_GIVEN,
title: Union[str, None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
config: Union[SessionCreateParamsConfigParam, None, NotGiven] = NOT_GIVEN,
@@ -115,6 +116,7 @@ def create(
"budget": budget,
"identity_id": identity_id,
"template_id": template_id,
+ "auto_title": auto_title,
"title": title,
"metadata": metadata,
"config": config,
@@ -303,6 +305,7 @@ async def create(
identity_id: str,
template_id: str,
budget: Union[BudgetLimitParam, None, NotGiven] = NOT_GIVEN,
+ auto_title: Union[bool, NotGiven] = NOT_GIVEN,
title: Union[str, None, NotGiven] = NOT_GIVEN,
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
config: Union[SessionCreateParamsConfigParam, None, NotGiven] = NOT_GIVEN,
@@ -320,6 +323,7 @@ async def create(
"budget": budget,
"identity_id": identity_id,
"template_id": template_id,
+ "auto_title": auto_title,
"title": title,
"metadata": metadata,
"config": config,
diff --git a/src/qca/forward/resources/templates.py b/src/qca/forward/resources/templates.py
index cdc7810..d2df9ad 100644
--- a/src/qca/forward/resources/templates.py
+++ b/src/qca/forward/resources/templates.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import Any, Dict, List, Union
+from typing import Any, Dict, List, Literal, Union
import httpx
@@ -8,6 +8,8 @@
from qca.common._types import NOT_GIVEN, NotGiven
from qca.common._utils import make_request_options, path_template
from qca.common.pagination import AsyncPaginator, SyncPage
+from qca.forward.types.a2a_config_param import A2AConfigParam
+from qca.forward.types.agent_card import AgentCard
from qca.forward.types.git_hub_repository_param import GitHubRepositoryParam
from qca.forward.types.managed_tool_config_param import ManagedToolConfigParam
from qca.forward.types.mcp_server_param import MCPServerParam
@@ -60,6 +62,7 @@ def create(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None, NotGiven] = NOT_GIVEN,
vaults: Union[Dict[str, ResourceBindingParam], None, NotGiven] = NOT_GIVEN,
@@ -88,6 +91,7 @@ def create(
"mcp_servers": mcp_servers,
"skills": skills,
"multiagent": multiagent,
+ "a2a": a2a,
"max_tool_rounds": max_tool_rounds,
"managed_tool_config": managed_tool_config,
"vaults": vaults,
@@ -127,6 +131,30 @@ def retrieve(
)
return self._client.request("GET", _path, cast_to=Template, options=options)
+ def retrieve_agent_card(
+ self,
+ template_id: str,
+ *,
+ identity_id: Union[str, NotGiven] = NOT_GIVEN,
+ a2a_version: Union[Literal["0.3", "1.0"], NotGiven] = NOT_GIVEN,
+ extra_headers: Dict[str, str] | None = None,
+ extra_query: Dict[str, Any] | None = None,
+ extra_body: Dict[str, Any] | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> AgentCard:
+ """GET /templates/{template_id}/a2a/agent-card.json. Omit identity_id with SAT; version defaults to 0.3."""
+ _path = path_template("/templates/{template_id}/a2a/agent-card.json", template_id=template_id)
+ options = make_request_options(
+ body={},
+ query={"identity_id": identity_id},
+ headers={"A2A-Version": a2a_version},
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ )
+ return self._client.request("GET", _path, cast_to=AgentCard, options=options)
+
def update(
self,
template_id: str,
@@ -139,6 +167,7 @@ def update(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None, NotGiven] = NOT_GIVEN,
environment_id: Union[str, None, NotGiven] = NOT_GIVEN,
@@ -167,6 +196,7 @@ def update(
"mcp_servers": mcp_servers,
"skills": skills,
"multiagent": multiagent,
+ "a2a": a2a,
"max_tool_rounds": max_tool_rounds,
"managed_tool_config": managed_tool_config,
"environment_id": environment_id,
@@ -276,6 +306,7 @@ async def create(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None, NotGiven] = NOT_GIVEN,
vaults: Union[Dict[str, ResourceBindingParam], None, NotGiven] = NOT_GIVEN,
@@ -304,6 +335,7 @@ async def create(
"mcp_servers": mcp_servers,
"skills": skills,
"multiagent": multiagent,
+ "a2a": a2a,
"max_tool_rounds": max_tool_rounds,
"managed_tool_config": managed_tool_config,
"vaults": vaults,
@@ -343,6 +375,30 @@ async def retrieve(
)
return await self._client.request("GET", _path, cast_to=Template, options=options)
+ async def retrieve_agent_card(
+ self,
+ template_id: str,
+ *,
+ identity_id: Union[str, NotGiven] = NOT_GIVEN,
+ a2a_version: Union[Literal["0.3", "1.0"], NotGiven] = NOT_GIVEN,
+ extra_headers: Dict[str, str] | None = None,
+ extra_query: Dict[str, Any] | None = None,
+ extra_body: Dict[str, Any] | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> AgentCard:
+ """GET /templates/{template_id}/a2a/agent-card.json. Omit identity_id with SAT; version defaults to 0.3."""
+ _path = path_template("/templates/{template_id}/a2a/agent-card.json", template_id=template_id)
+ options = make_request_options(
+ body={},
+ query={"identity_id": identity_id},
+ headers={"A2A-Version": a2a_version},
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ )
+ return await self._client.request("GET", _path, cast_to=AgentCard, options=options)
+
async def update(
self,
template_id: str,
@@ -355,6 +411,7 @@ async def update(
mcp_servers: Union[List[MCPServerParam], None, NotGiven] = NOT_GIVEN,
skills: Union[List[SkillBindingParam], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentConfigParam, None, NotGiven] = NOT_GIVEN,
+ a2a: Union[A2AConfigParam, None, NotGiven] = NOT_GIVEN,
max_tool_rounds: Union[int, None, NotGiven] = NOT_GIVEN,
managed_tool_config: Union[ManagedToolConfigParam, None, NotGiven] = NOT_GIVEN,
environment_id: Union[str, None, NotGiven] = NOT_GIVEN,
@@ -383,6 +440,7 @@ async def update(
"mcp_servers": mcp_servers,
"skills": skills,
"multiagent": multiagent,
+ "a2a": a2a,
"max_tool_rounds": max_tool_rounds,
"managed_tool_config": managed_tool_config,
"environment_id": environment_id,
diff --git a/src/qca/forward/types/__init__.py b/src/qca/forward/types/__init__.py
index 318d8d6..2c67710 100644
--- a/src/qca/forward/types/__init__.py
+++ b/src/qca/forward/types/__init__.py
@@ -4,6 +4,12 @@
from qca.common._models import BaseModel as _BaseModel
from qca.common._types import FileTypes
+from .a2a_config import A2AConfig as A2AConfig
+from .a2a_config import A2ASkill as A2ASkill
+from .a2a_config_param import A2AConfigParam as A2AConfigParam
+from .a2a_config_param import A2ASkillParam as A2ASkillParam
+from .agent_card import AgentCard as AgentCard
+from .agent_card import AgentCardInterface as AgentCardInterface
from .batch import Batch as Batch
from .batch_cancel_params import BatchCancelParams as BatchCancelParams
from .batch_create_params import BatchCreateParams as BatchCreateParams
@@ -16,6 +22,14 @@
from .batch_task_list_params import BatchTaskListParams as BatchTaskListParams
from .batch_task_usage import BatchTaskUsage as BatchTaskUsage
from .batch_usage import BatchUsage as BatchUsage
+from .bucket_storage import BucketStorage as BucketStorage
+from .bucket_storage import BucketStorageParam as BucketStorageParam
+from .bucket_storage import OSSAccessKeyCredentialParam as OSSAccessKeyCredentialParam
+from .bucket_storage import OSSBucket as OSSBucket
+from .bucket_storage import OSSBucketCredential as OSSBucketCredential
+from .bucket_storage import OSSBucketCredentialParam as OSSBucketCredentialParam
+from .bucket_storage import OSSBucketParam as OSSBucketParam
+from .bucket_storage import OSSRAMRoleCredentialParam as OSSRAMRoleCredentialParam
from .budget_limit import BudgetLimit as BudgetLimit
from .budget_limit_param import BudgetLimitParam as BudgetLimitParam
from .channel import Channel as Channel
@@ -93,6 +107,8 @@
from .environment_binding_info import EnvironmentBindingInfo as EnvironmentBindingInfo
from .environment_config import EnvironmentConfig as EnvironmentConfig
from .environment_config_packages import EnvironmentConfigPackages as EnvironmentConfigPackages
+from .environment_config_param import EnvironmentConfigPackagesParam as EnvironmentConfigPackagesParam
+from .environment_config_param import EnvironmentConfigParam as EnvironmentConfigParam
from .environment_create_params import EnvironmentCreateParams as EnvironmentCreateParams
from .environment_list_params import EnvironmentListParams as EnvironmentListParams
from .environment_search_params import EnvironmentSearchParams as EnvironmentSearchParams
@@ -270,6 +286,7 @@
from .template_clone_params import TemplateCloneParams as TemplateCloneParams
from .template_create_params import TemplateCreateParams as TemplateCreateParams
from .template_list_params import TemplateListParams as TemplateListParams
+from .template_retrieve_agent_card_params import TemplateRetrieveAgentCardParams as TemplateRetrieveAgentCardParams
from .template_update_params import TemplateUpdateParams as TemplateUpdateParams
from .template_usage import TemplateUsage as TemplateUsage
from .tool import Tool as Tool
diff --git a/src/qca/forward/types/a2a_config.py b/src/qca/forward/types/a2a_config.py
new file mode 100644
index 0000000..4c07b56
--- /dev/null
+++ b/src/qca/forward/types/a2a_config.py
@@ -0,0 +1,23 @@
+from __future__ import annotations
+
+from typing import List, Optional
+
+from qca.common._models import BaseModel
+
+__all__ = ["A2AConfig", "A2ASkill"]
+
+
+class A2ASkill(BaseModel):
+ id: str
+ name: str
+ description: str
+ tags: Optional[List[str]] = None
+ examples: Optional[List[str]] = None
+
+
+class A2AConfig(BaseModel):
+ """Saved publication settings may be sparse; missing enabled means false."""
+
+ enabled: Optional[bool] = None
+ description: Optional[str] = None
+ skills: Optional[List[A2ASkill]] = None
diff --git a/src/qca/forward/types/a2a_config_param.py b/src/qca/forward/types/a2a_config_param.py
new file mode 100644
index 0000000..1408cfa
--- /dev/null
+++ b/src/qca/forward/types/a2a_config_param.py
@@ -0,0 +1,27 @@
+from __future__ import annotations
+
+from typing import List
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["A2AConfigParam", "A2ASkillParam"]
+
+
+class A2ASkillParam(TypedDict, total=False):
+ id: Required[str]
+ name: Required[str]
+ description: Required[str]
+ tags: List[str]
+ examples: List[str]
+
+
+class A2AConfigParam(TypedDict, total=False):
+ """Publication settings, not a multiagent roster. Members cannot be null.
+
+ On update, omitted members and {} preserve existing settings; skills=[]
+ clears advertised skills. Set the whole a2a field to None to disable/clear.
+ """
+
+ enabled: bool
+ description: str
+ skills: List[A2ASkillParam]
diff --git a/src/qca/forward/types/agent_card.py b/src/qca/forward/types/agent_card.py
new file mode 100644
index 0000000..0f3ba10
--- /dev/null
+++ b/src/qca/forward/types/agent_card.py
@@ -0,0 +1,30 @@
+from __future__ import annotations
+
+from typing import List, Optional
+
+from pydantic import Field
+
+from qca.common._models import BaseModel
+
+from .a2a_config import A2ASkill
+
+__all__ = ["AgentCard", "AgentCardInterface"]
+
+
+class AgentCardInterface(BaseModel):
+ url: str
+ protocol_binding: Optional[str] = Field(default=None, alias="protocolBinding")
+ protocol_version: Optional[str] = Field(default=None, alias="protocolVersion")
+
+
+class AgentCard(BaseModel):
+ """A2A 0.3/1.0 discovery document; unknown protocol fields are retained."""
+
+ name: str
+ description: str
+ version: str
+ skills: List[A2ASkill]
+ default_input_modes: List[str] = Field(alias="defaultInputModes")
+ default_output_modes: List[str] = Field(alias="defaultOutputModes")
+ url: Optional[str] = None
+ supported_interfaces: Optional[List[AgentCardInterface]] = Field(default=None, alias="supportedInterfaces")
diff --git a/src/qca/forward/types/bucket_storage.py b/src/qca/forward/types/bucket_storage.py
new file mode 100644
index 0000000..c2d4094
--- /dev/null
+++ b/src/qca/forward/types/bucket_storage.py
@@ -0,0 +1,70 @@
+from typing import List, Literal, Optional, Union
+
+from typing_extensions import Required, TypedDict
+
+from qca.common._models import BaseModel
+
+__all__ = [
+ "OSSRAMRoleCredentialParam",
+ "OSSAccessKeyCredentialParam",
+ "OSSBucketCredentialParam",
+ "OSSBucketParam",
+ "BucketStorageParam",
+ "OSSBucketCredential",
+ "OSSBucket",
+ "BucketStorage",
+]
+
+
+class OSSRAMRoleCredentialParam(TypedDict, total=False):
+ type: Required[Literal["ram_role"]]
+ # Required on creation; omission can preserve stored credentials on update.
+ role_arn: str
+
+
+class OSSAccessKeyCredentialParam(TypedDict, total=False):
+ type: Required[Literal["access_key"]]
+ access_key_id: Required[str]
+ # Required on creation; omit when echoing a masked credential on update.
+ access_key_secret: str
+
+
+OSSBucketCredentialParam = Union[OSSRAMRoleCredentialParam, OSSAccessKeyCredentialParam]
+
+
+class OSSBucketParam(TypedDict, total=False):
+ name: Required[str]
+ provider: Required[Literal["aliyun-oss"]]
+ region: Required[str]
+ bucket: Required[str]
+ prefix: str
+ access: Literal["read_only", "read_write"]
+ accelerator_endpoint: str
+ credential: OSSBucketCredentialParam
+ """Required for a new mount; omit on update to retain stored credentials."""
+
+
+class BucketStorageParam(TypedDict):
+ buckets: List[OSSBucketParam]
+
+
+class OSSBucketCredential(BaseModel):
+ """Read view: the service returns no role ARN or AccessKey secret."""
+
+ type: Literal["ram_role", "access_key"]
+ access_key_id: Optional[str] = None
+
+
+class OSSBucket(BaseModel):
+ name: str
+ provider: Literal["aliyun-oss"]
+ region: str
+ bucket: str
+ prefix: Optional[str] = None
+ access: Optional[Literal["read_only", "read_write"]] = None
+ accelerator_endpoint: Optional[str] = None
+ credential: Optional[OSSBucketCredential] = None
+
+
+class BucketStorage(BaseModel):
+ buckets: List[OSSBucket]
diff --git a/src/qca/forward/types/environment_config.py b/src/qca/forward/types/environment_config.py
index 62ab16d..7bcc883 100644
--- a/src/qca/forward/types/environment_config.py
+++ b/src/qca/forward/types/environment_config.py
@@ -5,6 +5,7 @@
from qca.common._models import BaseModel
if TYPE_CHECKING:
+ from .bucket_storage import BucketStorage
from .environment_config_packages import EnvironmentConfigPackages
__all__ = ["EnvironmentConfig"]
@@ -16,3 +17,4 @@ class EnvironmentConfig(BaseModel):
setup_script: Optional[str] = None
type: Optional[str] = None
packages: Optional[EnvironmentConfigPackages] = None
+ storage: Optional[BucketStorage] = None
diff --git a/src/qca/forward/types/environment_config_param.py b/src/qca/forward/types/environment_config_param.py
new file mode 100644
index 0000000..f301817
--- /dev/null
+++ b/src/qca/forward/types/environment_config_param.py
@@ -0,0 +1,30 @@
+from typing import List, Literal
+
+from typing_extensions import Required, TypedDict
+
+from .bucket_storage import BucketStorageParam
+
+__all__ = ["EnvironmentConfigParam", "EnvironmentConfigPackagesParam"]
+
+
+class EnvironmentConfigPackagesParam(TypedDict, total=False):
+ apt: List[str]
+ cargo: List[str]
+ gem: List[str]
+ go: List[str]
+ npm: List[str]
+ pip: List[str]
+
+
+class EnvironmentConfigParam(TypedDict, total=False):
+ """The entire config replaces the previous config on update.
+
+ Cloud storage supports up to seven mounts, gated by oss-bucket-2026-09-23.
+ buckets=[] removes mounts for future Sessions, not existing snapshots.
+ """
+
+ type: Required[Literal["cloud", "self_hosted"]]
+ setup_script: str
+ startup_script: str
+ packages: EnvironmentConfigPackagesParam
+ storage: BucketStorageParam
diff --git a/src/qca/forward/types/environment_create_params.py b/src/qca/forward/types/environment_create_params.py
index 671e0e2..042af32 100644
--- a/src/qca/forward/types/environment_create_params.py
+++ b/src/qca/forward/types/environment_create_params.py
@@ -1,9 +1,11 @@
from __future__ import annotations
-from typing import Any, Dict, Optional
+from typing import Any, Dict, Optional, Union
from typing_extensions import Required, TypedDict
+from .environment_config_param import EnvironmentConfigParam
+
__all__ = ["EnvironmentCreateParams"]
@@ -12,6 +14,6 @@ class EnvironmentCreateParams(TypedDict, total=False):
"""Select identity ownership with a PAT. Omit when using a SAT."""
name: Required[str]
description: Optional[str]
- config: Dict[str, Any]
+ config: Union[EnvironmentConfigParam, Dict[str, Any]]
metadata: Dict[str, Any]
idempotency_key: Optional[str]
diff --git a/src/qca/forward/types/environment_update_params.py b/src/qca/forward/types/environment_update_params.py
index 769f868..3e4d2b6 100644
--- a/src/qca/forward/types/environment_update_params.py
+++ b/src/qca/forward/types/environment_update_params.py
@@ -1,9 +1,11 @@
from __future__ import annotations
-from typing import Any, Dict, Optional
+from typing import Any, Dict, Optional, Union
from typing_extensions import TypedDict
+from .environment_config_param import EnvironmentConfigParam
+
__all__ = ["EnvironmentUpdateParams"]
@@ -12,5 +14,5 @@ class EnvironmentUpdateParams(TypedDict, total=False):
"""Select identity ownership with a PAT. Omit when using a SAT."""
name: Optional[str]
description: Optional[str]
- config: Dict[str, Any]
+ config: Union[EnvironmentConfigParam, Dict[str, Any]]
metadata: Dict[str, Any]
diff --git a/src/qca/forward/types/multiagent_entry.py b/src/qca/forward/types/multiagent_entry.py
index 920f69a..fff5487 100644
--- a/src/qca/forward/types/multiagent_entry.py
+++ b/src/qca/forward/types/multiagent_entry.py
@@ -8,6 +8,7 @@
class MultiagentEntry(BaseModel):
+ id: Optional[str] = None
type: Optional[str] = None
model: Optional[str] = None
template_id: Optional[str] = None
diff --git a/src/qca/forward/types/multiagent_entry_param.py b/src/qca/forward/types/multiagent_entry_param.py
index 6fedf64..d2a18cb 100644
--- a/src/qca/forward/types/multiagent_entry_param.py
+++ b/src/qca/forward/types/multiagent_entry_param.py
@@ -8,6 +8,7 @@
class MultiagentEntryParam(TypedDict, total=False):
+ id: Optional[str]
type: Required[str]
model: str
template_id: Optional[str]
diff --git a/src/qca/forward/types/session_config.py b/src/qca/forward/types/session_config.py
index 322c9e9..910d5ba 100644
--- a/src/qca/forward/types/session_config.py
+++ b/src/qca/forward/types/session_config.py
@@ -5,6 +5,7 @@
from qca.common._models import BaseModel
from .model_config import ModelConfig
+from .multiagent_config import MultiagentConfig
__all__ = ["SessionConfig"]
@@ -12,3 +13,4 @@
class SessionConfig(BaseModel):
model: Optional[Union[str, ModelConfig]] = None
environment_variables: Optional[Dict[str, str]] = None
+ multiagent: Optional[MultiagentConfig] = None
diff --git a/src/qca/forward/types/session_create_params.py b/src/qca/forward/types/session_create_params.py
index 0dcf7fa..d96573c 100644
--- a/src/qca/forward/types/session_create_params.py
+++ b/src/qca/forward/types/session_create_params.py
@@ -17,6 +17,8 @@ class SessionCreateParams(TypedDict, total=False):
budget: Optional[BudgetLimitParam]
identity_id: Required[str]
template_id: Required[str]
+ auto_title: bool
+ """Omit for false. When true, do not supply title (including null)."""
title: Optional[str]
metadata: Dict[str, Any]
config: SessionCreateParamsConfigParam
diff --git a/src/qca/forward/types/session_update_params_config_param.py b/src/qca/forward/types/session_update_params_config_param.py
index eaabd6b..d8d0cc2 100644
--- a/src/qca/forward/types/session_update_params_config_param.py
+++ b/src/qca/forward/types/session_update_params_config_param.py
@@ -5,6 +5,7 @@
from typing_extensions import TypedDict
from .model_config_param import ModelConfigParam
+from .multiagent_config_param import MultiagentConfigParam
__all__ = ["SessionUpdateParamsConfigParam"]
@@ -13,3 +14,5 @@ class SessionUpdateParamsConfigParam(TypedDict, total=False):
# Omit on create to inherit; None on update restores inheritance.
model: Optional[Union[str, ModelConfigParam]]
environment_variables: Dict[str, Any]
+ multiagent: Optional[MultiagentConfigParam]
+ """Omit to keep the roster; None clears it without restoring inheritance."""
diff --git a/src/qca/forward/types/template.py b/src/qca/forward/types/template.py
index 2a11cdb..ca57403 100644
--- a/src/qca/forward/types/template.py
+++ b/src/qca/forward/types/template.py
@@ -6,6 +6,7 @@
from qca.common._models import BaseModel
if TYPE_CHECKING:
+ from .a2a_config import A2AConfig
from .git_hub_repository import GitHubRepository
from .managed_tool_config import ManagedToolConfig
from .mcp_server import MCPServer
@@ -30,6 +31,7 @@ class Template(BaseModel):
updated_at: Optional[datetime] = None
model: Optional[Union[str, ModelConfig]] = None
multiagent: Optional[MultiagentConfig] = None
+ a2a: Optional[A2AConfig] = None
environment_id: Optional[str] = None
tunnel_id: Optional[str] = None
vaults: Optional[Dict[str, ResourceBinding]] = None
diff --git a/src/qca/forward/types/template_create_params.py b/src/qca/forward/types/template_create_params.py
index 6a52d55..5e133f1 100644
--- a/src/qca/forward/types/template_create_params.py
+++ b/src/qca/forward/types/template_create_params.py
@@ -5,6 +5,7 @@
from typing_extensions import Required, TypedDict
if TYPE_CHECKING:
+ from .a2a_config_param import A2AConfigParam
from .git_hub_repository_param import GitHubRepositoryParam
from .managed_tool_config_param import ManagedToolConfigParam
from .mcp_server_param import MCPServerParam
@@ -30,6 +31,7 @@ class TemplateCreateParams(TypedDict, total=False):
mcp_servers: List[MCPServerParam]
skills: List[SkillBindingParam]
multiagent: MultiagentConfigParam
+ a2a: Optional[A2AConfigParam]
vaults: Dict[str, ResourceBindingParam]
files: Dict[str, ResourceBindingParam]
github_repositories: Dict[str, GitHubRepositoryParam]
diff --git a/src/qca/forward/types/template_retrieve_agent_card_params.py b/src/qca/forward/types/template_retrieve_agent_card_params.py
new file mode 100644
index 0000000..1c5278f
--- /dev/null
+++ b/src/qca/forward/types/template_retrieve_agent_card_params.py
@@ -0,0 +1,12 @@
+from typing import Literal
+
+from typing_extensions import TypedDict
+
+__all__ = ["TemplateRetrieveAgentCardParams"]
+
+
+class TemplateRetrieveAgentCardParams(TypedDict, total=False):
+ identity_id: str
+ """Runtime identity selector for PAT authentication. Omit with SAT."""
+ a2a_version: Literal["0.3", "1.0"]
+ """Sent as A2A-Version; omission uses the server's 0.3 default."""
diff --git a/src/qca/forward/types/template_update_params.py b/src/qca/forward/types/template_update_params.py
index 6286393..e8c4cae 100644
--- a/src/qca/forward/types/template_update_params.py
+++ b/src/qca/forward/types/template_update_params.py
@@ -5,6 +5,7 @@
from typing_extensions import TypedDict
if TYPE_CHECKING:
+ from .a2a_config_param import A2AConfigParam
from .git_hub_repository_param import GitHubRepositoryParam
from .managed_tool_config_param import ManagedToolConfigParam
from .mcp_server_param import MCPServerParam
@@ -28,6 +29,7 @@ class TemplateUpdateParams(TypedDict, total=False):
mcp_servers: List[MCPServerParam]
skills: List[SkillBindingParam]
multiagent: MultiagentConfigParam
+ a2a: Optional[A2AConfigParam]
environment_id: Optional[str]
tunnel_id: Optional[str]
vaults: Dict[str, ResourceBindingParam]
diff --git a/src/qca/managed/resources/agents/agents.py b/src/qca/managed/resources/agents/agents.py
index 7b5453c..98ff8e7 100644
--- a/src/qca/managed/resources/agents/agents.py
+++ b/src/qca/managed/resources/agents/agents.py
@@ -13,6 +13,7 @@
from qca.managed.resources.agents.versions import AsyncVersions, Versions
from qca.managed.types.agent import Agent
from qca.managed.types.agent_toolset20260401_params import AgentToolset20260401Params
+from qca.managed.types.browser_toolset20260714_params import BrowserToolset20260714Params
from qca.managed.types.custom_skill_params import CustomSkillParams
from qca.managed.types.custom_tool_params import CustomToolParams
from qca.managed.types.mcp_toolset_params import MCPToolsetParams
@@ -42,7 +43,9 @@ def create(
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None, NotGiven] = NOT_GIVEN,
tools: Union[
- List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]], None, NotGiven
+ List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]],
+ None,
+ NotGiven,
] = NOT_GIVEN,
betas: Union[List[str], None, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
@@ -111,7 +114,9 @@ def update(
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None, NotGiven] = NOT_GIVEN,
tools: Union[
- List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]], None, NotGiven
+ List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]],
+ None,
+ NotGiven,
] = NOT_GIVEN,
model: Union[Union[str, ModelConfigParams], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
@@ -266,7 +271,9 @@ async def create(
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None, NotGiven] = NOT_GIVEN,
tools: Union[
- List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]], None, NotGiven
+ List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]],
+ None,
+ NotGiven,
] = NOT_GIVEN,
betas: Union[List[str], None, NotGiven] = NOT_GIVEN,
extra_headers: Dict[str, str] | None = None,
@@ -335,7 +342,9 @@ async def update(
metadata: Union[Dict[str, Any], None, NotGiven] = NOT_GIVEN,
skills: Union[List[Union[QoderSkillParams, CustomSkillParams]], None, NotGiven] = NOT_GIVEN,
tools: Union[
- List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]], None, NotGiven
+ List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]],
+ None,
+ NotGiven,
] = NOT_GIVEN,
model: Union[Union[str, ModelConfigParams], None, NotGiven] = NOT_GIVEN,
multiagent: Union[MultiagentParams, None, NotGiven] = NOT_GIVEN,
diff --git a/src/qca/managed/types/__init__.py b/src/qca/managed/types/__init__.py
index 1588586..0710304 100644
--- a/src/qca/managed/types/__init__.py
+++ b/src/qca/managed/types/__init__.py
@@ -48,10 +48,14 @@
from .agent_with_overrides_params import AgentWithOverridesParams as AgentWithOverridesParams
from .always_allow_policy_param import AlwaysAllowPolicyParam as AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam as AlwaysAskPolicyParam
+from .always_deny_policy import AlwaysDenyPolicy as AlwaysDenyPolicy
+from .always_deny_policy_param import AlwaysDenyPolicyParam as AlwaysDenyPolicyParam
from .base64_document_source_param import Base64DocumentSourceParam as Base64DocumentSourceParam
from .base64_image_source_param import Base64ImageSourceParam as Base64ImageSourceParam
from .bash_tool_config_params import BashToolConfigParams as BashToolConfigParams
from .branch_checkout_param import BranchCheckoutParam as BranchCheckoutParam
+from .browser_toolset20260714 import BrowserToolset20260714 as BrowserToolset20260714
+from .browser_toolset20260714_params import BrowserToolset20260714Params as BrowserToolset20260714Params
from .bucket_storage import BucketStorage as BucketStorage
from .bucket_storage import BucketStorageParam as BucketStorageParam
from .bucket_storage import OSSAccessKeyCredentialParam as OSSAccessKeyCredentialParam
@@ -84,6 +88,8 @@
from .deleted_skill import DeletedSkill as DeletedSkill
from .deleted_skill_version import DeletedSkillVersion as DeletedSkillVersion
from .deleted_vault import DeletedVault as DeletedVault
+from .deliver_artifacts_tool_config import DeliverArtifactsToolConfig as DeliverArtifactsToolConfig
+from .deliver_artifacts_tool_config_params import DeliverArtifactsToolConfigParams as DeliverArtifactsToolConfigParams
from .delta_content import DeltaContent as DeltaContent
from .deployment import Deployment as Deployment
from .deployment_archive_params import DeploymentArchiveParams as DeploymentArchiveParams
@@ -184,6 +190,10 @@
from .glob_tool_config_params import GlobToolConfigParams as GlobToolConfigParams
from .grep_tool_config_params import GrepToolConfigParams as GrepToolConfigParams
from .image_block_param import ImageBlockParam as ImageBlockParam
+from .image_gen_tool_config import ImageGenToolConfig as ImageGenToolConfig
+from .image_gen_tool_config_params import ImageGenToolConfigParams as ImageGenToolConfigParams
+from .image_search_tool_config import ImageSearchToolConfig as ImageSearchToolConfig
+from .image_search_tool_config_params import ImageSearchToolConfigParams as ImageSearchToolConfigParams
from .injection_location_params import InjectionLocationParams as InjectionLocationParams
from .injection_location_response import InjectionLocationResponse as InjectionLocationResponse
from .injection_location_update_params import InjectionLocationUpdateParams as InjectionLocationUpdateParams
@@ -426,6 +436,8 @@
from .vault_list_params import VaultListParams as VaultListParams
from .vault_retrieve_params import VaultRetrieveParams as VaultRetrieveParams
from .vault_search_params import VaultSearchParams as VaultSearchParams
+from .video_gen_tool_config import VideoGenToolConfig as VideoGenToolConfig
+from .video_gen_tool_config_params import VideoGenToolConfigParams as VideoGenToolConfigParams
from .web_fetch_tool_config_params import WebFetchToolConfigParams as WebFetchToolConfigParams
from .web_search_tool_config_params import WebSearchToolConfigParams as WebSearchToolConfigParams
from .write_tool_config_params import WriteToolConfigParams as WriteToolConfigParams
diff --git a/src/qca/managed/types/agent.py b/src/qca/managed/types/agent.py
index 7a72708..cfcdf1c 100644
--- a/src/qca/managed/types/agent.py
+++ b/src/qca/managed/types/agent.py
@@ -8,6 +8,7 @@
if TYPE_CHECKING:
from .agent_skill_union import AgentSkillUnion
from .agent_tool_union import AgentToolUnion
+ from .browser_toolset20260714 import BrowserToolset20260714
from .mcp_server_url_definition import MCPServerURLDefinition
from .model_config import ModelConfig
from .multiagent import Multiagent
@@ -27,7 +28,7 @@ class Agent(BaseModel):
name: Optional[str] = None
skills: Optional[List[AgentSkillUnion]] = None
system: Optional[str] = None
- tools: Optional[List[AgentToolUnion]] = None
+ tools: Optional[List[Union[BrowserToolset20260714, AgentToolUnion]]] = None
type: Optional[str] = None
updated_at: Optional[datetime] = None
version: Optional[int] = None
diff --git a/src/qca/managed/types/agent_create_params.py b/src/qca/managed/types/agent_create_params.py
index 49e3459..dad2073 100644
--- a/src/qca/managed/types/agent_create_params.py
+++ b/src/qca/managed/types/agent_create_params.py
@@ -6,6 +6,7 @@
if TYPE_CHECKING:
from .agent_toolset20260401_params import AgentToolset20260401Params
+ from .browser_toolset20260714_params import BrowserToolset20260714Params
from .custom_skill_params import CustomSkillParams
from .custom_tool_params import CustomToolParams
from .mcp_toolset_params import MCPToolsetParams
@@ -27,5 +28,5 @@ class AgentCreateParams(TypedDict, total=False):
metadata: Dict[str, str]
multiagent: MultiagentParams
skills: List[Union[QoderSkillParams, CustomSkillParams]]
- tools: List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]]
+ tools: List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]]
betas: List[str]
diff --git a/src/qca/managed/types/agent_tool_union.py b/src/qca/managed/types/agent_tool_union.py
index 6d42021..0b3ab4c 100644
--- a/src/qca/managed/types/agent_tool_union.py
+++ b/src/qca/managed/types/agent_tool_union.py
@@ -6,9 +6,14 @@
if TYPE_CHECKING:
from .agent_tool_config_union import AgentToolConfigUnion
+ from .agent_tool_config_union_permission_policy import AgentToolConfigUnionPermissionPolicy
from .agent_tool_union_default_config import AgentToolUnionDefaultConfig
from .custom_tool_input_schema import CustomToolInputSchema
+ from .deliver_artifacts_tool_config import DeliverArtifactsToolConfig
+ from .image_gen_tool_config import ImageGenToolConfig
+ from .image_search_tool_config import ImageSearchToolConfig
from .mcp_tool_config import MCPToolConfig
+ from .video_gen_tool_config import VideoGenToolConfig
__all__ = ["AgentToolUnion"]
@@ -16,10 +21,26 @@
class AgentToolUnion(BaseModel):
enabled_tools: Optional[List[str]] = None
disallowed_tools: Optional[List[str]] = None
- configs: Optional[Union[List[AgentToolConfigUnion], List[MCPToolConfig]]] = None
+ configs: Optional[
+ Union[
+ List[
+ Union[
+ ImageGenToolConfig,
+ ImageSearchToolConfig,
+ VideoGenToolConfig,
+ DeliverArtifactsToolConfig,
+ AgentToolConfigUnion,
+ ]
+ ],
+ List[MCPToolConfig],
+ ]
+ ] = None
default_config: Optional[AgentToolUnionDefaultConfig] = None
type: Optional[str] = None
mcp_server_name: Optional[str] = None
+ permission_policy: Optional[AgentToolConfigUnionPermissionPolicy] = None
+ """For MCP, the server-wide default is read from this top-level field, not default_config."""
+
description: Optional[str] = None
input_schema: Optional[CustomToolInputSchema] = None
name: Optional[str] = None
diff --git a/src/qca/managed/types/agent_toolset20260401_params.py b/src/qca/managed/types/agent_toolset20260401_params.py
index 832716a..8f3fb90 100644
--- a/src/qca/managed/types/agent_toolset20260401_params.py
+++ b/src/qca/managed/types/agent_toolset20260401_params.py
@@ -7,10 +7,14 @@
if TYPE_CHECKING:
from .agent_toolset_default_config_params import AgentToolsetDefaultConfigParams
from .bash_tool_config_params import BashToolConfigParams
+ from .deliver_artifacts_tool_config_params import DeliverArtifactsToolConfigParams
from .edit_tool_config_params import EditToolConfigParams
from .glob_tool_config_params import GlobToolConfigParams
from .grep_tool_config_params import GrepToolConfigParams
+ from .image_gen_tool_config_params import ImageGenToolConfigParams
+ from .image_search_tool_config_params import ImageSearchToolConfigParams
from .read_tool_config_params import ReadToolConfigParams
+ from .video_gen_tool_config_params import VideoGenToolConfigParams
from .web_fetch_tool_config_params import WebFetchToolConfigParams
from .web_search_tool_config_params import WebSearchToolConfigParams
from .write_tool_config_params import WriteToolConfigParams
@@ -32,6 +36,10 @@ class AgentToolset20260401Params(TypedDict, total=False):
GrepToolConfigParams,
WebFetchToolConfigParams,
WebSearchToolConfigParams,
+ ImageGenToolConfigParams,
+ ImageSearchToolConfigParams,
+ VideoGenToolConfigParams,
+ DeliverArtifactsToolConfigParams,
]
]
default_config: AgentToolsetDefaultConfigParams
diff --git a/src/qca/managed/types/agent_toolset_default_config_params.py b/src/qca/managed/types/agent_toolset_default_config_params.py
index cf69b78..d8b54b9 100644
--- a/src/qca/managed/types/agent_toolset_default_config_params.py
+++ b/src/qca/managed/types/agent_toolset_default_config_params.py
@@ -7,10 +7,11 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["AgentToolsetDefaultConfigParams"]
class AgentToolsetDefaultConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
diff --git a/src/qca/managed/types/agent_update_params.py b/src/qca/managed/types/agent_update_params.py
index ad85fcb..8e30f06 100644
--- a/src/qca/managed/types/agent_update_params.py
+++ b/src/qca/managed/types/agent_update_params.py
@@ -6,6 +6,7 @@
if TYPE_CHECKING:
from .agent_toolset20260401_params import AgentToolset20260401Params
+ from .browser_toolset20260714_params import BrowserToolset20260714Params
from .custom_skill_params import CustomSkillParams
from .custom_tool_params import CustomToolParams
from .mcp_toolset_params import MCPToolsetParams
@@ -26,7 +27,7 @@ class AgentUpdateParams(TypedDict, total=False):
mcp_servers: List[URLMCPServerParams]
metadata: Dict[str, Any]
skills: List[Union[QoderSkillParams, CustomSkillParams]]
- tools: List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]]
+ tools: List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]]
model: Union[str, ModelConfigParams]
multiagent: MultiagentParams
betas: List[str]
diff --git a/src/qca/managed/types/agent_with_overrides_params.py b/src/qca/managed/types/agent_with_overrides_params.py
index d785819..ec4286a 100644
--- a/src/qca/managed/types/agent_with_overrides_params.py
+++ b/src/qca/managed/types/agent_with_overrides_params.py
@@ -6,6 +6,7 @@
if TYPE_CHECKING:
from .agent_toolset20260401_params import AgentToolset20260401Params
+ from .browser_toolset20260714_params import BrowserToolset20260714Params
from .custom_skill_params import CustomSkillParams
from .custom_tool_params import CustomToolParams
from .mcp_toolset_params import MCPToolsetParams
@@ -24,4 +25,4 @@ class AgentWithOverridesParams(TypedDict, total=False):
mcp_servers: List[URLMCPServerParams]
model: Union[str, ModelConfigParams]
skills: List[Union[QoderSkillParams, CustomSkillParams]]
- tools: List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]]
+ tools: List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]]
diff --git a/src/qca/managed/types/always_deny_policy.py b/src/qca/managed/types/always_deny_policy.py
new file mode 100644
index 0000000..f8b70f3
--- /dev/null
+++ b/src/qca/managed/types/always_deny_policy.py
@@ -0,0 +1,9 @@
+from typing import Literal
+
+from qca.common._models import BaseModel
+
+__all__ = ["AlwaysDenyPolicy"]
+
+
+class AlwaysDenyPolicy(BaseModel):
+ type: Literal["always_deny"]
diff --git a/src/qca/managed/types/always_deny_policy_param.py b/src/qca/managed/types/always_deny_policy_param.py
new file mode 100644
index 0000000..a5165a0
--- /dev/null
+++ b/src/qca/managed/types/always_deny_policy_param.py
@@ -0,0 +1,11 @@
+from __future__ import annotations
+
+from typing import Literal
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["AlwaysDenyPolicyParam"]
+
+
+class AlwaysDenyPolicyParam(TypedDict, total=False):
+ type: Required[Literal["always_deny"]]
diff --git a/src/qca/managed/types/bash_tool_config_params.py b/src/qca/managed/types/bash_tool_config_params.py
index 856b9a5..e32e0b9 100644
--- a/src/qca/managed/types/bash_tool_config_params.py
+++ b/src/qca/managed/types/bash_tool_config_params.py
@@ -7,12 +7,13 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["BashToolConfigParams"]
class BashToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
type: Literal["bash"]
name: Literal["bash"]
diff --git a/src/qca/managed/types/browser_toolset20260714.py b/src/qca/managed/types/browser_toolset20260714.py
new file mode 100644
index 0000000..d6d8330
--- /dev/null
+++ b/src/qca/managed/types/browser_toolset20260714.py
@@ -0,0 +1,11 @@
+from typing import Literal
+
+from qca.common._models import BaseModel
+
+__all__ = ["BrowserToolset20260714"]
+
+
+class BrowserToolset20260714(BaseModel):
+ """Browser snapshot; future response fields remain available as extras."""
+
+ type: Literal["browser_toolset_20260714"]
diff --git a/src/qca/managed/types/browser_toolset20260714_params.py b/src/qca/managed/types/browser_toolset20260714_params.py
new file mode 100644
index 0000000..603a4a2
--- /dev/null
+++ b/src/qca/managed/types/browser_toolset20260714_params.py
@@ -0,0 +1,11 @@
+from typing import Literal
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["BrowserToolset20260714Params"]
+
+
+class BrowserToolset20260714Params(TypedDict, total=False):
+ """Type-only toolset, gated by the browser-use-2026-07-14 beta header."""
+
+ type: Required[Literal["browser_toolset_20260714"]]
diff --git a/src/qca/managed/types/deliver_artifacts_tool_config.py b/src/qca/managed/types/deliver_artifacts_tool_config.py
new file mode 100644
index 0000000..8f77168
--- /dev/null
+++ b/src/qca/managed/types/deliver_artifacts_tool_config.py
@@ -0,0 +1,15 @@
+from __future__ import annotations
+
+from typing import Literal, Optional
+
+from qca.common._models import BaseModel
+
+from .agent_tool_config_union_permission_policy import AgentToolConfigUnionPermissionPolicy
+
+__all__ = ["DeliverArtifactsToolConfig"]
+
+
+class DeliverArtifactsToolConfig(BaseModel):
+ name: Literal["DeliverArtifacts", "deliver_artifacts"]
+ enabled: Optional[bool] = None
+ permission_policy: Optional[AgentToolConfigUnionPermissionPolicy] = None
diff --git a/src/qca/managed/types/deliver_artifacts_tool_config_params.py b/src/qca/managed/types/deliver_artifacts_tool_config_params.py
new file mode 100644
index 0000000..6e98d7e
--- /dev/null
+++ b/src/qca/managed/types/deliver_artifacts_tool_config_params.py
@@ -0,0 +1,18 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Literal, Union
+
+from typing_extensions import Required, TypedDict
+
+if TYPE_CHECKING:
+ from .always_allow_policy_param import AlwaysAllowPolicyParam
+ from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
+
+__all__ = ["DeliverArtifactsToolConfigParams"]
+
+
+class DeliverArtifactsToolConfigParams(TypedDict, total=False):
+ name: Required[Literal["DeliverArtifacts", "deliver_artifacts"]]
+ enabled: bool
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
diff --git a/src/qca/managed/types/edit_tool_config_params.py b/src/qca/managed/types/edit_tool_config_params.py
index 2e508ea..f1a5b96 100644
--- a/src/qca/managed/types/edit_tool_config_params.py
+++ b/src/qca/managed/types/edit_tool_config_params.py
@@ -7,12 +7,13 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["EditToolConfigParams"]
class EditToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
type: Literal["edit"]
name: Literal["edit"]
diff --git a/src/qca/managed/types/glob_tool_config_params.py b/src/qca/managed/types/glob_tool_config_params.py
index 8b2c3b2..07cfeec 100644
--- a/src/qca/managed/types/glob_tool_config_params.py
+++ b/src/qca/managed/types/glob_tool_config_params.py
@@ -7,12 +7,13 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["GlobToolConfigParams"]
class GlobToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
type: Literal["glob"]
name: Literal["glob"]
diff --git a/src/qca/managed/types/grep_tool_config_params.py b/src/qca/managed/types/grep_tool_config_params.py
index b46519a..9edd907 100644
--- a/src/qca/managed/types/grep_tool_config_params.py
+++ b/src/qca/managed/types/grep_tool_config_params.py
@@ -7,12 +7,13 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["GrepToolConfigParams"]
class GrepToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
type: Literal["grep"]
name: Literal["grep"]
diff --git a/src/qca/managed/types/image_gen_tool_config.py b/src/qca/managed/types/image_gen_tool_config.py
new file mode 100644
index 0000000..3143c32
--- /dev/null
+++ b/src/qca/managed/types/image_gen_tool_config.py
@@ -0,0 +1,15 @@
+from __future__ import annotations
+
+from typing import Literal, Optional
+
+from qca.common._models import BaseModel
+
+from .agent_tool_config_union_permission_policy import AgentToolConfigUnionPermissionPolicy
+
+__all__ = ["ImageGenToolConfig"]
+
+
+class ImageGenToolConfig(BaseModel):
+ name: Literal["ImageGen", "image_gen"]
+ enabled: Optional[bool] = None
+ permission_policy: Optional[AgentToolConfigUnionPermissionPolicy] = None
diff --git a/src/qca/managed/types/image_gen_tool_config_params.py b/src/qca/managed/types/image_gen_tool_config_params.py
new file mode 100644
index 0000000..4fb1a58
--- /dev/null
+++ b/src/qca/managed/types/image_gen_tool_config_params.py
@@ -0,0 +1,18 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Literal, Union
+
+from typing_extensions import Required, TypedDict
+
+if TYPE_CHECKING:
+ from .always_allow_policy_param import AlwaysAllowPolicyParam
+ from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
+
+__all__ = ["ImageGenToolConfigParams"]
+
+
+class ImageGenToolConfigParams(TypedDict, total=False):
+ name: Required[Literal["ImageGen", "image_gen"]]
+ enabled: bool
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
diff --git a/src/qca/managed/types/image_search_tool_config.py b/src/qca/managed/types/image_search_tool_config.py
new file mode 100644
index 0000000..4d720ba
--- /dev/null
+++ b/src/qca/managed/types/image_search_tool_config.py
@@ -0,0 +1,15 @@
+from __future__ import annotations
+
+from typing import Literal, Optional
+
+from qca.common._models import BaseModel
+
+from .agent_tool_config_union_permission_policy import AgentToolConfigUnionPermissionPolicy
+
+__all__ = ["ImageSearchToolConfig"]
+
+
+class ImageSearchToolConfig(BaseModel):
+ name: Literal["ImageSearch", "image_search"]
+ enabled: Optional[bool] = None
+ permission_policy: Optional[AgentToolConfigUnionPermissionPolicy] = None
diff --git a/src/qca/managed/types/image_search_tool_config_params.py b/src/qca/managed/types/image_search_tool_config_params.py
new file mode 100644
index 0000000..f094533
--- /dev/null
+++ b/src/qca/managed/types/image_search_tool_config_params.py
@@ -0,0 +1,18 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Literal, Union
+
+from typing_extensions import Required, TypedDict
+
+if TYPE_CHECKING:
+ from .always_allow_policy_param import AlwaysAllowPolicyParam
+ from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
+
+__all__ = ["ImageSearchToolConfigParams"]
+
+
+class ImageSearchToolConfigParams(TypedDict, total=False):
+ name: Required[Literal["ImageSearch", "image_search"]]
+ enabled: bool
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
diff --git a/src/qca/managed/types/mcp_tool_config_params.py b/src/qca/managed/types/mcp_tool_config_params.py
index 5d18f98..f843c4c 100644
--- a/src/qca/managed/types/mcp_tool_config_params.py
+++ b/src/qca/managed/types/mcp_tool_config_params.py
@@ -7,6 +7,7 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["MCPToolConfigParams"]
@@ -14,4 +15,4 @@
class MCPToolConfigParams(TypedDict, total=False):
name: Required[str]
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
diff --git a/src/qca/managed/types/mcp_toolset_default_config_params.py b/src/qca/managed/types/mcp_toolset_default_config_params.py
index 6a4384b..49e8dcb 100644
--- a/src/qca/managed/types/mcp_toolset_default_config_params.py
+++ b/src/qca/managed/types/mcp_toolset_default_config_params.py
@@ -7,10 +7,14 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["MCPToolsetDefaultConfigParams"]
class MCPToolsetDefaultConfigParams(TypedDict, total=False):
+ """Legacy payload compatibility; MCP defaults use the toolset's top-level permission_policy."""
+
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
+ """Retained as-is; this nested field does not set the MCP server-wide policy."""
diff --git a/src/qca/managed/types/mcp_toolset_params.py b/src/qca/managed/types/mcp_toolset_params.py
index c347d3e..cd563e5 100644
--- a/src/qca/managed/types/mcp_toolset_params.py
+++ b/src/qca/managed/types/mcp_toolset_params.py
@@ -1,10 +1,13 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, List, Literal
+from typing import TYPE_CHECKING, List, Literal, Union
from typing_extensions import Required, TypedDict
if TYPE_CHECKING:
+ from .always_allow_policy_param import AlwaysAllowPolicyParam
+ from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
from .mcp_tool_config_params import MCPToolConfigParams
from .mcp_toolset_default_config_params import MCPToolsetDefaultConfigParams
@@ -12,7 +15,13 @@
class MCPToolsetParams(TypedDict, total=False):
+ """MCP governance reads the server-wide policy from top-level permission_policy."""
+
mcp_server_name: Required[str]
type: Required[Literal["mcp_toolset"]]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
+ """Server-wide default: always_allow, always_ask or always_deny; omission defaults to allow."""
+
configs: List[MCPToolConfigParams]
default_config: MCPToolsetDefaultConfigParams
+ """Legacy payload compatibility only; nested permission_policy does not set the MCP default."""
diff --git a/src/qca/managed/types/read_tool_config_params.py b/src/qca/managed/types/read_tool_config_params.py
index b0338fc..525e5b6 100644
--- a/src/qca/managed/types/read_tool_config_params.py
+++ b/src/qca/managed/types/read_tool_config_params.py
@@ -7,12 +7,13 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["ReadToolConfigParams"]
class ReadToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
type: Literal["read"]
name: Literal["read"]
diff --git a/src/qca/managed/types/session_agent.py b/src/qca/managed/types/session_agent.py
index 0867d56..77d5495 100644
--- a/src/qca/managed/types/session_agent.py
+++ b/src/qca/managed/types/session_agent.py
@@ -5,6 +5,7 @@
from qca.common._models import BaseModel
if TYPE_CHECKING:
+ from .browser_toolset20260714 import BrowserToolset20260714
from .mcp_server_url_definition import MCPServerURLDefinition
from .model_config import ModelConfig
from .session_agent_skill_union import SessionAgentSkillUnion
@@ -23,6 +24,6 @@ class SessionAgent(BaseModel):
name: Optional[str] = None
skills: Optional[List[SessionAgentSkillUnion]] = None
system: Optional[str] = None
- tools: Optional[List[SessionAgentToolUnion]] = None
+ tools: Optional[List[Union[BrowserToolset20260714, SessionAgentToolUnion]]] = None
type: Optional[str] = None
version: Optional[int] = None
diff --git a/src/qca/managed/types/session_agent_tool_union.py b/src/qca/managed/types/session_agent_tool_union.py
index 21be8b5..c7ee03b 100644
--- a/src/qca/managed/types/session_agent_tool_union.py
+++ b/src/qca/managed/types/session_agent_tool_union.py
@@ -6,9 +6,14 @@
if TYPE_CHECKING:
from .agent_tool_config_union import AgentToolConfigUnion
+ from .agent_tool_config_union_permission_policy import AgentToolConfigUnionPermissionPolicy
from .custom_tool_input_schema import CustomToolInputSchema
+ from .deliver_artifacts_tool_config import DeliverArtifactsToolConfig
+ from .image_gen_tool_config import ImageGenToolConfig
+ from .image_search_tool_config import ImageSearchToolConfig
from .mcp_tool_config import MCPToolConfig
from .session_agent_tool_union_default_config import SessionAgentToolUnionDefaultConfig
+ from .video_gen_tool_config import VideoGenToolConfig
__all__ = ["SessionAgentToolUnion"]
@@ -16,10 +21,26 @@
class SessionAgentToolUnion(BaseModel):
enabled_tools: Optional[List[str]] = None
disallowed_tools: Optional[List[str]] = None
- configs: Optional[Union[List[AgentToolConfigUnion], List[MCPToolConfig]]] = None
+ configs: Optional[
+ Union[
+ List[
+ Union[
+ ImageGenToolConfig,
+ ImageSearchToolConfig,
+ VideoGenToolConfig,
+ DeliverArtifactsToolConfig,
+ AgentToolConfigUnion,
+ ]
+ ],
+ List[MCPToolConfig],
+ ]
+ ] = None
default_config: Optional[SessionAgentToolUnionDefaultConfig] = None
type: Optional[str] = None
mcp_server_name: Optional[str] = None
+ permission_policy: Optional[AgentToolConfigUnionPermissionPolicy] = None
+ """For MCP, the server-wide default is read from this top-level field, not default_config."""
+
description: Optional[str] = None
input_schema: Optional[CustomToolInputSchema] = None
name: Optional[str] = None
diff --git a/src/qca/managed/types/session_agent_update_param.py b/src/qca/managed/types/session_agent_update_param.py
index ec7ece3..29a158a 100644
--- a/src/qca/managed/types/session_agent_update_param.py
+++ b/src/qca/managed/types/session_agent_update_param.py
@@ -6,6 +6,7 @@
if TYPE_CHECKING:
from .agent_toolset20260401_params import AgentToolset20260401Params
+ from .browser_toolset20260714_params import BrowserToolset20260714Params
from .custom_skill_params import CustomSkillParams
from .custom_tool_params import CustomToolParams
from .mcp_toolset_params import MCPToolsetParams
@@ -21,4 +22,4 @@ class SessionAgentUpdateParam(TypedDict, total=False):
system: Optional[str]
skills: List[Union[QoderSkillParams, CustomSkillParams]]
mcp_servers: List[URLMCPServerParams]
- tools: List[Union[AgentToolset20260401Params, MCPToolsetParams, CustomToolParams]]
+ tools: List[Union[AgentToolset20260401Params, BrowserToolset20260714Params, MCPToolsetParams, CustomToolParams]]
diff --git a/src/qca/managed/types/session_multiagent_coordinator_agent_union.py b/src/qca/managed/types/session_multiagent_coordinator_agent_union.py
index 6fff1a0..71e54f0 100644
--- a/src/qca/managed/types/session_multiagent_coordinator_agent_union.py
+++ b/src/qca/managed/types/session_multiagent_coordinator_agent_union.py
@@ -5,6 +5,7 @@
from qca.common._models import BaseModel
if TYPE_CHECKING:
+ from .browser_toolset20260714 import BrowserToolset20260714
from .mcp_server_url_definition import MCPServerURLDefinition
from .model_config import ModelConfig
from .session_thread_agent_skill_union import SessionThreadAgentSkillUnion
@@ -21,6 +22,6 @@ class SessionMultiagentCoordinatorAgentUnion(BaseModel):
name: Optional[str] = None
skills: Optional[List[SessionThreadAgentSkillUnion]] = None
system: Optional[str] = None
- tools: Optional[List[SessionThreadAgentToolUnion]] = None
+ tools: Optional[List[Union[BrowserToolset20260714, SessionThreadAgentToolUnion]]] = None
type: Optional[str] = None
version: Optional[int] = None
diff --git a/src/qca/managed/types/session_thread_agent_tool_union.py b/src/qca/managed/types/session_thread_agent_tool_union.py
index d8cdb3e..cd62e6c 100644
--- a/src/qca/managed/types/session_thread_agent_tool_union.py
+++ b/src/qca/managed/types/session_thread_agent_tool_union.py
@@ -6,9 +6,14 @@
if TYPE_CHECKING:
from .agent_tool_config_union import AgentToolConfigUnion
+ from .agent_tool_config_union_permission_policy import AgentToolConfigUnionPermissionPolicy
from .custom_tool_input_schema import CustomToolInputSchema
+ from .deliver_artifacts_tool_config import DeliverArtifactsToolConfig
+ from .image_gen_tool_config import ImageGenToolConfig
+ from .image_search_tool_config import ImageSearchToolConfig
from .mcp_tool_config import MCPToolConfig
from .session_thread_agent_tool_union_default_config import SessionThreadAgentToolUnionDefaultConfig
+ from .video_gen_tool_config import VideoGenToolConfig
__all__ = ["SessionThreadAgentToolUnion"]
@@ -16,10 +21,26 @@
class SessionThreadAgentToolUnion(BaseModel):
enabled_tools: Optional[List[str]] = None
disallowed_tools: Optional[List[str]] = None
- configs: Optional[Union[List[AgentToolConfigUnion], List[MCPToolConfig]]] = None
+ configs: Optional[
+ Union[
+ List[
+ Union[
+ ImageGenToolConfig,
+ ImageSearchToolConfig,
+ VideoGenToolConfig,
+ DeliverArtifactsToolConfig,
+ AgentToolConfigUnion,
+ ]
+ ],
+ List[MCPToolConfig],
+ ]
+ ] = None
default_config: Optional[SessionThreadAgentToolUnionDefaultConfig] = None
type: Optional[str] = None
mcp_server_name: Optional[str] = None
+ permission_policy: Optional[AgentToolConfigUnionPermissionPolicy] = None
+ """For MCP, the server-wide default is read from this top-level field, not default_config."""
+
description: Optional[str] = None
input_schema: Optional[CustomToolInputSchema] = None
name: Optional[str] = None
diff --git a/src/qca/managed/types/session_thread_agent_union.py b/src/qca/managed/types/session_thread_agent_union.py
index 2090560..3138e36 100644
--- a/src/qca/managed/types/session_thread_agent_union.py
+++ b/src/qca/managed/types/session_thread_agent_union.py
@@ -5,6 +5,7 @@
from qca.common._models import BaseModel
if TYPE_CHECKING:
+ from .browser_toolset20260714 import BrowserToolset20260714
from .mcp_server_url_definition import MCPServerURLDefinition
from .model_config import ModelConfig
from .session_thread_agent_skill_union import SessionThreadAgentSkillUnion
@@ -21,6 +22,6 @@ class SessionThreadAgentUnion(BaseModel):
name: Optional[str] = None
skills: Optional[List[SessionThreadAgentSkillUnion]] = None
system: Optional[str] = None
- tools: Optional[List[SessionThreadAgentToolUnion]] = None
+ tools: Optional[List[Union[BrowserToolset20260714, SessionThreadAgentToolUnion]]] = None
type: Optional[str] = None
version: Optional[int] = None
diff --git a/src/qca/managed/types/video_gen_tool_config.py b/src/qca/managed/types/video_gen_tool_config.py
new file mode 100644
index 0000000..87fb133
--- /dev/null
+++ b/src/qca/managed/types/video_gen_tool_config.py
@@ -0,0 +1,15 @@
+from __future__ import annotations
+
+from typing import Literal, Optional
+
+from qca.common._models import BaseModel
+
+from .agent_tool_config_union_permission_policy import AgentToolConfigUnionPermissionPolicy
+
+__all__ = ["VideoGenToolConfig"]
+
+
+class VideoGenToolConfig(BaseModel):
+ name: Literal["VideoGen", "video_gen"]
+ enabled: Optional[bool] = None
+ permission_policy: Optional[AgentToolConfigUnionPermissionPolicy] = None
diff --git a/src/qca/managed/types/video_gen_tool_config_params.py b/src/qca/managed/types/video_gen_tool_config_params.py
new file mode 100644
index 0000000..288ef65
--- /dev/null
+++ b/src/qca/managed/types/video_gen_tool_config_params.py
@@ -0,0 +1,18 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Literal, Union
+
+from typing_extensions import Required, TypedDict
+
+if TYPE_CHECKING:
+ from .always_allow_policy_param import AlwaysAllowPolicyParam
+ from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
+
+__all__ = ["VideoGenToolConfigParams"]
+
+
+class VideoGenToolConfigParams(TypedDict, total=False):
+ name: Required[Literal["VideoGen", "video_gen"]]
+ enabled: bool
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
diff --git a/src/qca/managed/types/web_fetch_tool_config_params.py b/src/qca/managed/types/web_fetch_tool_config_params.py
index 447d94b..8b70bce 100644
--- a/src/qca/managed/types/web_fetch_tool_config_params.py
+++ b/src/qca/managed/types/web_fetch_tool_config_params.py
@@ -7,6 +7,7 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["WebFetchToolConfigParams"]
@@ -14,7 +15,7 @@
class WebFetchToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
max_content_tokens: Optional[int]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
allowed_domains: List[str]
blocked_domains: List[str]
type: Literal["web_fetch"]
diff --git a/src/qca/managed/types/web_search_tool_config_params.py b/src/qca/managed/types/web_search_tool_config_params.py
index 135105a..0800da6 100644
--- a/src/qca/managed/types/web_search_tool_config_params.py
+++ b/src/qca/managed/types/web_search_tool_config_params.py
@@ -7,6 +7,7 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
from .user_location_param import UserLocationParam
__all__ = ["WebSearchToolConfigParams"]
@@ -14,7 +15,7 @@
class WebSearchToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
allowed_domains: List[str]
blocked_domains: List[str]
type: Literal["web_search"]
diff --git a/src/qca/managed/types/write_tool_config_params.py b/src/qca/managed/types/write_tool_config_params.py
index 0b785b1..3482ae5 100644
--- a/src/qca/managed/types/write_tool_config_params.py
+++ b/src/qca/managed/types/write_tool_config_params.py
@@ -7,12 +7,13 @@
if TYPE_CHECKING:
from .always_allow_policy_param import AlwaysAllowPolicyParam
from .always_ask_policy_param import AlwaysAskPolicyParam
+ from .always_deny_policy_param import AlwaysDenyPolicyParam
__all__ = ["WriteToolConfigParams"]
class WriteToolConfigParams(TypedDict, total=False):
enabled: Optional[bool]
- permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam]
+ permission_policy: Union[AlwaysAllowPolicyParam, AlwaysAskPolicyParam, AlwaysDenyPolicyParam]
type: Literal["write"]
name: Literal["write"]
diff --git a/tests/fixtures/api-contracts.json b/tests/fixtures/api-contracts.json
index 8f29167..5fade72 100644
--- a/tests/fixtures/api-contracts.json
+++ b/tests/fixtures/api-contracts.json
@@ -923,6 +923,19 @@
],
"kind": "model"
},
+ {
+ "id": "forward.templates.retrieve_agent_card",
+ "method": "GET",
+ "path": "/templates/{template_id}/a2a/agent-card.json",
+ "required": [
+ "template_id"
+ ],
+ "kind": "model",
+ "source": {
+ "documentation": "https://docs.qoder.com/cloud-agents/a2a-integration",
+ "service_test": "forward-current/internal/handler/a2a/handler_test.go:288-315"
+ }
+ },
{
"id": "forward.templates.update",
"method": "POST",
diff --git a/tests/test_capability_parity.py b/tests/test_capability_parity.py
new file mode 100644
index 0000000..a6c9e28
--- /dev/null
+++ b/tests/test_capability_parity.py
@@ -0,0 +1,837 @@
+"""Offline contracts from cached Forward/CAS handlers and official API docs.
+
+Forward: session/create.go:968, handler/session/handler.go:128,
+templatea2a/config.go:15-122, handler/a2a/handler_test.go:288-315.
+CAS: agent/helpers.go:59-327, agent/service.go:598,621-648,
+mcp/rules.go:232-279 and mcp/validate.go:129-166. OSS read/write shapes:
+official-docs/api/forward/environments/schemas.txt:101-116.
+MCP mocks verify serialization and snapshots, not actual tool execution.
+"""
+
+from __future__ import annotations
+
+import inspect
+import json
+from contextlib import asynccontextmanager
+from typing import get_type_hints
+
+import httpx
+import pytest
+from pydantic import TypeAdapter, ValidationError
+
+from qca import APIResponseValidationError, AsyncForward, AsyncManaged, BadRequestError, Forward, Managed, __version__
+from qca.common._types import NOT_GIVEN
+from qca.forward import types as ft
+from qca.managed import types as mt
+
+SEGMENT = "id /?%# +"
+ESCAPED = "id%20%2F%3F%25%23%20%2B"
+SKILL = {"id": "summary", "name": "Summarize", "description": "Summarize text", "tags": [], "examples": []}
+PUBLICATION = {"enabled": True, "description": "Public summary", "skills": [SKILL]}
+ROSTER = {
+ "type": "coordinator",
+ "agents": [
+ "tmpl_child",
+ {"type": "agent", "template_id": "tmpl_second"},
+ {"type": "agent", "id": "agent_child"},
+ {"type": "self"},
+ {"type": "advisor", "model": "ultimate"},
+ ],
+}
+MEDIA = [
+ ("ImageGen", "image_gen", mt.ImageGenToolConfigParams, mt.ImageGenToolConfig),
+ ("ImageSearch", "image_search", mt.ImageSearchToolConfigParams, mt.ImageSearchToolConfig),
+ ("VideoGen", "video_gen", mt.VideoGenToolConfigParams, mt.VideoGenToolConfig),
+ ("DeliverArtifacts", "deliver_artifacts", mt.DeliverArtifactsToolConfigParams, mt.DeliverArtifactsToolConfig),
+]
+POLICY_PARAMS = [
+ mt.BashToolConfigParams,
+ mt.EditToolConfigParams,
+ mt.ReadToolConfigParams,
+ mt.WriteToolConfigParams,
+ mt.GlobToolConfigParams,
+ mt.GrepToolConfigParams,
+ mt.WebFetchToolConfigParams,
+ mt.WebSearchToolConfigParams,
+ mt.AgentToolsetDefaultConfigParams,
+ mt.MCPToolsetDefaultConfigParams,
+ mt.MCPToolConfigParams,
+]
+
+
+@pytest.fixture(params=[False, True], ids=["sync", "async"])
+def async_(request):
+ return request.param
+
+
+async def resolve(value):
+ return await value if inspect.isawaitable(value) else value
+
+
+@asynccontextmanager
+async def client_for(async_, surface, handle, *, sat=False, strict=True):
+ def transport(request):
+ assert request.url.host == "api.test"
+ assert request.headers["authorization"] == "Bearer " + ("test-sat" if sat else "test-pat")
+ return handle(request)
+
+ http = (httpx.AsyncClient if async_ else httpx.Client)(transport=httpx.MockTransport(transport))
+ cls = {
+ (False, "forward"): Forward,
+ (True, "forward"): AsyncForward,
+ (False, "managed"): Managed,
+ (True, "managed"): AsyncManaged,
+ }[async_, surface]
+ auth = {"auth_mode": "sa", "access_token": "test-sat"} if sat else {"pat": "test-pat"}
+ client = cls(
+ **auth,
+ http_client=http,
+ base_url="https://api.test/api/v1/" + surface,
+ _strict_response_validation=strict,
+ max_retries=0,
+ )
+ try:
+ yield client
+ finally:
+ await resolve(client.close())
+ await resolve(http.aclose() if async_ else http.close())
+
+
+def reply(payload, status=200):
+ return httpx.Response(status, json=payload, headers={"x-request-id": "req-parity"})
+
+
+def adapter(cls, namespace):
+ value = TypeAdapter(cls)
+ value.rebuild(force=True, _types_namespace=vars(namespace))
+ return value
+
+
+def card_payload(version):
+ payload = {
+ "name": "Summary",
+ "description": "Public summary",
+ "version": "2026.11",
+ "skills": [SKILL],
+ "defaultInputModes": ["text/plain", "application/json"],
+ "defaultOutputModes": ["text/plain"],
+ "capabilities": {"streaming": True},
+ "futureField": {"kept": True},
+ }
+ if version == "0.3":
+ payload["url"] = "https://do-not-follow.test/a2a?identity_id=identity"
+ payload["additionalInterfaces"] = [{"url": payload["url"], "transport": "JSONRPC"}]
+ else:
+ payload["supportedInterfaces"] = [
+ {
+ "url": "https://do-not-follow.test/a2a",
+ "protocolBinding": "JSONRPC",
+ "protocolVersion": "1.0",
+ "futureInterfaceField": 7,
+ }
+ ]
+ return payload
+
+
+@pytest.mark.parametrize("auto_title,title", [(NOT_GIVEN, NOT_GIVEN), (False, "Manual"), (True, NOT_GIVEN)])
+async def test_session_auto_title_creation(async_, auto_title, title):
+ def handle(req):
+ assert req.method == "POST" and req.url.path == "/api/v1/forward/sessions"
+ body = json.loads(req.content)
+ expected = {"identity_id": "idn_one", "template_id": "tmpl_one", "config": {"model": "auto"}}
+ if auto_title is not NOT_GIVEN:
+ expected["auto_title"] = auto_title
+ if title is not NOT_GIVEN:
+ expected["title"] = title
+ metadata = body.pop("metadata")
+ assert metadata == {
+ "__qca_sdk_created": "true",
+ "__qca_sdk_language": "python",
+ "__qca_sdk_version": __version__,
+ }
+ assert body == expected
+ return reply({"id": "sess_one", "type": "session", "config": expected["config"]})
+
+ async with client_for(async_, "forward", handle) as client:
+ session = await resolve(
+ client.sessions.create(
+ identity_id="idn_one",
+ template_id="tmpl_one",
+ auto_title=auto_title,
+ title=title,
+ config={"model": "auto"},
+ )
+ )
+ assert session.config.model == "auto"
+ assert "auto_title" not in ft.Session.model_fields
+ assert "auto_title" not in inspect.signature(client.sessions.update).parameters
+
+
+@pytest.mark.parametrize("title", [None, "", "Manual"])
+async def test_auto_title_conflicts_are_left_to_service(async_, title):
+ calls = []
+
+ def handle(req):
+ calls.append(req)
+ body = json.loads(req.content)
+ assert body["auto_title"] is True and body["title"] == title
+ return reply({"error": {"type": "invalid_request", "message": "title must not be supplied"}}, 400)
+
+ async with client_for(async_, "forward", handle) as client:
+ with pytest.raises(BadRequestError):
+ await resolve(
+ client.sessions.create(
+ identity_id="idn_one",
+ template_id="tmpl_one",
+ auto_title=True,
+ title=title,
+ )
+ )
+ assert len(calls) == 1
+
+
+@pytest.mark.parametrize(
+ "config",
+ [
+ NOT_GIVEN,
+ {},
+ {"multiagent": None},
+ {"multiagent": ROSTER},
+ ],
+)
+async def test_session_roster_update(async_, config):
+ expected = {} if config is NOT_GIVEN else {"config": config}
+
+ def handle(req):
+ assert req.method == "POST"
+ assert req.url.raw_path == f"/api/v1/forward/sessions/{ESCAPED}".encode()
+ assert json.loads(req.content) == expected
+ return reply({"id": "sess_one", **expected})
+
+ async with client_for(async_, "forward", handle) as client:
+ session = await resolve(client.sessions.update(SEGMENT, config=config))
+ assert session.to_dict() == {"id": "sess_one", **expected}
+ if config is not NOT_GIVEN and config.get("multiagent") is not None:
+ assert isinstance(session.config.multiagent, ft.MultiagentConfig)
+ assert session.config.multiagent.to_dict()["agents"] == config["multiagent"]["agents"]
+ assert session.config.multiagent.agents[2].id == "agent_child"
+
+
+async def test_session_empty_roster_is_rejected(async_):
+ config = {"multiagent": {"type": "coordinator", "agents": []}}
+
+ def handle(req):
+ assert json.loads(req.content) == {"config": config}
+ return reply(
+ {"error": {"type": "invalid_request", "message": "multiagent.agents must be a non-empty array"}}, 400
+ )
+
+ async with client_for(async_, "forward", handle) as client:
+ with pytest.raises(BadRequestError):
+ await resolve(client.sessions.update(SEGMENT, config=config))
+
+
+@pytest.mark.parametrize("method", ["create", "update"])
+@pytest.mark.parametrize("publication", [NOT_GIVEN, None, {}, PUBLICATION, {"skills": []}, {"enabled": False}])
+async def test_template_a2a_patch(async_, method, publication):
+ expected = {"name": "summary", "model": "auto", "environment_id": "env_one"} if method == "create" else {}
+ if publication is not NOT_GIVEN:
+ expected["a2a"] = publication
+
+ def handle(req):
+ assert req.method == "POST"
+ suffix = "/templates" + ("/" + ESCAPED if method == "update" else "")
+ assert req.url.raw_path == ("/api/v1/forward" + suffix).encode()
+ assert json.loads(req.content) == expected
+ return reply({"id": "tmpl_one", **expected})
+
+ async with client_for(async_, "forward", handle) as client:
+ kwargs = {"a2a": publication}
+ if method == "create":
+ template = await resolve(client.templates.create(**expected, **({} if "a2a" in expected else kwargs)))
+ else:
+ template = await resolve(client.templates.update(SEGMENT, **kwargs))
+ assert template.to_dict() == {"id": "tmpl_one", **expected}
+ if isinstance(publication, dict):
+ assert isinstance(template.a2a, ft.A2AConfig)
+ if publication.get("skills"):
+ assert isinstance(template.a2a.skills[0], ft.A2ASkill)
+ assert template.a2a.skills[0].tags == []
+
+
+@pytest.mark.parametrize("version", [NOT_GIVEN, "0.3", "1.0"])
+@pytest.mark.parametrize("sat", [False, True], ids=["PAT", "SAT"])
+async def test_agent_card_protocol_and_options(async_, version, sat):
+ calls = []
+ payload = card_payload("0.3" if version is NOT_GIVEN else version)
+
+ def handle(req):
+ calls.append(req)
+ assert req.method == "GET" and req.content == b""
+ assert req.url.raw_path.split(b"?")[0] == f"/api/v1/forward/templates/{ESCAPED}/a2a/agent-card.json".encode()
+ assert req.url.params["custom"] == "a +/=&"
+ if sat:
+ assert "identity_id" not in req.url.params
+ else:
+ assert req.url.params["identity_id"] == SEGMENT
+ assert "%23" in str(req.url) and "%2B" in str(req.url)
+ if version is NOT_GIVEN:
+ assert "a2a-version" not in req.headers
+ else:
+ assert req.headers["a2a-version"] == version
+ assert "a2a_version" not in req.url.params and "A2A-Version" not in req.url.params
+ assert req.headers["x-test"] == "forwarded"
+ assert req.extensions["timeout"]["read"] == 12.5
+ return reply(payload)
+
+ async with client_for(async_, "forward", handle, sat=sat) as client:
+ raw = await resolve(
+ client.templates.with_raw_response.retrieve_agent_card(
+ SEGMENT,
+ identity_id=NOT_GIVEN if sat else SEGMENT,
+ a2a_version=version,
+ extra_headers={"X-Test": "forwarded"},
+ extra_query={"custom": "a +/=&"},
+ timeout=12.5,
+ )
+ )
+ card = await resolve(raw.parse())
+ assert isinstance(card, ft.AgentCard)
+ assert card._request_id == "req-parity"
+ assert (card.name, card.description, card.version) == ("Summary", "Public summary", "2026.11")
+ assert card.default_input_modes == ["text/plain", "application/json"]
+ assert card.default_output_modes == ["text/plain"]
+ assert card.skills[0].id == "summary"
+ assert card.futureField == {"kept": True}
+ if version == "1.0":
+ interface = card.supported_interfaces[0]
+ assert isinstance(interface, ft.AgentCardInterface)
+ assert interface.protocol_binding == "JSONRPC" and interface.protocol_version == "1.0"
+ assert interface.futureInterfaceField == 7
+ assert card.url is None
+ else:
+ assert card.url.startswith("https://do-not-follow.test/")
+ assert card.supported_interfaces is None
+ assert card.to_dict() == payload
+ assert len(calls) == 1 # Never follow invocation URLs.
+
+
+@pytest.mark.parametrize("version", ["0.3", "1.0"])
+async def test_agent_card_extra_options_override(async_, version):
+ def handle(req):
+ assert req.headers["a2a-version"] == version
+ assert req.url.params["identity_id"] == SEGMENT
+ return reply(card_payload(version))
+
+ async with client_for(async_, "forward", handle) as client:
+ card = await resolve(
+ client.templates.retrieve_agent_card(
+ "tmpl_one",
+ a2a_version="0.3",
+ identity_id="original",
+ extra_headers={"A2A-Version": version},
+ extra_query={"identity_id": SEGMENT},
+ extra_body={},
+ )
+ )
+ assert card.version == "2026.11"
+
+
+@pytest.mark.parametrize("method", ["create", "update"])
+@pytest.mark.parametrize("credential", ["ram_role", "access_key", "omitted", "empty_buckets"])
+async def test_forward_oss_request_and_safe_response(async_, method, credential):
+ bucket = {
+ "name": "datasets",
+ "provider": "aliyun-oss",
+ "region": "cn-hangzhou",
+ "bucket": "test-bucket",
+ "prefix": "team/data/",
+ "access": "read_write",
+ "accelerator_endpoint": "test.oss-data-acc.aliyuncs.com",
+ }
+ if credential == "ram_role":
+ bucket["credential"] = {"type": "ram_role", "role_arn": "test-role-arn"}
+ elif credential == "access_key":
+ bucket["credential"] = {
+ "type": "access_key",
+ "access_key_id": "test-key-id",
+ "access_key_secret": "test-key-secret",
+ }
+ buckets = [] if credential == "empty_buckets" else [bucket]
+ config = {"type": "cloud", "packages": {"apt": []}, "startup_script": "true", "storage": {"buckets": buckets}}
+ expected = {"config": config, **({"name": "datasets"} if method == "create" else {})}
+ safe_bucket = {**bucket, "credential": {"type": "access_key", "access_key_id": "test****id"}}
+ if credential == "ram_role":
+ safe_bucket["credential"] = {"type": "ram_role"}
+ safe = {
+ "id": "env_one",
+ "config": {
+ **config,
+ "storage": {
+ "buckets": [] if credential == "empty_buckets" else [safe_bucket],
+ },
+ },
+ }
+
+ def handle(req):
+ assert req.method == "POST"
+ assert req.url.params["identity_id"] == SEGMENT
+ assert req.headers["x-qoder-beta"] == "oss-bucket-2026-09-23"
+ assert json.loads(req.content) == expected
+ if method == "create" and credential == "omitted":
+ return reply({"error": {"type": "invalid_request", "message": "credential required"}}, 400)
+ return reply(safe)
+
+ async with client_for(async_, "forward", handle) as client:
+ kwargs = {**expected, "identity_id": SEGMENT, "extra_headers": {"X-Qoder-Beta": "oss-bucket-2026-09-23"}}
+ if method == "create" and credential == "omitted":
+ with pytest.raises(BadRequestError):
+ await resolve(client.environments.create(**kwargs))
+ return
+ env = await resolve(
+ client.environments.create(**kwargs)
+ if method == "create"
+ else client.environments.update(SEGMENT, **kwargs)
+ )
+ assert isinstance(env.config, ft.EnvironmentConfig)
+ assert isinstance(env.config.storage, ft.BucketStorage)
+ assert env.to_dict() == safe
+ if credential != "empty_buckets":
+ result = env.config.storage.buckets[0].credential
+ assert isinstance(result, ft.OSSBucketCredential)
+ assert not hasattr(result, "role_arn") and not hasattr(result, "access_key_secret")
+ assert "test-key-secret" not in env.to_json() and "test-role-arn" not in env.to_json()
+ assert result.access_key_id is None if credential == "ram_role" else result.access_key_id == "test****id"
+ assert "role_arn" not in ft.OSSBucketCredential.model_fields
+ assert "access_key_secret" not in ft.OSSBucketCredential.model_fields
+
+
+@pytest.mark.parametrize(
+ "config",
+ [
+ NOT_GIVEN,
+ {"type": "self_hosted", "startup_script": "true"},
+ {"type": "cloud", "storage": {"buckets": []}},
+ {"type": "cloud", "future_config": {"keep": True}},
+ ],
+)
+async def test_environment_config_omission_and_dict_compatibility(async_, config):
+ expected = {} if config is NOT_GIVEN else {"config": config}
+
+ def handle(req):
+ assert json.loads(req.content) == expected
+ assert "x-qoder-beta" not in req.headers
+ return reply({"id": "env_one", **expected})
+
+ async with client_for(async_, "forward", handle) as client:
+ env = await resolve(client.environments.update("env_one", config=config))
+ assert env.to_dict() == {"id": "env_one", **expected}
+
+
+def managed_tools(aliases=False):
+ return [
+ {
+ "type": "agent_toolset_20260401",
+ "default_config": {"permission_policy": {"type": "always_deny"}},
+ "configs": [
+ {"name": alias if aliases else name, "permission_policy": {"type": "always_deny"}}
+ for name, alias, _, _ in MEDIA
+ ]
+ + [{"name": "bash", "enabled": False, "permission_policy": {"type": "always_deny"}}],
+ },
+ {
+ "type": "mcp_toolset",
+ "mcp_server_name": "weather",
+ "permission_policy": {"type": "always_deny"},
+ "configs": [{"name": "forecast", "enabled": False, "permission_policy": {"type": "always_deny"}}],
+ },
+ {"type": "browser_toolset_20260714"},
+ ]
+
+
+@pytest.mark.parametrize("method", ["create", "update"])
+@pytest.mark.parametrize("aliases", [False, True])
+async def test_managed_media_browser_and_deny_roundtrip(async_, method, aliases):
+ tools = managed_tools(aliases)
+ response_tools = managed_tools(False)
+ response_tools[-1]["futureBrowserField"] = {"keep": True}
+ expected = {"tools": tools, **({"model": "auto", "name": "media"} if method == "create" else {})}
+
+ def handle(req):
+ assert req.method == "POST"
+ assert json.loads(req.content) == expected
+ assert req.headers["x-qoder-beta"] == "browser-use-2026-07-14"
+ assert "version" not in json.loads(req.content)
+ return reply({"id": "agent_one", "version": 2, "tools": response_tools})
+
+ async with client_for(async_, "managed", handle) as client:
+ kwargs = {**expected, "betas": ["browser-use-2026-07-14"]}
+ agent = await resolve(
+ client.agents.create(**kwargs) if method == "create" else client.agents.update(SEGMENT, **kwargs)
+ )
+ assert agent.version == 2
+ for config, (name, _, _, response_type) in zip(agent.tools[0].configs, MEDIA):
+ assert isinstance(config, response_type)
+ assert config.name == name and config.permission_policy.type == "always_deny"
+ assert agent.tools[0].configs[-1].name == "bash" # Existing name is unchanged by SDK.
+ assert agent.tools[0].default_config.permission_policy.type == "always_deny"
+ assert agent.tools[1].configs[0].permission_policy.type == "always_deny"
+ assert agent.tools[1].permission_policy.type == "always_deny"
+ assert isinstance(agent.tools[2], mt.BrowserToolset20260714)
+ assert agent.tools[2].futureBrowserField == {"keep": True}
+ assert agent.to_dict()["tools"] == response_tools
+
+
+@pytest.mark.parametrize("method", ["create", "update"])
+async def test_managed_session_snapshot_tools(async_, method):
+ tools = managed_tools()
+ tools[-1]["futureBrowserField"] = True
+ snapshot = {"id": "agent_one", "type": "agent", "version": 3, "tools": tools}
+
+ def handle(req):
+ body = json.loads(req.content)
+ if method == "create":
+ assert body["agent"]["type"] == "agent_with_overrides"
+ assert body["agent"]["tools"] == managed_tools()
+ else:
+ assert body == {"agent": {"tools": managed_tools()}}
+ assert req.headers["x-qoder-beta"] == "browser-use-2026-07-14"
+ return reply({"id": "sess_one", "type": "session", "agent": snapshot})
+
+ async with client_for(async_, "managed", handle) as client:
+ if method == "create":
+ session = await resolve(
+ client.sessions.create(
+ agent={"type": "agent_with_overrides", "id": "agent_one", "tools": managed_tools()},
+ environment_id="env_one",
+ betas=["browser-use-2026-07-14"],
+ )
+ )
+ else:
+ session = await resolve(
+ client.sessions.update(
+ "sess_one",
+ agent={"tools": managed_tools()},
+ betas=["browser-use-2026-07-14"],
+ )
+ )
+ assert session.agent.version == 3
+ assert isinstance(session.agent.tools[2], mt.BrowserToolset20260714)
+ assert session.agent.tools[2].futureBrowserField is True
+ assert isinstance(session.agent.tools[0].configs[0], mt.ImageGenToolConfig)
+ assert session.agent.tools[1].permission_policy.type == "always_deny"
+ assert session.to_dict()["agent"] == snapshot
+
+
+@pytest.mark.parametrize("model", [mt.SessionThreadAgentUnion, mt.SessionMultiagentCoordinatorAgentUnion])
+def test_other_managed_agent_snapshots(model):
+ payload = {"id": "agent_one", "version": 5, "tools": managed_tools()}
+ snapshot = model.model_validate(payload)
+ assert snapshot.version == 5
+ assert isinstance(snapshot.tools[2], mt.BrowserToolset20260714)
+ assert isinstance(snapshot.tools[0].configs[3], mt.DeliverArtifactsToolConfig)
+ assert snapshot.tools[1].permission_policy.type == "always_deny"
+ assert snapshot.to_dict() == payload
+
+
+@pytest.mark.parametrize("params", POLICY_PARAMS, ids=lambda cls: cls.__name__)
+def test_all_existing_policy_request_unions(params):
+ payload = {"permission_policy": {"type": "always_deny"}}
+ if params is mt.MCPToolConfigParams:
+ payload["name"] = "forecast"
+ assert adapter(params, mt).validate_python(payload) == payload
+
+
+@pytest.mark.parametrize("name,alias,params,response", MEDIA)
+def test_new_media_required_names_and_sparse_response(name, alias, params, response):
+ request_type = adapter(params, mt)
+ assert request_type.validate_python({"name": name}) == {"name": name}
+ assert request_type.validate_python({"name": alias}) == {"name": alias}
+ for payload in [{}, {"name": "wrong"}, {"name": None}]:
+ with pytest.raises(ValidationError):
+ request_type.validate_python(payload)
+ with pytest.raises(ValidationError):
+ response.model_validate(payload)
+ parsed = response.model_validate({"name": name, "unknown": "preserved"})
+ assert parsed.enabled is None and parsed.permission_policy is None
+ assert parsed.unknown == "preserved"
+ assert set(response.model_fields) == {"name", "enabled", "permission_policy"}
+ assert set(get_type_hints(params, vars(mt), vars(mt))) == {"name", "enabled", "permission_policy"}
+ toolset = {"type": "agent_toolset_20260401", "configs": [{"name": name}]}
+ assert adapter(mt.AgentToolset20260401Params, mt).validate_python(toolset) == toolset
+
+
+def test_public_request_boundaries():
+ assert "multiagent" not in get_type_hints(ft.SessionCreateParamsConfigParam, vars(ft))
+ assert "auto_title" not in get_type_hints(ft.SessionUpdateParams, vars(ft), vars(ft))
+ assert adapter(ft.SessionUpdateParamsConfigParam, ft).validate_python({"multiagent": None}) == {"multiagent": None}
+ assert set(get_type_hints(mt.BrowserToolset20260714Params, vars(mt))) == {"type"}
+ with pytest.raises(ValidationError):
+ adapter(mt.BrowserToolset20260714Params, mt).validate_python({})
+ assert mt.AlwaysDenyPolicy.model_validate({"type": "always_deny"}).type == "always_deny"
+ assert adapter(mt.AlwaysDenyPolicyParam, mt).validate_python({"type": "always_deny"}) == {"type": "always_deny"}
+ for cls in [mt.AgentCreateParams, mt.AgentUpdateParams, mt.AgentWithOverridesParams, mt.SessionAgentUpdateParam]:
+ args = {"tools": [{"type": "browser_toolset_20260714"}]}
+ if cls is mt.AgentCreateParams:
+ args.update(name="browser", model="auto")
+ elif cls is mt.AgentWithOverridesParams:
+ args.update(id="agent_one", type="agent_with_overrides")
+ assert adapter(cls, mt).validate_python(args) == args
+
+
+@pytest.mark.parametrize("member", ["enabled", "description", "skills"])
+def test_a2a_members_cannot_be_null(member):
+ with pytest.raises(ValidationError):
+ adapter(ft.A2AConfigParam, ft).validate_python({member: None})
+ for cls in [ft.TemplateCreateParams, ft.TemplateUpdateParams]:
+ args = {"a2a": None}
+ if cls is ft.TemplateCreateParams:
+ args.update(name="summary", model="auto", environment_id="env_one")
+ assert adapter(cls, ft).validate_python(args) == args
+ assert adapter(ft.A2AConfigParam, ft).validate_python({}) == {}
+ assert adapter(ft.A2AConfigParam, ft).validate_python({"skills": []}) == {"skills": []}
+ for key in ["id", "name", "description", "tags", "examples"]:
+ with pytest.raises(ValidationError):
+ adapter(ft.A2ASkillParam, ft).validate_python({**SKILL, key: None})
+
+
+def test_forward_environment_public_types():
+ config = {
+ "type": "cloud",
+ "storage": {
+ "buckets": [
+ {
+ "name": "data",
+ "provider": "aliyun-oss",
+ "region": "cn-hangzhou",
+ "bucket": "test-bucket",
+ }
+ ]
+ },
+ }
+ assert adapter(ft.EnvironmentConfigParam, ft).validate_python(config) == config
+ assert adapter(ft.EnvironmentCreateParams, ft).validate_python({"name": "data", "config": config}) == {
+ "name": "data",
+ "config": config,
+ }
+ assert adapter(ft.EnvironmentUpdateParams, ft).validate_python({"config": config}) == {"config": config}
+ for cls, credential in [
+ (ft.OSSRAMRoleCredentialParam, {"type": "ram_role", "role_arn": "test-role"}),
+ (
+ ft.OSSAccessKeyCredentialParam,
+ {"type": "access_key", "access_key_id": "test-id", "access_key_secret": "test-secret"},
+ ),
+ ]:
+ assert adapter(cls, ft).validate_python(credential) == credential
+
+
+@pytest.mark.parametrize(
+ "surface,entry,payload",
+ [
+ ("forward", "card", {**card_payload("1.0"), "defaultInputModes": 1}),
+ ("forward", "card", {**card_payload("0.3"), "skills": [{"id": "summary"}]}),
+ ("forward", "card", {**card_payload("1.0"), "supportedInterfaces": [{"url": 17}]}),
+ ("forward", "environment", {"config": {"type": "cloud", "storage": {"buckets": [{"name": "data"}]}}}),
+ (
+ "forward",
+ "environment",
+ {
+ "config": {
+ "storage": {
+ "buckets": [
+ {
+ "name": "data",
+ "provider": "aliyun-oss",
+ "region": "cn-hangzhou",
+ "bucket": "test-bucket",
+ "credential": {"type": "access_key", "access_key_id": []},
+ }
+ ]
+ }
+ }
+ },
+ ),
+ ("forward", "template", {"a2a": {"skills": [{"id": "summary", "name": "Summarize"}]}}),
+ ("forward", "session", {"config": {"multiagent": {"agents": 1}}}),
+ (
+ "managed",
+ "agent",
+ {
+ "tools": [
+ {
+ "type": "agent_toolset_20260401",
+ "configs": [
+ {
+ "name": "ImageGen",
+ "permission_policy": {"type": []},
+ }
+ ],
+ }
+ ]
+ },
+ ),
+ ],
+)
+async def test_strict_http_response_failures(async_, surface, entry, payload):
+ async with client_for(async_, surface, lambda req: reply(payload)) as client:
+ with pytest.raises(APIResponseValidationError):
+ if entry == "card":
+ await resolve(client.templates.retrieve_agent_card("tmpl_one"))
+ else:
+ resource = {
+ "environment": "environments",
+ "template": "templates",
+ "session": "sessions",
+ "agent": "agents",
+ }[entry]
+ await resolve(getattr(client, resource).retrieve("id_one"))
+
+
+async def test_browser_snapshot_migration_branches_before_reading_configs(async_):
+ payload = {
+ "id": "agent_one",
+ "tools": [
+ {"type": "browser_toolset_20260714"},
+ {"type": "agent_toolset_20260401", "configs": [{"name": "Bash"}]},
+ ],
+ }
+ async with client_for(async_, "managed", lambda req: reply(payload)) as client:
+ agent = await resolve(client.agents.retrieve("agent_one"))
+ names = []
+ for tool in agent.tools or []:
+ if isinstance(tool, mt.BrowserToolset20260714):
+ continue
+ for config in tool.configs or []:
+ names.append(config.name)
+ assert names == ["Bash"]
+
+
+async def test_managed_lenient_unknown_tool_compatibility(async_):
+ payload = {
+ "id": "agent_one",
+ "tools": [{"type": "future_toolset", "future": True}, {"type": "browser_toolset_20260714", "future": True}],
+ }
+ async with client_for(async_, "managed", lambda req: reply(payload), strict=False) as client:
+ agent = await resolve(client.agents.retrieve("agent_one"))
+ assert type(agent.tools[0]) is mt.AgentToolUnion
+ assert agent.tools[0].future is True
+ assert isinstance(agent.tools[1], mt.BrowserToolset20260714)
+ assert agent.tools[1].future is True
+ assert agent.to_dict() == payload
+
+
+@pytest.mark.parametrize(
+ "entry,tool_model",
+ [("agent", mt.AgentToolUnion), ("session", mt.SessionAgentToolUnion), ("thread", mt.SessionThreadAgentToolUnion)],
+)
+@pytest.mark.parametrize("strict", [False, True], ids=["lenient", "strict"])
+async def test_managed_historical_policy_snapshots(async_, entry, tool_model, strict):
+ tools = [
+ {
+ "type": "agent_toolset_20260401",
+ "configs": [{"name": "Bash", "permission_policy": "always_ask"}]
+ + [{"name": name, "permission_policy": {"type": "always_deny"}} for name, _, _, _ in MEDIA],
+ },
+ {
+ "type": "future_toolset",
+ "configs": [{"name": "FutureTool", "permission_policy": "future_policy"}],
+ "future": {"keep": True},
+ },
+ {"type": "browser_toolset_20260714", "futureBrowserField": True},
+ ]
+ snapshot = {"id": "agent_one", "type": "agent", "tools": tools}
+ payload = snapshot if entry == "agent" else {"id": "snapshot_one", "agent": snapshot}
+ paths = {
+ "agent": "/agents/agent_one",
+ "session": "/sessions/sess_one",
+ "thread": "/sessions/sess_one/threads/thread_one",
+ }
+
+ def handle(req):
+ assert req.method == "GET" and req.url.path == "/api/v1/managed" + paths[entry]
+ return reply(payload)
+
+ async with client_for(async_, "managed", handle, strict=strict) as client:
+ resource, resource_id, kwargs = {
+ "agent": (client.agents, "agent_one", {}),
+ "session": (client.sessions, "sess_one", {}),
+ "thread": (client.sessions.threads, "thread_one", {"session_id": "sess_one"}),
+ }[entry]
+ if strict:
+ with pytest.raises(APIResponseValidationError) as caught:
+ await resolve(resource.retrieve(resource_id, **kwargs))
+ assert caught.value.body == payload
+ return
+ result = await resolve(resource.retrieve(resource_id, **kwargs))
+ agent = result if entry == "agent" else result.agent
+ toolset = agent.tools[0]
+ assert type(toolset) is tool_model
+ assert not isinstance(toolset, mt.BrowserToolset20260714)
+ assert type(toolset.configs[0]) is mt.AgentToolConfigUnion
+ assert not isinstance(toolset.configs[0], dict)
+ assert toolset.configs[0].name == "Bash"
+ assert toolset.configs[0].permission_policy == "always_ask"
+ for config, (_, _, _, model) in zip(toolset.configs[1:], MEDIA):
+ assert isinstance(config, model)
+ assert config.permission_policy.type == "always_deny"
+ assert type(agent.tools[1]) is tool_model
+ assert type(agent.tools[1].configs[0]) is mt.AgentToolConfigUnion
+ assert agent.tools[1].configs[0].name == "FutureTool"
+ assert agent.tools[1].configs[0].permission_policy == "future_policy"
+ assert agent.tools[1].future == {"keep": True}
+ assert isinstance(agent.tools[2], mt.BrowserToolset20260714)
+ assert agent.tools[2].futureBrowserField is True
+ assert result.to_dict() == payload
+
+
+@pytest.mark.parametrize("method", ["create", "update"])
+@pytest.mark.parametrize("legacy_default", [False, True])
+async def test_mcp_top_level_deny_without_configs_roundtrip(async_, method, legacy_default):
+ tool = {"type": "mcp_toolset", "mcp_server_name": "weather", "permission_policy": {"type": "always_deny"}}
+ if legacy_default:
+ tool["default_config"] = {"permission_policy": {"type": "always_allow"}}
+ tools = [tool]
+ expected = {"tools": tools, **({"name": "weather", "model": "auto"} if method == "create" else {})}
+
+ def handle(req):
+ assert req.method == "POST"
+ assert req.url.path == "/api/v1/managed/agents" + ("/agent_one" if method == "update" else "")
+ assert json.loads(req.content) == expected
+ assert "configs" not in json.loads(req.content)["tools"][0]
+ return reply({"id": "agent_one", "tools": tools})
+
+ async with client_for(async_, "managed", handle) as client:
+ agent = await resolve(
+ client.agents.create(**expected) if method == "create" else client.agents.update("agent_one", **expected)
+ )
+ toolset = agent.tools[0]
+ assert "permission_policy" in mt.AgentToolUnion.model_fields
+ assert isinstance(toolset.permission_policy, mt.AgentToolConfigUnionPermissionPolicy)
+ assert toolset.permission_policy.type == "always_deny"
+ assert toolset.configs is None
+ if legacy_default:
+ assert toolset.default_config.permission_policy.type == "always_allow"
+ else:
+ assert toolset.default_config is None
+ assert agent.to_dict()["tools"] == tools
+
+
+@pytest.mark.parametrize("policy", ["always_allow", "always_ask", "always_deny"])
+def test_mcp_top_level_policy_request_and_response_types(policy):
+ tool = {"type": "mcp_toolset", "mcp_server_name": "weather", "permission_policy": {"type": policy}}
+ assert adapter(mt.MCPToolsetParams, mt).validate_python(tool) == tool
+ for cls in [mt.AgentCreateParams, mt.AgentUpdateParams, mt.AgentWithOverridesParams, mt.SessionAgentUpdateParam]:
+ payload = {"tools": [tool]}
+ if cls is mt.AgentCreateParams:
+ payload.update(name="weather", model="auto")
+ elif cls is mt.AgentWithOverridesParams:
+ payload.update(id="agent_one", type="agent_with_overrides")
+ assert adapter(cls, mt).validate_python(payload) == payload
+ for model in [mt.AgentToolUnion, mt.SessionAgentToolUnion, mt.SessionThreadAgentToolUnion]:
+ assert "permission_policy" in model.model_fields
+ snapshot = model.model_validate(tool)
+ assert isinstance(snapshot.permission_policy, mt.AgentToolConfigUnionPermissionPolicy)
+ assert snapshot.permission_policy.type == policy
+ assert snapshot.to_dict() == tool
+ with pytest.raises(ValidationError):
+ adapter(mt.MCPToolsetParams, mt).validate_python({**tool, "permission_policy": {"type": "deny"}})
diff --git a/tests/test_resource_surface.py b/tests/test_resource_surface.py
index 0c2de0a..70f7050 100644
--- a/tests/test_resource_surface.py
+++ b/tests/test_resource_surface.py
@@ -39,7 +39,12 @@ def test_contract_fixture_has_pinned_provenance():
"commit": "bc5bc655d70b67fcd88623320ac01896a7360d8a",
"captured_at": "2026-09-22",
}
- assert len(CONTRACT_FIXTURE["contracts"]) == 253
+ assert len(CONTRACT_FIXTURE["contracts"]) == 254
+ card = next(row for row in CONTRACT_FIXTURE["contracts"] if row["id"] == "forward.templates.retrieve_agent_card")
+ assert card["source"] == {
+ "documentation": "https://docs.qoder.com/cloud-agents/a2a-integration",
+ "service_test": "forward-current/internal/handler/a2a/handler_test.go:288-315",
+ }
@pytest.mark.parametrize("endpoint", ENDPOINTS, ids=endpoint_id)
diff --git a/tests/test_response_alignment.py b/tests/test_response_alignment.py
index e0332e7..11e4fdb 100644
--- a/tests/test_response_alignment.py
+++ b/tests/test_response_alignment.py
@@ -3,6 +3,7 @@
import inspect
from datetime import date, datetime, timezone
from email.utils import formatdate
+from typing import Literal, Optional, Union
import httpx
import pytest
@@ -307,3 +308,70 @@ def test_lenient_construction_preserves_invalid_container_and_date_fields():
assert result.by_name == []
assert result.created_at == "not-a-date"
assert result.day == "not-a-day"
+
+
+class TaggedChild(Child):
+ type: Optional[Literal["tagged"]] = None
+
+
+class NamedChild(Child):
+ name: Literal["named"] | None = None
+
+
+class AliasedChild(Child):
+ kind: Optional[Literal["tagged"]] = Field(default=None, alias="type")
+
+
+@pytest.mark.parametrize("cast_to", [TaggedChild | NamedChild | Child, NamedChild | TaggedChild | Child])
+@pytest.mark.parametrize(
+ "discriminator,expected",
+ [
+ ({"type": "tagged"}, TaggedChild),
+ ({"name": "named"}, NamedChild),
+ ({"type": "future"}, Child),
+ ({"name": "future"}, Child),
+ ({}, Child),
+ ({"type": None, "name": None}, Child),
+ ],
+)
+def test_lenient_union_uses_optional_literal_discriminators(cast_to, discriminator, expected):
+ payload = {"count": "future-count", **discriminator}
+ result = parse_response(cast_to, payload, httpx.Response(200))
+ assert type(result) is expected
+ assert result.count == "future-count"
+ for key, value in discriminator.items():
+ assert getattr(result, key) == value
+
+
+@pytest.mark.parametrize("value,expected", [("tagged", AliasedChild), ("future", Child), (None, Child)])
+def test_lenient_union_uses_aliased_literal_discriminator(value, expected):
+ result = parse_response(AliasedChild | Child, {"type": value, "count": "future-count"}, httpx.Response(200))
+ assert type(result) is expected
+ assert result.count == "future-count"
+ assert (result.kind if isinstance(result, AliasedChild) else result.type) == value
+
+
+@pytest.mark.parametrize("cast_to", [Union[int, str], int | str])
+@pytest.mark.parametrize(
+ "value,expected",
+ [(1, 1), ("2", "2"), (True, 1), (2.0, 2), (2.5, 2.5), (["new"], ["new"]), ({"new": True}, {"new": True})],
+)
+def test_lenient_scalar_union_keeps_validation_and_fallback_behavior(cast_to, value, expected):
+ result = parse_response(cast_to, value, httpx.Response(200))
+ assert result == expected
+ assert type(result) is type(expected)
+
+
+@pytest.mark.parametrize("cast_to", [Union[str, Child], str | Child])
+def test_lenient_untagged_scalar_model_union_keeps_first_branch_fallback(cast_to):
+ payload = {"count": "future-count"}
+ result = parse_response(cast_to, payload, httpx.Response(200))
+ assert result is payload
+
+
+@pytest.mark.parametrize("cast_to", [list[Child] | str, Child | str])
+def test_lenient_union_list_fallback_still_recurses(cast_to):
+ result = parse_response(cast_to, [{"count": "future-count"}, "new", 123], httpx.Response(200))
+ assert isinstance(result[0], Child)
+ assert result[0].count == "future-count"
+ assert result[1:] == ["new", 123]