Methods
All methods below belong to the configuredagent client.
Response in this table means AgentResponseView.
Request fields
A structured user message has
role: "user" and 1–40 content parts.
Supported parts are input_text, input_image, input_file, and fal.input_artifact.
Use image_url for images and file_url for files. See media inputs.
Follow-ups create new response IDs. Answers continue the existing response ID.
Options
selectFinalArtifacts uses resource options: signal and timeoutMs only.
It uses expected_sequence_number to detect conflicting writes.
maxReconnects must be a nonnegative integer. reconnectDelayMs must be nonnegative and finite.
Idempotency keys must be nonempty, single-line strings with at most 200 characters.
onAccepted is synchronous. The helper does not await a promise returned by this callback.
Use responses.create when durable asynchronous storage must finish before observation starts.
Read the response
Observation also stops at
fal.phase === "waiting_for_input", even when the status is not terminal.
After answering, resume observation with the same response ID.
Observation also stops when fal.pending_submission reports a saved answer that could not resume.
Follow saved-answer recovery before resuming observation.
fal.model_usage reports conversation model tokens across the response’s turns.
Its scope is "conversation_model".
The input_tokens and output_tokens fields are included only when every turn has reported that count.
These counts exclude media generation and auxiliary model calls. An absent field or null means unavailable, never zero.
usage is null when complete accounting is unavailable. Do not treat conversation model counts as a billing total.
fal.pending_input_ids and fal.final_artifact_ids reference items in output.
The convenience views are derived getters. JSON.stringify(response) omits them.
Read the getters explicitly when saving a presentation view.
Example snapshot
This illustrative accepted response has no output yet. IDs vary for each request. The derived fieldsoutput_text, artifacts, final_artifacts, and pending_inputs are added by the SDK.
Output item types
Treat IDs as opaque strings. Response, input request, and artifact IDs identify different resources.
Stream snapshots
The stream yields complete snapshots, not text deltas. Replace the displayed state on each update. Do not append each snapshot’soutput_text.
Recover an uncertain submission
Save the exact request body and idempotency key before the first attempt.SAVED_COMMAND_KEY represents the key stored before the original attempt. Use its exact saved input, too.
Handle errors
Inspectresponse.status and response.error for execution failures.
Catch AgentRequestError for request failures.
See errors and troubleshooting for recovery actions and error context.