.end().
All setter methods return self, so you can chain calls:
Required
Create step
There are two ways to create a step:Set prompt
The prompt is required before calling.end().
Set response
The response is required before calling.end().
End step
End the step and export it. 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
Tracking costs
Costs are calculated automatically based on the model and token usage you provide, or you can set the cost directly with your own value.Set model
Track which model was requested and which was actually used.Set token usage
Track token counts for the step.Set cost
Alternatively, set the cost directly.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 and exports the payload. The step cannot be modified after calling.error(). Unlike .end(), calling .error() does not require a prompt or response to be set.
