An agent definition is a JSON document validated against a strictspec schema (format version 1). The schema enforces required fields, type constraints, and value ranges at load time. Invalid documents produce an AgentValidationError with pinned diagnostic codes and paths. Source
ContentBlock
ContentBlock is a union of the 4 content block types (TextBlock | ToolUseBlock | ThinkingBlock | ToolResultBlock) and serves as the element type of AssistantMessage.content. Each block carries typed data from one segment of an assistant response, and the union lets consumers use isinstance checks or pattern matching to dispatch on block kind without casting. Source
The core API
The core API is an async generator that yields typed events one at a time as they arrive from the subprocess. Each call to AsyncSession.send() drives one conversational turn, blocking until the subprocess produces each event and terminating when a Result event signals turn completion: Source