Skip to content

Prepare for production

Set up your agent

Give your coding agent a Steel browser and the Steel skills, so that it browses and writes Steel code the right way. Learn more

Install the Steel CLI. It signs you in and installs the skills for your coding agents.

curl -fsS https://setup.steel.dev | sh

Or send this prompt to your coding agent, and it does the same:

Read https://setup.steel.dev/install.md and follow it to set up Steel for this coding client.
Then continue my requested task using the installed Steel skill.

Set up your agent →

Check your keys, timeouts, retries, limits, cost, security and monitoring before you send real traffic through Steel. These are the parts of an integration that usually go wrong when it moves from a test to real traffic. Go through the items before you go live, and again before a large increase in traffic. Most items link to the page that shows how.

Keys and projects

  • Use one project for each environment. Give development, staging and production each their own project and project key, so that a test key cannot reach production sessions. All projects in the organization share the concurrent session limit. See Projects.
  • Keep keys out of the code. Read the key from STEEL_API_KEY or a secret store, and never send it to a browser or a mobile app. See API keys.

Timeouts and release

  • Release every session. Call release in a finally block, so that a session also ends when the task fails. Browser time counts until the session ends. See Create a session and Pricing.
  • Set timeout for the task. A session cannot get more time after it starts. Set timeouts has the default and the limits.
  • Set inactivityTimeout. Steel then releases a session when the code that drives it stops, for example after a crash, so a stopped worker costs minutes instead of the full timeout. Leave room for model calls and for people who work in the live view. See Set timeouts.
  • Sweep for sessions that were left live. Tag sessions with metadata, and release a job's live sessions when the job ends. See Run sessions at scale.

Retries

  • Retry only the errors that say they are retryable. Most API errors have retryable, and some have retryAfterSeconds. The Steel SDK retries these errors for you. See Run sessions at scale and Errors.
  • Send an Idempotency-Key with Commands requests. A retry with the same key returns the stored result and does not run the commands again. From version 0.23.0, the Steel SDK sends a key for you and keeps it across its retries. See Commands.
  • Check before you repeat a step that has an effect. A form that orders or pays may have gone through even when your code saw an error. Check the result on the site before you try again.

Limits

  • Stay under your concurrent session limit. Queue tasks in your own code, and run fewer workers than your limit. See Limits and Know your limits.
  • Stay under your rate limits. A 429 response with the code rate_limited means that you created too many sessions in a minute, or sent too many Quick action requests. Wait for the time in the Retry-After header. See Limits.
  • Check your plan's session length. Split a task that needs more time than your plan allows into shorter sessions, or move to a plan with longer sessions. See Limits.

Cost

  • Cut the bandwidth that your pages use. With Steel proxies, you pay for the bandwidth that a session uses. Steel blocks ads by default. Block the images and media that the task does not need as well. See Reduce bandwidth.
  • Keep the balance up, and set a spending limit. When the balance runs out, new sessions fail with 402 and insufficient_funds. When the organization reaches its monthly spending limit, they fail with 402 and budget_exceeded. Neither error is retryable, so alert on both. See Billing and usage.
  • Measure cost by customer or by job. Tag sessions with metadata and read each session's cost. See Track cost per customer.

Security

  • Treat page content as untrusted input. A page can hold text that tries to give your agent instructions. Do not let page content decide which tools the agent may use or where it sends data.
  • Let Steel hold the credentials that your agent uses. Stored credentials fill the sign-in form inside the session, so the password does not pass through your code or the model. See Credentials.
  • Protect the live view URL. Anyone with a session's debugUrl can watch the session, and can control it while the view is interactive. Send it only to users that your app has checked. See Embed a live browser in your app.
  • Protect saved state. A session context holds a signed-in account's cookies. Store it like a password. See Session context.
  • Keep secrets out of metadata. Steel shows metadata in the dashboard. See Add metadata.
  • Review how Steel handles your data. See Security and compliance.

Observability

  • Log the session ID with each job. With the ID, you can find any run's recording, logs and cost. See Debug a failed session.
  • Watch signals. Count the sessions with bot_detection_triggered, captcha_encountered or proxy_connection_failed for each job, and alert when the count rises. See Signals.
  • Find failed and crashed sessions. List sessions with status set to failed to find the ones whose browser did not start. A crash can end a session as released, so filter by releaseReason to find the runs that crashed (browser_crashed) or ran out of time (timeout). See Debug a failed session.
  • Watch session cost. Read each session's cost after release, to find the jobs that cost the most. See Session cost.

Next steps