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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ existing `0.1.0` release; earlier development prereleases are not listed.

## [Unreleased]

### Fixed

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

## [0.15.0]

### Added
Expand Down
26 changes: 26 additions & 0 deletions docs/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -33249,6 +33249,32 @@ class Multiagent(BaseModel)

#### type

<a id="qca.managed.types.multiagent_agent_params"></a>

# qca.managed.types.multiagent\_agent\_params

<a id="qca.managed.types.multiagent_agent_params.MultiagentAgentParams"></a>

## MultiagentAgentParams

```python
class MultiagentAgentParams(TypedDict)
```

[[view_source]](https://github.com/QoderAI/qoder-cloud-agents-sdk-python/blob/main/src/qca/managed/types/multiagent_agent_params.py)

<a id="qca.managed.types.multiagent_agent_params.MultiagentAgentParams.id"></a>

#### id

<a id="qca.managed.types.multiagent_agent_params.MultiagentAgentParams.type"></a>

#### type

<a id="qca.managed.types.multiagent_agent_params.MultiagentAgentParams.version"></a>

#### version

<a id="qca.managed.types.multiagent_agent_union"></a>

# qca.managed.types.multiagent\_agent\_union
Expand Down
1 change: 1 addition & 0 deletions src/qca/managed/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
from .monetary_amount import MonetaryAmount as MonetaryAmount
from .monetary_amount_param import MonetaryAmountParam as MonetaryAmountParam
from .multiagent import Multiagent as Multiagent
from .multiagent_agent_params import MultiagentAgentParams as MultiagentAgentParams
from .multiagent_agent_union import MultiagentAgentUnion as MultiagentAgentUnion
from .multiagent_params import MultiagentParams as MultiagentParams
from .multiagent_self_params import MultiagentSelfParams as MultiagentSelfParams
Expand Down
15 changes: 15 additions & 0 deletions src/qca/managed/types/multiagent_agent_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import annotations

from typing import Literal, Optional, Union

from typing_extensions import Required, TypedDict

__all__ = ["MultiagentAgentParams"]


class MultiagentAgentParams(TypedDict, total=False):
id: Required[str]
type: Required[Literal["agent"]]
# A positive integer, "latest", or a positive integer string. Omit to pin the
# latest numeric version at save time.
version: Optional[Union[int, str]]
3 changes: 2 additions & 1 deletion src/qca/managed/types/multiagent_agent_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
class MultiagentAgentUnion(BaseModel):
id: Optional[str] = None
type: Optional[str] = None
version: Optional[int] = None
# A saved child Agent version: a concrete version or "latest".
version: Optional[Union[int, str]] = None
model: Optional[Union[str, ModelConfig]] = None
4 changes: 2 additions & 2 deletions src/qca/managed/types/multiagent_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

if TYPE_CHECKING:
from .advisor_params import AdvisorParams
from .agent_params import AgentParams
from .multiagent_agent_params import MultiagentAgentParams
from .multiagent_self_params import MultiagentSelfParams

__all__ = ["MultiagentParams"]


class MultiagentParams(TypedDict, total=False):
agents: Required[List[Union[str, AgentParams, MultiagentSelfParams, AdvisorParams]]]
agents: Required[List[Union[str, MultiagentAgentParams, MultiagentSelfParams, AdvisorParams]]]
type: Required[Literal["coordinator"]]
33 changes: 33 additions & 0 deletions tests/test_official_contract_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,36 @@ def handle(req):
assert credential.to_dict() == {"type": "access_key", "access_key_id": "test****"}
assert not hasattr(credential, "access_key_secret")
assert not expected


# Official Agent schema retrieved 2026-11-20: roster child versions accept "latest".
@pytest.mark.parametrize("async_", [False, True])
async def test_managed_agent_roster_latest_version(async_):
roster = {
"type": "coordinator",
"agents": [
{"type": "agent", "id": "agent_latest", "version": "latest"},
{"type": "agent", "id": "agent_text", "version": "3"},
{"type": "agent", "id": "agent_pinned", "version": 3},
],
}
saved = {
"type": "coordinator",
"agents": [
{"type": "agent", "id": "agent_latest", "version": "latest"},
{"type": "agent", "id": "agent_text", "version": 3},
{"type": "advisor", "model": "ultimate"},
],
}

def handle(req):
assert json.loads(req.content)["multiagent"] == roster
return httpx.Response(200, json={"id": "agent_parent", "multiagent": saved})

http = (httpx.AsyncClient if async_ else httpx.Client)(transport=httpx.MockTransport(handle))
client = (AsyncManaged if async_ else Managed)(pat="test", http_client=http, _strict_response_validation=True)
try:
agent = await resolve(client.agents.create(name="coordinator", model="auto", multiagent=roster))
assert [entry.version for entry in agent.multiagent.agents] == ["latest", 3, None]
finally:
await resolve(client.close())
Loading