"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations from .toolcallstatus import ToolCallStatus from openrouter.types import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import Literal, Optional from typing_extensions import NotRequired, TypedDict OutputSubagentServerToolItemType = Literal["openrouter:subagent",] class OutputSubagentServerToolItemTypedDict(TypedDict): r"""An openrouter:subagent server tool output item""" status: ToolCallStatus type: OutputSubagentServerToolItemType error: NotRequired[str] r"""Error message when the subagent task did not produce an outcome.""" id: NotRequired[str] model: NotRequired[str] r"""Slug of the worker model that executed the task.""" outcome: NotRequired[str] r"""The worker model's result (the outcome text returned to the delegating model).""" task_description: NotRequired[str] r"""The task description the delegating model sent to the worker.""" task_name: NotRequired[str] r"""The short task identifier the delegating model supplied.""" class OutputSubagentServerToolItem(BaseModel): r"""An openrouter:subagent server tool output item""" status: ToolCallStatus type: OutputSubagentServerToolItemType error: Optional[str] = None r"""Error message when the subagent task did not produce an outcome.""" id: Optional[str] = None model: Optional[str] = None r"""Slug of the worker model that executed the task.""" outcome: Optional[str] = None r"""The worker model's result (the outcome text returned to the delegating model).""" task_description: Optional[str] = None r"""The task description the delegating model sent to the worker.""" task_name: Optional[str] = None r"""The short task identifier the delegating model supplied.""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( ["error", "id", "model", "outcome", "task_description", "task_name"] ) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) if val != UNSET_SENTINEL: if val is not None or k not in optional_fields: m[k] = val return m