Sign in Get started

Agent cookbook

Tool-call sequences for common agent jobs: price and start training, import from V7 and draft new labels, export a filtered subset, and confirm before deleting.

View as Markdown
On this page

Each recipe is one job’s tool calls, as toolkit.dispatch calls; every framework sends the same names and arguments. The system prompt rules apply throughout.

from pictograph.agents import create_toolkit

toolkit = create_toolkit()

1. Price, then train

The user asks: “Train a YOLOX model on my road-signs dataset.”

toolkit.dispatch(
    name="create_export",
    args={
        "dataset": "road-signs",
        "name": "road-signs-2026-10-30",
        "format": "pictograph",
    },
)
quote = toolkit.dispatch(
    name="quote_training_run",
    args={
        "dataset": "road-signs",
        "export": "road-signs-2026-10-30",
        "pipeline_type": "yolox",
        "gpu_type": "auto",
    },
)
balance = toolkit.dispatch(
    name="get_credit_balance",
    args={},
)

Show the user the quote and the balance (blocking says why when can_start is false). Start only after the user agrees:

toolkit.dispatch(
    name="train_pipeline",
    args={
        "dataset": "road-signs",
        "export": "road-signs-2026-10-30",
        "pipeline_type": "yolox",
        "gpu_type": "auto",
    },
)

The date in the export’s name keeps a rerun from colliding: a second export of the same name is a ConflictError.

2. Import from V7, then draft a new class

The user asks: “Import road-damage from V7 and add a pothole class drafted by SAM3.”

found = toolkit.dispatch(
    name="validate_connector",
    args={"provider": "v7", "api_key": "<the user's V7 key>"},
)
road_damage = next(d for d in found["datasets"] if d["name"] == "road-damage")
toolkit.dispatch(
    name="import_from_connector",
    args={
        "provider": "v7",
        "api_key": "<the user's V7 key>",
        "datasets": [road_damage],
    },
)
toolkit.dispatch(
    name="auto_annotate_dataset",
    args={
        "dataset": "road-damage",
        "classes": [{"name": "pothole", "output_type": "polygon"}],
    },
)

import_from_connector returns once the import finishes. auto_annotate_dataset skips annotated images, so the imported labels stay; the drafts go to the user for review.

3. Retry the images a batch missed

The user asks: “Draft tigers and elephants in wildlife; retry any image that fails.”

report = toolkit.dispatch(
    name="auto_annotate_dataset",
    args={
        "dataset": "wildlife",
        "classes": [
            {"name": "tiger", "output_type": "polygon"},
            {"name": "elephant", "output_type": "polygon"},
        ],
    },
)

report["failures"] names each image the batch missed. For each one:

toolkit.dispatch(
    name="auto_annotate_text",
    args={"dataset": "wildlife", "image": "img-0412.jpg", "text_prompt": "tiger"},
)

4. Export a filtered subset

The user asks: “Export the finished stop_sign and yield labels of road-signs as YOLO.”

toolkit.dispatch(
    name="create_export",
    args={
        "dataset": "road-signs",
        "name": "stop-yield-yolo-2026-10-30",
        "format": "yolo",
        "class_filter": ["stop_sign", "yield"],
        "status_filter": "complete",
    },
)
toolkit.dispatch(
    name="download_export",
    args={
        "dataset": "road-signs",
        "export": "stop-yield-yolo-2026-10-30",
        "output_path": "./stop-yield.zip",
    },
)

5. Confirm before deleting

The user asks: “Delete the old test datasets.”

toolkit.dispatch(
    name="list_datasets",
    args={"limit": 100},
)

The agent names the matches and asks the user to confirm by repeating them. Then, for each:

toolkit.dispatch(
    name="delete_dataset",
    args={"dataset": "test-1"},
)

delete_dataset needs an admin key; a member key gets ForbiddenError (403).

6. Find images to move

The user asks: “Move every night-time image into a night directory.”

toolkit.dispatch(
    name="search_by_tag",
    args={"dataset": "road-signs", "attributes": ["night"], "limit": 500},
)

No agent tool moves images: the user moves the list in the app or with client.batch.move.

Copied to clipboard