Agent harness

Long jobs

A long job lets the agent work through a bigger task over several turns, in a folder you choose.

Copy page
View as Markdown

What a long job is

A long job is the same agent loop with a bigger budget and a folder to work in. Long jobs are part of the Python SDK (pip install harny, module harny.agent). They are off by default. You turn them on with long_task in AgentConfig.

The model runs on your own model key. Harny never sees it. For the basic agent setup, see Agent harness overview. For the memory a job can read, see Memory API.

Set up a long job

Pass a LongTaskConfig with a workspace folder, then start the job with run_task:

from harny.agent import Agent, AgentConfig, FileSessionStore
from harny.agent.long_task import LongTaskConfig

agent = await Agent.create(
    harny=harny,
    preset="cost_first",
    config=AgentConfig(
        instructions="You work through a folder of tenant emails for the office manager.",
        long_task=LongTaskConfig(workspace="./jobs/renewals"),
    ),
    store=FileSessionStore("./data/sessions"),
)
result = await agent.run_task(user="demo-user", message="List the tenants whose lease ends within 45 days.")

Limits per turn

LimitDefault
Model calls per turn100
Seconds per turn3,600
Turns in a chainup to 10
Spend cap5,000,000 tokens

Folder and shell

The folder and any shell are yours. Harny hosts nothing for a long job. Choose a workspace path your deploy can write to, and review what the job can run before you turn it on.

Backup model on errors

On a transient provider error, the job tries the next model in the preset that your deploy has a key for. You need keys for more than one model for this to help.

Example: leases ending soon

Put the tenant emails in the workspace folder. Then ask the job:

List the tenants whose lease ends within 45 days.

The run answers with the list it finds. Check the answer against the emails before you act on it.

Next