Before you start
- A Workspace API key with the
adminrole. This walkthrough requires it for the Environment permission grant in step 2. See Get access. - A Gemini API-key credential in the same Workspace. Add it in Model credentials with provider
google-ai-studio, then copy itsmcred_…ID. The example pins that credential; it does not assume Checkfu-managed model supply or fall back to it if the key is refused. - Workspace execution configured to run Pi with this model. Check the Workspace’s capability status.
- For the shell examples, Bash,
curl,jq, andopenssl.
CHECKFU_QUICKSTART_ID and each request body unchanged when retrying. Stop if a command fails or does not return an ID; do not run later steps with an empty or old ID. Use this new Session for one task at a time.
cURL needs no Checkfu package. The other tabs assume you already installed the CLI or SDK using the instructions supplied with your authorized artifact. See CLI access or the TypeScript SDK reference.
For TypeScript, reuse this client and the same request identity:
1. Create an Agent
The Agent selects Pi, Gemini 2.5 Flash, and your credential. Creating it also creates immutable Version 1.CHECKFU_AGENT_ID; TypeScript keeps agent.id. See Agents for configuration and versioning.
2. Start a Session
Create an Environment and grant the Agent permission to use it. Then start a Session with that Agent and Environment. The Session records their selected configuration.CHECKFU_SESSION_ID; TypeScript keeps session.id. A refused request must be resolved before sending a task; Checkfu does not switch harnesses or model credentials for you.
Selected response fields
Selected response fields
agent.version and environment_id identify the immutable AgentVersion and Environment authority frozen at admission.3. Send a task
Send one message and keep the returned event’sseq. This receipt identifies the accepted input. Authenticated server context supplies durable actor attribution.
CHECKFU_INPUT_SEQ; TypeScript keeps inputEvent. Retrying this request with the same key and body recovers the same accepted event. Sending a new key would submit another task.
4. Read the answer
Follow from just after the accepted message. The TypeScript example prints the Agent’s answer and only reports success after a normal end-of-turn event. Keep this Session free of other inputs until this task finishes.seq, so earlier history in the Session cannot end the follow.
A visible primary agent.message followed by session.status_idle or session.status_completed with stop_reason: "end_turn" marks success for this task. requires_action needs a response before work can continue; failure, cancellation, withheld output, other stop reasons and stream disconnection are not success. The CLI returns at a boundary, including a wait, then prints saved events as JSON so you can inspect payload.stop_reason. cURL stays connected.
If the CLI JSON has a non-null next_page, repeat sessions.listEvents with the same --path and --query '{"page":"<next_page>"}', replacing the placeholder with that token and omitting after. Continue until you reach the boundary after the answer; a partial page or [idle] alone does not establish success.
With cURL, read the data: payloads and press Ctrl+C after you have checked the answer and boundary. A CLI exit or closed stream alone does not prove success.
The SDK preserves the answer flags during automatic reconnects. After a process restart, replay from the original inputEvent.seq unless you restored both answer flags with your cursor.
If work requires action, handle the pending approval or tool response and continue reading the same Session. If the connection breaks, resume the stream from the last event you processed; do not create another Session or resend the message to reconnect.
Read saved events
Read saved events
Use the paged event log to inspect persisted history. Follow its pagination to reach the events after your accepted input.
If a request fails
401 auth.invalid_key: check the API key.400 validation.malformed: check the request body andCheckfu-Version.404 validation.not_found: check that the resource belongs to the key’s Workspace.
error.type in the error reference. Correct the cause before retrying; do not treat every conflict as a stale Agent or switch credentials automatically.