Skip to main content

callva-agentworker

One headless turn of a coding agent, as a Python library with no dependencies. It launches Claude Code or Codex with the flags that make a fence real, keeps the process under a deadline, reads the engine's own report tolerantly, and hands back one result with the failure named. Nothing else: no queue, no schedule, no ledger.

DESIGN.md is the contract.

Install

pip install callva-agentworker

In a PEP 723 script, pin the exact version so nothing outside the script's own release changes what it runs:

# /// script
# dependencies = ["callva-agentworker==0.1.0"]
# ///

Use

from callva.agentworker import Profile, Session, run

result = run(
    "Summarise README.md in one line.",
    Profile(engine="claude", fence="read", timeout_seconds=120),
    cwd="/path/to/project",
)
if result.ok:
    print(result.answer, result.cost_usd, result.session_id)
else:
    print(result.failure.kind, result.failure.message)

run() never raises for anything the engine did. Every ending is a Result; result.failure.kind says what kind, and result.failure.message carries the engine's own sentence.

Profile

How the turn is run. Keep profiles in your own configuration and validate them with the schema the package ships:

from callva.agentworker import Profile, PROFILE_SCHEMA

profile = Profile.from_dict({
    "engine": "codex",
    "fence": "act",
    "model": "gpt-5-codex",
    "effort": "high",
    "timeout_seconds": 3600,
    "env": {"deny": ["SECRET_*"], "set": {"TASKS_EXECUTION": "exec-42"}},
})
Field Meaning
engine claude or codex
fence read, write or act; enforced by the engine, never by the prompt
model, effort, service_tier passed through; None leaves the engine's default
timeout_seconds the deadline; the whole process tree is killed when it passes
budget_usd claude only
allow_tools extra tool patterns a fenced turn may use, such as Bash(tasks:*)
env which inherited variables reach the engine: allow, deny, set
extra_args appended verbatim; the escape hatch

Session

Session.fresh() starts a conversation; on claude the id is chosen before launch so a killed turn is still addressable, on codex it is learned from the stream. Session.resume(id) continues one. Session.pinned(id) chooses the id and is claude-only.

Result

ok, answer, structured, session_id, model, cost_usd, duration_ms, num_turns, tokens, permission_denials, failure, exit_code, stderr_tail, command, raw. Fields an engine cannot report are None.

Failure kinds

quota, model_refused, not_authenticated, timeout, cancelled, binary_missing, max_turns, budget, invalid_output, error, crash. A spent quota is read before a refused model, because a subscription spent on one model says both and only one of them is a pause. failure.retryable is true for the kinds where running the same turn again later can succeed.

Progress and cancel

Pass on_event to receive every JSON event the engine streams while the turn runs, and render it yourself. Pass a threading.Event as cancel to end a turn early; the whole tree is killed.

Structured answers

Pass schema as a JSON-schema dict. The engine's native flag is used; if the engine returned no structured field the answer text is parsed, and if that fails the turn is an invalid_output failure with the text kept.

Versioning

SemVer with the 0.x rule: the minor is the breaking position. A changed field meaning, a removed flag or a changed default is a minor; an added result field, an added profile field with a None default, or a newly supported engine option is a patch.

License

Apache-2.0.

Metadata

Release files for callva-agentworker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for callva-agentworker 0.1.0
File Size Uploaded
callva_agentworker-0.1.0.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for callva-agentworker 0.1.0
File Interpreter ABI Platform
callva_agentworker-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 46.1 kB

Release files / callva_agentworker-0.1.0.tar.gz

Download URL callva_agentworker-0.1.0.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7e71318d70217697772c08e90c5b040c9bd482a730f5601c011bf299216c0119
BLAKE2b-256 checksum
How to use checksums
701a31d9eaab7adc9cd991ecf6dd56f2037378a93f9ab42a8968fc897e186d6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / callva_agentworker-0.1.0-py3-none-any.whl

Download URL callva_agentworker-0.1.0-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f886f8c26f171f6c34b2987dc708c12622b93ac4cdd0ab2eab29c4de9d2059d3
BLAKE2b-256 checksum
How to use checksums
44eaf5eea3b6db7b001a1347d055d7dfaa720a2965c046796f88cea84ecf09a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page