Documentation index for AI agents: see /llms.txt. Markdown versions of every page are available at <path>.md or via Accept: text/markdown.
Reference

Unions

Discriminated-union factory for action and event schemas. TaggedUnion(...) returns a Pydantic discriminated union over the kind field by default.

Discriminated-union factory for action and event schemas. TaggedUnion(...) returns a Pydantic discriminated union over the kind field by default.

TaggedUnion

TaggedUnion(*models: 'type[BaseModel]', discriminator: 'str' = 'kind') -> 'Any'

ParameterTypeDefault
modelstype[BaseModel]required
discriminatorstr'kind'

Returns: Any

Create a Pydantic discriminated union over discriminator.

Models may use either Pydantic's native Literal[...] discriminator field or the public Harness shorthand kind: str = "some_kind".

Python type checkers cannot infer a precise alias from a runtime function call, so the return annotation is intentionally Any. Runtime validation and JSON schema generation still use Pydantic's discriminated union.

On this page