Skip to content
Dashboard
Core Concepts

Responses API

OpenAI-compatible computer-use agent interface for building your own agent loops.

The Responses API is an OpenAI-compatible interface for building computer-use agent (CUA) loops. A CUA loop is a pattern where a vision model looks at a screenshot of a computer screen, decides the next action (click, type, scroll), and you execute it — repeating until the task is complete. Unlike Agent Tasks where the agent runs autonomously, the Responses API gives you control at every step.

  1. Send input — provide a text instruction and optionally a screenshot
  2. Get output — the model returns either a text message or a computer_call action
  3. Execute the action — perform the click, type, or scroll on a computer session
  4. Feed back the result — send a screenshot of the new state as computer_call_output
  5. Repeat until the model returns a message (it’s done) or you decide to stop

The input field accepts either a string or an array of message objects:

  • String — simplest form, for text-only instructions
  • Array — when you need to include images (screenshots) or structured multi-turn input

Both formats work identically for text-only requests. Use the array format when you need to attach a screenshot with input_image.

The simplest form — pass a string as input:

from tzafon import Lightcone
client = Lightcone()
response = client.responses.create(
model="tzafon.northstar-cua-fast",
input="Go to wikipedia.org and search for 'Alan Turing'",
tools=[
{
"type": "computer_use",
"display_width": 1280,
"display_height": 720,
"environment": "browser",
},
],
)
import Lightcone from "@tzafon/lightcone";
const client = new Lightcone();
const response = await client.responses.create({
model: "tzafon.northstar-cua-fast",
input: "Go to wikipedia.org and search for 'Alan Turing'",
tools: [
{
type: "computer_use",
display_width: 1280,
display_height: 720,
environment: "browser",
},
],
});

When you need to include a screenshot (common in CUA loops), use the array format:

response = client.responses.create(
model="tzafon.northstar-cua-fast",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "Click the search button"},
{"type": "input_image", "image_url": screenshot_url},
],
},
],
tools=[
{
"type": "computer_use",
"display_width": 1280,
"display_height": 720,
"environment": "browser",
},
],
)
const response = await client.responses.create({
model: "tzafon.northstar-cua-fast",
input: [
{
role: "user",
content: [
{ type: "input_text", text: "Click the search button" },
{ type: "input_image", image_url: screenshotUrl },
],
},
],
tools: [
{
type: "computer_use",
display_width: 1280,
display_height: 720,
environment: "browser",
},
],
});

The response output is an array of items. Each item has a type:

TypeMeaning
computer_callThe model wants to perform an action (click, type, scroll, and more)
messageThe model is responding with text (task may be done)
reasoningInternal reasoning (if available)

When you get a computer_call, the action field tells you what to do:

for item in response.output:
if item.type == "computer_call":
action = item.action
print(f"Action: {action.type}") # e.g., "click", "type", "navigate"
print(f"Coordinates: ({action.x}, {action.y})")
print(f"Text: {action.text}")
elif item.type == "message":
for block in item.content:
print(block.text)
for (const item of response.output ?? []) {
if (item.type === "computer_call") {
console.log(`Action: ${item.action?.type}`);
console.log(`Coordinates: (${item.action?.x}, ${item.action?.y})`);
console.log(`Text: ${item.action?.text}`);
} else if (item.type === "message") {
for (const block of item.content ?? []) {
console.log(block.text);
}
}
}

The model returns actions with coordinates already scaled to match your display_width and display_height. You can pass action.x and action.y directly to computer.click() or other session methods without any conversion.

The model can request these actions:

ActionFieldsDescription
clickx, y, buttonClick at coordinates
double_clickx, yDouble-click
triple_clickx, yTriple-click (select a line)
right_clickx, yRight-click
typetextType text
key / keypresskeysPress key combination
key_down / key_upkeysHold / release key
scrollx, y, scroll_yScroll vertically
hscrollx, y, scroll_xScroll horizontally
navigateurlGo to a URL (browser only)
dragx, y, end_x, end_yDrag between two points
waitWait for the page to settle
terminatestatus, resultTask is complete (status: "success" or "failure")
answerresultAnswer a question with findings
donetextTask is complete (alias)

Use previous_response_id to chain conversations without resending the full history:

# First turn — string input is fine for text-only
response = client.responses.create(
model="tzafon.northstar-cua-fast",
input="Navigate to example.com",
tools=[{"type": "computer_use", "display_width": 1280, "display_height": 720, "environment": "browser"}],
)
# Execute the action, take a screenshot, then continue
followup = client.responses.create(
model="tzafon.northstar-cua-fast",
previous_response_id=response.id,
input=[
{
"type": "computer_call_output",
"call_id": response.output[0].call_id,
"output": {"type": "input_image", "image_url": screenshot_url},
},
],
tools=[{"type": "computer_use", "display_width": 1280, "display_height": 720, "environment": "browser"}],
)
// First turn — string input is fine for text-only
const response = await client.responses.create({
model: "tzafon.northstar-cua-fast",
input: "Navigate to example.com",
tools: [{ type: "computer_use", display_width: 1280, display_height: 720, environment: "browser" }],
});
const followup = await client.responses.create({
model: "tzafon.northstar-cua-fast",
previous_response_id: response.id!,
input: [
{
type: "computer_call_output",
call_id: response.output![0].call_id!,
output: { type: "input_image", image_url: screenshotUrl },
},
],
tools: [{ type: "computer_use", display_width: 1280, display_height: 720, environment: "browser" }],
});
# Retrieve a response
response = client.responses.retrieve("resp_abc123")
# Cancel an in-progress response
client.responses.cancel("resp_abc123")
# Delete a response
client.responses.delete("resp_abc123")
const response = await client.responses.retrieve("resp_abc123");
await client.responses.cancel("resp_abc123");
await client.responses.delete("resp_abc123");
ModelBest for
tzafon.northstar-cua-fastComputer-use tasks (optimized for CUA)
tzafon.sm-1General text tasks