Skip to main content

Get Your API Key

  1. Sign up at webrun.ai
  2. Navigate to Settings → API Keys
  3. Click Create API Key and save it
Sessions cost money until terminated. Set terminateOnCompletion: true on your final task or explicitly terminate when done.

Run Your First Task

The simplest approach: one API call that creates a session, runs your task, and auto-terminates.
If the task completes within 50 seconds, you get the result immediately:
If the task takes longer, you’ll get a polling URL:
Poll the URL every 2-3 seconds until the task completes. Most tasks finish in 10-40 seconds, so faster polling wastes API quota while slower polling adds latency.

Multi-Task Sessions

For multiple tasks in sequence, create a persistent session: 1. Create the session
2. Send follow-up tasks
3. Terminate when finished
Alternatively, set terminateOnCompletion: true on your last task to auto-terminate the session. Multi-task workflows guide

Polling for Results

When a task returns status: "pending", poll the URL until completion.
This handles both instant and long-running tasks automatically.

Real-Time Updates with WebSocket

For live agent thoughts and action notifications, use WebSocket. This requires more setup but gives you sub-second visibility into task execution. WebSocket integration guide

Next Steps

Multi-Task Workflows

Chain multiple tasks in a session

MCP Integration

Set up Claude Desktop integration

Video Streaming

Watch sessions execute in real-time

Cost Optimization

Reduce costs and improve efficiency

File Uploads

Upload files for the agent to use in sessions