Interface: GenerateTextResult
Defined in: packages/agentos/src/api/generateText.ts:705
The completed result returned by generateText.
Extended by
Properties
agentCalls?
optionalagentCalls:AgentCallRecord[]
Defined in: packages/agentos/src/api/generateText.ts:778
Ordered records of every sub-agent call made during an agency() run.
undefined for plain generateText / agent() calls.
cacheDiagnostics?
optionalcacheDiagnostics:CacheDiagnostics|null
Defined in: packages/agentos/src/api/generateText.ts:751
Cache-diagnostics verdict from the LAST agentic step (Anthropic beta;
present only when the run opted in via
GenerateTextOptions.cacheDiagnostics). null = the last step's
request matched its predecessor (prefix stable). A populated
cacheMissReason names the earliest divergence. Per-step verdicts are
available on the onAfterGeneration hook.
fallback?
optionalfallback:FallbackSignal
Defined in: packages/agentos/src/api/generateText.ts:808
Per-hop provider fallback trail. fired is true when any non-primary
provider produced — or was tried for — the result, so callers can flag a
degraded run even when the final attempt recovered on the primary.
undefined only on legacy code paths that predate the field.
finishReason
finishReason:
"error"|"length"|"stop"|"tool-calls"
Defined in: packages/agentos/src/api/generateText.ts:773
Reason the model stopped generating.
"stop": natural end of response."length":maxTokenslimit reached."tool-calls": loop exhaustedmaxStepswhile still calling tools."error": provider returned an error.
grounding?
optionalgrounding:VerifiedResponse
Defined in: packages/agentos/src/api/generateText.ts:801
Per-claim citation verdicts attached when agent({ verifyCitations: … })
is configured. undefined when verification was not requested or could
not run for this turn.
See
import('./types.js').VerifyCitationsConfig
model
model:
string
Defined in: packages/agentos/src/api/generateText.ts:720
Resolved model identifier used for the run.
parsed?
optionalparsed:unknown
Defined in: packages/agentos/src/api/generateText.ts:788
Parsed structured output produced when BaseAgentConfig.output is a Zod
schema. undefined when no output schema is configured.
plan?
optionalplan:Plan
Defined in: packages/agentos/src/api/generateText.ts:793
The plan produced by the planning phase when planning is enabled.
undefined when planning is disabled or was not requested.
provider
provider:
string
Defined in: packages/agentos/src/api/generateText.ts:718
Provider identifier used for the final run.
providerMessageId?
optionalproviderMessageId:string|null
Defined in: packages/agentos/src/api/generateText.ts:759
Provider message id (msg_...) of the LAST agentic step; present only
when the run opted in via GenerateTextOptions.cacheDiagnostics.
Persist it and pass it back as the next request's
cacheDiagnostics.previousMessageId to thread the comparison across
turns. null when the provider reported no id.
responseModel?
optionalresponseModel:string
Defined in: packages/agentos/src/api/generateText.ts:727
Provider-reported model id of the final step (spec batch-1 C1) — can
differ from model across aliases and fallback routing. Undefined on
paths where no provider-reported id was captured. model keeps its
existing meaning (zero-change).
serviceTier?
optionalserviceTier:string
Defined in: packages/agentos/src/api/generateText.ts:733
Provider-reported service tier the final step actually ran at (OpenAI
service_tier on the response; spec batch-1 C2). Undefined on
providers/paths without a tier concept.
servingProvider?
optionalservingProvider:string
Defined in: packages/agentos/src/api/generateText.ts:742
Upstream host that actually served the request when provider is an
aggregator/router (OpenRouter reports e.g. 'Groq' or 'DeepInfra'
per completion). Undefined for direct providers, for aggregators that
omit it, and on the prompt-shim tool path. Latency attribution:
identical model + token counts vary 3-5x in wall-clock by serving
host, so telemetry needs this to interpret durations.
text
text:
string
Defined in: packages/agentos/src/api/generateText.ts:761
Final assistant text after all agentic steps have completed.
toolCalls
toolCalls:
ToolCallRecord[]
Defined in: packages/agentos/src/api/generateText.ts:765
Ordered list of every tool call made during the run.
trace?
optionaltrace:AgencyTraceEvent[]
Defined in: packages/agentos/src/api/generateText.ts:783
Structured trace events emitted during the run.
Populated by the agency orchestrator; undefined for single-agent calls.
transcriptDelta?
optionaltranscriptDelta:SessionTranscriptMessage[]
Defined in: packages/agentos/src/api/generateText.ts:716
Lossless message delta this call appended to the conversation: the request's user turn plus every assistant / tool turn the tool loop recorded, in order, in provider-replayable shape (tool_call ids, parallel results, thinking blocks). Sessions append THIS — never a reconstruction — to their history. Absent only on legacy paths that never seeded a conversation array. The prompt-shim path carries a partial delta (seeded turns only); native providers carry the full trail.
usage
usage:
TokenUsage
Defined in: packages/agentos/src/api/generateText.ts:763
Aggregated token usage across all steps.