.end().
All setter methods return this, so you can chain calls:
Required
Create step
Create a step from a run:Set prompt
The prompt is required before calling.end().
Set response
The response is required before calling.end().
End step
End the step. A step must have both a prompt and a response set before calling.end(). The step cannot be modified after calling .end().
Optional step data
Set model
Track which model was used. You can use the shorthand or provide both requested and used models.Set token usage
Track token counts for the step.Set cost
Track the cost of the step in USD.Set finish reason
Set the finish reason returned by the LLM.Set tool definitions
Set the tool definitions available to the LLM for this step.Mark step as failed
Sets the status code to error. The step cannot be modified after calling.error(). Unlike .end(), calling .error() does not require a prompt or response to be set.
Factory pattern
If you have all step data available upfront, use thesendStep function:
