Tasks

run_task

Use run_task to run a task from Python.

If you’re running in an async function, use gage_inspect.task.run_task_async, which has the same function signature.

Note that task input can be a Pydantic BaseModel as well as a string or list of chat messages. Instances of BaseModel are encoded as YAML-formatted strings when sent to a model.

def run_task(
    task: str | Task,
    input: str | list[ChatMessage] | BaseModel,
    task_args: list[str] | None = None,
    model: str | Model | None = None,
    target: str | None = None,
    log_dir: str | None = None,
    tags: list[str] | None = None,
) -> TaskResponse

Docs under development — stay tuned!

Inspect classes:

Copyright 2025 Gage ML, Inc.