Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

123 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent-runtime

A worker runs an AI agent job by calling a model, running tools and recording each step in Postgres. If the worker stops, another worker can claim the same job when its lease expires and continue from the step log.

Worker A records a step and stops. After its lease expires, worker B claims the job and resumes from the step log.

Quickstart

Requires uv, Docker with Compose, make, and Linux with GNU stat for the Docker socket group. The quickstart uses a local fake provider.

git clone https://github.com/sindredg/agent-runtime.git
cd agent-runtime
make up
uv run runtime submit examples/hello.json --follow

make up builds the images and starts Postgres, the API, one worker, the fake provider, a fake issue tracker and a fake notification receiver. The job asks the agent to read one file. The output is the job id, one line per step, and the outcome:

01a1e686-e31e-73d2-af47-e26d4b14a322
   1  model_request   model=hello messages=1
   2  model_response  stop_reason=tool_use tokens=460+44 I will read hello.txt from the workspace.
   3  tool_intent     read_file {"path": "hello.txt"}
   4  tool_result     ok Hello from the workspace.
   5  model_request   model=hello messages=3
   6  model_response  stop_reason=end_turn tokens=553+22 The file hello.txt holds a short greeting. The job is done.
succeeded  tokens_used=1079

The fake provider scripts the model responses. The worker reads hello.txt from the job workspace and records its contents in tool_result.

Next: the other examples, job files and the CLI. make clean stops the stack and deletes its database.

What is built

Jobs can wait for approval and post the question to an operator's URL, run shell commands in a sandbox and enforce token budgets and deadlines. See Architecture for how the pieces fit together and Known limits for the boundaries of each guarantee.

Results

Each tested guarantee has a test with a pass line fixed before the run, and a run with the mechanism switched off to show that the test can fail. A check that such a run did not reach is named with its result.

Guarantee Status Evidence
A job survives a worker stopping Tested 200 of 200 jobs, 169 kills
An unsafe tool call does not run twice without approval Tested, with accepted exceptions No operation id with two issues, also in Gitea
A stale worker cannot corrupt a job Tested No write after the takeover
A job that crashes its worker every time does not loop forever Tested Failed after 5 takeovers
Every job stays inside its token budget and deadline, and can be cancelled Tested, with accepted exceptions Budget, cancel and deadline
A tool can reach only its job's scope, and nothing else of the host Tested, with accepted exceptions 23 of 23 escape tests
A tool call that needs approval does not run before a person approved it Tested 134 issues for 134 approvals
Bad tool output does not break a job Tested 100 MB cut to 64 KiB, the job goes on
A provider's rate limit (429) slows a job, it does not fail it Tested for one job. No limit shared by workers. One job waits out 60 s of 429s
The step log cannot be changed without detection Tested, with stated limits Changes refused or found; 483 jobs verified
A job that waits for a person tells the operator, at least once Tested. In the kill run the receiver holds each POST 1.5 s. Every question arrived, in three runs of 20 jobs
Throughput scales with workers Not measured

The table's results are from one run of every suite at 4ed43c0, on one machine, against the fake provider. CI runs the suites on each pull request, with 20 kills. Runs at other commits are named on Results.

The fake provider is compared with the Claude API by a contract test that is started by hand: The contract test. Eight single jobs ran against the API first: Runs against the Claude API.

The kill runs also passed on the Claude API, 33 jobs on each of three models: every job succeeded and no issue was opened twice (Kill run results).

Documentation

Page Covers
Running jobs The examples, job files, the CLI
Architecture Components, how a job runs, and a map of the other pages
Results The evidence behind each guarantee
Runs against the Claude API Eight jobs with a real model, and what they do not show
Known limits What is accepted and what is not built
OWASP APTS The security standard's requirements for the runtime's layer: status and gaps
Decision records Why it is built this way

Development

uv installs the pinned Python and tools into .venv.

Command What it does
make up Build the images, start every service, wait until all are healthy
make up-claude The same stack with the worker on the Claude API. Every job costs money.
make logs Follow the service logs
make down Stop the services, keep the database volume
make clean Stop the services, delete the database volume and the lab's Gitea data
make test Unit tests
make integration Integration tests. Needs the stack from make up.
make escape Escape tests: tries to get out of the sandbox. Needs no stack.
make chaos Chaos tests: kills, pauses and crashes workers. Run make up afterwards.
make lab Lab demo: a worker stopped in a call to Gitea. Puts the normal stack back.
make kills Kill runs: killed workers, judged without a reference run. Run make up afterwards.

Suites, failure switches and the lint commands are in Testing. Ports and environment variables are in Settings.

The API has no authentication. Do not publish its port on another interface.

License

Apache License 2.0. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages