API referenceConsole
Cloud provider
Polylane maps your Modal apps and functions, reads their logs, deployments and spend to find what broke or got expensive, and writes the fix in your code.

Connect

Connect Modal from the terminal. Pass --help for the flags Modal accepts, plus --no-browser for headless environments.

Terminal
polylane cloud connect --provider modal

How it works

Resources in the context graph

Polylane maps each environment of the workspace. In each environment, it maps your apps, functions with their web endpoints, classes, images, running sandboxes, volumes, secrets, queues and dicts. For a secret, Polylane stores the name only, because Modal does not expose secret values. Polylane syncs every 15 minutes.

When a sync finds a new version of an app, Polylane records a deployment with the version and the person who deployed it.

Checks and anomaly detection

Four account checks watch the whole workspace:

  • stderr log lines across every recently active app
  • metered spend for each hour
  • the p90 time from creating a sandbox to the start of its container
  • the total number of items that wait in your queues

Each app also gets its own monitor, with two series: stderr log lines and metered spend for each hour. Modal reports only point-in-time values for other resources, so functions, sandboxes and volumes have no series of their own. Polylane compares each series with its usual level, and opens an issue when a change is a real problem.

What agents can do

During an investigation, agents describe an app with its state, deploy history and functions, and read app logs, deployments, sandboxes and spend for one app or for the workspace. Agents can set a watch that wakes a thread when the next deployment of an app lands.

Polylane has no tools that change Modal. It only reads from Modal.

Troubleshooting

"Invalid token" error

  • Polylane needs both the token ID and the token secret. One of them alone cannot authenticate.
  • Check that the token is not revoked in the Modal settings.
  • Make sure you copied the full values, with the ak- and as- prefixes.

Missing resources

  • Polylane finds functions through their app. An app that was never deployed has no functions to show.
  • Polylane skips finished sandboxes. Only running sandboxes appear.
  • An image appears only when a function runs on it. Modal has no image list, so a base image with nothing built on it does not appear.
  • Polylane links a class to its methods by name. A method with a name that does not start with its class name appears as a separate function.
  • Click Sync in the account header to sync before the next scheduled sync.

Charts look low or short

  • A stderr count is a count of log lines, not of failures. One Python traceback is several lines.
  • Modal keeps logs for 24 hours, so a log chart covers 24 hours at most.
  • Modal reports the spend of an hour only after that hour ends, so the newest hour reads low until it is complete.

Disconnecting

Disconnecting does not change Modal. Revoke the token under Settings → Tokens in Modal.

Disconnect

Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Modal is removed as well; nothing is left behind.

Terminal
polylane cloud disconnect <id>

Tools

5

Operations agents can perform in threads.

Get Logs
Get Modal app logs: per-bucket volume by stream plus sampled lines
List Sandboxes
List Modal sandboxes in an environment, with their state and resource shape
List Deployments
List Modal app deployments: version, who deployed, and when
Describe App
Describe one Modal app: state, deploy provenance, and the functions inside it
Get Cost
Get metered Modal spend, for one app or broken down across the workspace

Supported resources

10

Resource types that show up in your infrastructure graph.

Environment
App
Function
Class
Sandbox
Image
Volume
Secret
Queue
Dict