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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading
Loading