Interface: StreamObjectResult<T>
Defined in: packages/agentos/src/api/streamObject.ts:122
The result object returned immediately by streamObject.
Consumers iterate partialObjectStream for incremental partial objects,
or await the promise properties for the final validated result.
Type Parameters
T
T
The inferred type from the Zod schema.
Properties
object
object:
Promise<T>
Defined in: packages/agentos/src/api/streamObject.ts:142
Resolves to the final Zod-validated object when the stream completes.
Throws
When the final JSON fails validation.
partialObjectStream
partialObjectStream:
AsyncIterable<DeepPartial<T>>
Defined in: packages/agentos/src/api/streamObject.ts:135
Async iterable yielding partial objects as the LLM builds the JSON
response token by token. Each yielded value has the same shape as T
but with all fields optional (DeepPartial).
Example
for await (const partial of result.partialObjectStream) {
console.log('partial:', partial);
}
text
text:
Promise<string>
Defined in: packages/agentos/src/api/streamObject.ts:145
Resolves to the raw text when the stream completes.
usage
usage:
Promise<TokenUsage>
Defined in: packages/agentos/src/api/streamObject.ts:148
Resolves to aggregated token usage when the stream completes.