Observed since 21 Oct, 08:57 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Work Orders and Work Reports for AI agents: Pydantic models and the spec's validation rules.
Work Orders and Work Reports for AI agents, in Python. Pydantic models for both documents and every validation rule from the Agent Work Layer spec, with the same rule ids, kinds and paths as the TypeScript SDK.
A Work Order says what a job is and what it may use: goal, criteria, budget, deadline and allowed tools. A Work Report says what was done and proves it: evidence for each criterion, cost and tools used. The checks tell you whether a report holds up against its order.
pip install agent-work-layer
Python 3.9 or newer. Depends on jsonschema and pydantic (v2).
Documents are plain JSON (dicts). Each validate_* function returns a list of findings; an empty list means valid.
import json
from agent_work_layer import validate_order, validate_report, has_invalid
# examples/ in the repository
order = json.load(open("examples/risk-summary.order.json"))
report = json.load(open("examples/bad.report.json"))
assert validate_order(order) == []
findings = validate_report(report, order)
for f in findings:
print(f.rule, f.kind, f.path, f.message)
# R4 invalid /evidence no evidence for criterion "c2"
# R5 invalid /tools_used/1 tool "web/browse" is not allowed by this order
# R7 limit /cost/usd spent 3.1 usd, budget is 2
# R6 invalid /cost cost must report "tool_calls" because the budget sets it
# R8 limit /finished_at finished after the deadline
# R11 invalid /result/output 'total_debt' is a required property
# R11 invalid /result/output/risk_factors ['Refinancing'] is too short
if has_invalid(findings):
... # reject the report and send the findings back to the worker
invalid findings reject the document.limit findings (R7 over budget, R8 past the deadline) are accepted but recorded, and move the order to expired.| Function | Rules |
|---|---|
validate_order(order) | O1–O4 |
validate_report(report, order) | R1–R12 |
validate_child_order(child, parent) | C1–C3: a sub-order may only narrow its parent's budget, tools and deadline |
is_work_order(value), is_work_report(value) | Structure only (O1, R1) |
tool_allowed(tool, patterns), pattern_covered(child, parents) | Tool pattern matching (server/tool, server/*, *) |
The JSON Schemas are available as work_order_schema and work_report_schema.
from datetime import datetime, timedelta, timezone
from agent_work_layer import Criterion, WorkOrder, validate_order
now = datetime.now(timezone.utc)
order = WorkOrder(
id="wo_42",
created_at=now,
from_="agent:manager", # "from" in JSON
to="agent:researcher",
goal="Summarize the risk factors in the 2025 annual report",
criteria=[Criterion(id="c1", text="Lists the three largest risk factors with quotes")],
budget={"usd": 2, "tool_calls": 20},
deadline=now + timedelta(hours=2),
tools=["filings/*"],
)
doc = order.to_dict() # JSON-ready, with "from" and RFC 3339 timestamps
assert validate_order(order) == [] # the validators accept models too
WorkOrder.model_validate(data) and WorkReport.model_validate(data) parse documents. The models catch obvious mistakes as you build. The validate_* functions are the checks the spec defines.
Findings have the same rule ids, kinds and JSON Pointer paths as agent-work-layer on npm, including its details:
Date.parse does.$ does not match before a trailing newline.The messages are worded differently, and schema findings (O1, R1, R11) can come in a different order. One known difference: for a caller's output_schema (R11) that uses if/then, contains, propertyNames or dependentRequired, the number of R11 findings can differ from the TypeScript SDK. Whether R11 fires is always the same.
The desk (lifecycle, permissions, storage) and the MCP server are in the TypeScript packages. This package covers the documents and the checks.
Apache-2.0
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.2.0 | 18 Oct 2026 | 3 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 21 Oct, 08:57 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:d606fbd3e3b9cc513de4ceca2ec39e83302e69d554ad667d8fff8fdc9796378a