agent-apprenticeship 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/agent-apprenticeship.js +96 -22
- package/docs/bioactive_evidence_mapping_schema.md +113 -0
- package/docs/dataset_schema.md +160 -0
- package/docs/local_usage.md +191 -0
- package/docs/scaling_to_1000_tasks.md +3 -0
- package/docs/trace_schema.md +192 -0
- package/docs/v0.2_release_notes.md +61 -0
- package/package.json +2 -1
- package/pyproject.toml +1 -1
- package/src/agent_apprenticeship_trace/__init__.py +1 -1
- package/src/agent_apprenticeship_trace/bundle_exporter.py +36 -1
- package/src/agent_apprenticeship_trace/cli.py +73 -12
- package/src/agent_apprenticeship_trace/contract_verifier.py +686 -0
- package/src/agent_apprenticeship_trace/learning.py +203 -6
- package/src/agent_apprenticeship_trace/public_run.py +31 -3
- package/src/agent_apprenticeship_trace/public_sanitizer.py +3 -3
- package/src/agent_apprenticeship_trace/tdo.py +1322 -43
- package/src/agent_apprenticeship_trace/trace_normalizer.py +25 -2
|
@@ -115,6 +115,66 @@ function setupHeartbeatMs(defaultMs) {
|
|
|
115
115
|
return Number.isFinite(value) && value > 0 ? value : defaultMs;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
function sleep(ms) {
|
|
119
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function acquireRuntimeLock(lockPath) {
|
|
123
|
+
fs.mkdirSync(path.dirname(lockPath), { recursive: true });
|
|
124
|
+
const started = Date.now();
|
|
125
|
+
let lastHeartbeat = 0;
|
|
126
|
+
const staleMs = setupTimeout(15 * 60 * 1000);
|
|
127
|
+
const waitMs = setupTimeout(15 * 60 * 1000);
|
|
128
|
+
while (true) {
|
|
129
|
+
try {
|
|
130
|
+
const fd = fs.openSync(lockPath, "wx");
|
|
131
|
+
fs.writeFileSync(fd, JSON.stringify({
|
|
132
|
+
pid: process.pid,
|
|
133
|
+
createdAt: new Date().toISOString()
|
|
134
|
+
}, null, 2) + "\n");
|
|
135
|
+
return () => {
|
|
136
|
+
try {
|
|
137
|
+
fs.closeSync(fd);
|
|
138
|
+
} catch (_) {
|
|
139
|
+
// Best effort cleanup.
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
fs.unlinkSync(lockPath);
|
|
143
|
+
} catch (_) {
|
|
144
|
+
// Best effort cleanup.
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (!error || error.code !== "EEXIST") throw error;
|
|
149
|
+
let stale = false;
|
|
150
|
+
try {
|
|
151
|
+
const stat = fs.statSync(lockPath);
|
|
152
|
+
stale = Date.now() - stat.mtimeMs > staleMs;
|
|
153
|
+
} catch (_) {
|
|
154
|
+
stale = true;
|
|
155
|
+
}
|
|
156
|
+
if (stale) {
|
|
157
|
+
try {
|
|
158
|
+
fs.unlinkSync(lockPath);
|
|
159
|
+
} catch (_) {
|
|
160
|
+
// Another process may have refreshed or removed the lock.
|
|
161
|
+
}
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (Date.now() - started > waitMs) {
|
|
165
|
+
console.error("Timed out waiting for another Agent Apprenticeship runtime setup to finish.");
|
|
166
|
+
console.error(`Lock file: ${lockPath}`);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
if (Date.now() - lastHeartbeat > setupHeartbeatMs(30000)) {
|
|
170
|
+
console.error("Waiting for another Agent Apprenticeship runtime setup to finish...");
|
|
171
|
+
lastHeartbeat = Date.now();
|
|
172
|
+
}
|
|
173
|
+
await sleep(1000);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
118
178
|
function runQuiet(command, args, label, timeoutMs) {
|
|
119
179
|
return new Promise((resolve) => {
|
|
120
180
|
let stdout = "";
|
|
@@ -193,28 +253,42 @@ async function ensureRuntime(python) {
|
|
|
193
253
|
// Fall through and rebuild the runtime.
|
|
194
254
|
}
|
|
195
255
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
256
|
+
const releaseLock = await acquireRuntimeLock(`${venvDir}.install.lock`);
|
|
257
|
+
try {
|
|
258
|
+
try {
|
|
259
|
+
const marker = JSON.parse(fs.readFileSync(markerPath, "utf8"));
|
|
260
|
+
if (marker.packageVersion === packageJson.version && fs.existsSync(py)) {
|
|
261
|
+
return py;
|
|
262
|
+
}
|
|
263
|
+
} catch (_) {
|
|
264
|
+
// This process owns the setup lock and will rebuild the runtime.
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
console.error("Installing Agent Apprenticeship runtime...");
|
|
268
|
+
console.error("First run can take a few minutes while Python dependencies are installed.");
|
|
269
|
+
fs.rmSync(venvDir, { recursive: true, force: true });
|
|
270
|
+
fs.mkdirSync(path.dirname(venvDir), { recursive: true });
|
|
271
|
+
await runQuiet(python, ["-m", "venv", venvDir], "create the Python environment", 120000);
|
|
272
|
+
await runQuiet(py, [
|
|
273
|
+
"-m", "pip", "install",
|
|
274
|
+
"--disable-pip-version-check",
|
|
275
|
+
"--progress-bar", "off",
|
|
276
|
+
"--no-input",
|
|
277
|
+
"--no-build-isolation",
|
|
278
|
+
"--retries", "10",
|
|
279
|
+
"--timeout", "60",
|
|
280
|
+
packageRoot
|
|
281
|
+
], "install the Python package", 600000);
|
|
282
|
+
fs.writeFileSync(markerPath, JSON.stringify({
|
|
283
|
+
packageName: packageJson.name,
|
|
284
|
+
packageVersion: packageJson.version,
|
|
285
|
+
installedAt: new Date().toISOString()
|
|
286
|
+
}, null, 2) + "\n");
|
|
287
|
+
console.error("Done.");
|
|
288
|
+
return py;
|
|
289
|
+
} finally {
|
|
290
|
+
releaseLock();
|
|
291
|
+
}
|
|
218
292
|
}
|
|
219
293
|
|
|
220
294
|
function runCli(python, args, usePackagedSource) {
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Bioactive Evidence Mapping Extension Schema
|
|
2
|
+
|
|
3
|
+
This optional Agent Apprenticeship schema describes evidence-mapping rows for specialized research and decision-support datasets. It is a general Experience Compilation extension and does not change the core product into a wellness-only tool.
|
|
4
|
+
|
|
5
|
+
These rows are for provenance, uncertainty tracking, citation grounding, mechanism mapping, and verifier training. They are not medical advice, diagnosis, treatment guidance, cure claims, or sensitive personal records.
|
|
6
|
+
|
|
7
|
+
## Row Families
|
|
8
|
+
|
|
9
|
+
### evidence_mapping_sft_rows
|
|
10
|
+
|
|
11
|
+
LoRA-ready instruction-tuning view for extracting grounded ingredient, compound, product, evidence, mechanism, safety/caution, and uncertainty fields from provided local source material.
|
|
12
|
+
|
|
13
|
+
Required fields:
|
|
14
|
+
|
|
15
|
+
- `row_id`
|
|
16
|
+
- `schema_version`
|
|
17
|
+
- `data_type`
|
|
18
|
+
- `source_task_id`
|
|
19
|
+
- `domain`
|
|
20
|
+
- `subdomain`
|
|
21
|
+
- `workflow_family`
|
|
22
|
+
- `instruction`
|
|
23
|
+
- `input_context`
|
|
24
|
+
- `target_output`
|
|
25
|
+
- `source_text_or_artifact_ref`
|
|
26
|
+
- `source_evidence_ref_ids`
|
|
27
|
+
- `quality_score`
|
|
28
|
+
- `confidence`
|
|
29
|
+
|
|
30
|
+
### ingredient_claim_verifier_rows
|
|
31
|
+
|
|
32
|
+
Verifier-training view for checking whether a claim is supported by visible source evidence.
|
|
33
|
+
|
|
34
|
+
Required fields:
|
|
35
|
+
|
|
36
|
+
- `row_id`
|
|
37
|
+
- `claim`
|
|
38
|
+
- `ingredient_or_compound_entity`
|
|
39
|
+
- `visible_evidence`
|
|
40
|
+
- `expected_contract`
|
|
41
|
+
- `verifier_decision`
|
|
42
|
+
- `failure_reason`
|
|
43
|
+
- `confidence`
|
|
44
|
+
- `source_evidence_ref_ids`
|
|
45
|
+
|
|
46
|
+
### product_ingredient_extraction_rows
|
|
47
|
+
|
|
48
|
+
Extraction view for mapping product labels or specification tables into structured ingredient/product entities.
|
|
49
|
+
|
|
50
|
+
Required fields:
|
|
51
|
+
|
|
52
|
+
- `row_id`
|
|
53
|
+
- `product_entity`
|
|
54
|
+
- `ingredient_or_compound_entities`
|
|
55
|
+
- `source_text_or_artifact_ref`
|
|
56
|
+
- `extraction_contract`
|
|
57
|
+
- `citation_or_provenance_refs`
|
|
58
|
+
- `source_evidence_ref_ids`
|
|
59
|
+
- `confidence`
|
|
60
|
+
|
|
61
|
+
### mechanism_mapping_rows
|
|
62
|
+
|
|
63
|
+
Mechanism evidence view for mapping a claim or source passage into a mechanism category with uncertainty.
|
|
64
|
+
|
|
65
|
+
Required fields:
|
|
66
|
+
|
|
67
|
+
- `row_id`
|
|
68
|
+
- `ingredient_or_compound_entity`
|
|
69
|
+
- `mechanism_category`
|
|
70
|
+
- `evidence_summary`
|
|
71
|
+
- `uncertainty`
|
|
72
|
+
- `citation_or_provenance_refs`
|
|
73
|
+
- `source_evidence_ref_ids`
|
|
74
|
+
- `confidence`
|
|
75
|
+
|
|
76
|
+
### safety_caution_rows
|
|
77
|
+
|
|
78
|
+
Safety/caution evidence view for neutral flags and context constraints. Use abstract personal-context constraints only, never sensitive identity data.
|
|
79
|
+
|
|
80
|
+
Required fields:
|
|
81
|
+
|
|
82
|
+
- `row_id`
|
|
83
|
+
- `ingredient_or_compound_entity`
|
|
84
|
+
- `safety_caution_category`
|
|
85
|
+
- `personal_context_constraints`
|
|
86
|
+
- `evidence_summary`
|
|
87
|
+
- `uncertainty`
|
|
88
|
+
- `citation_or_provenance_refs`
|
|
89
|
+
- `source_evidence_ref_ids`
|
|
90
|
+
- `confidence`
|
|
91
|
+
|
|
92
|
+
### citation_grounding_rows
|
|
93
|
+
|
|
94
|
+
Grounding view for checking whether generated summaries cite visible evidence correctly.
|
|
95
|
+
|
|
96
|
+
Required fields:
|
|
97
|
+
|
|
98
|
+
- `row_id`
|
|
99
|
+
- `generated_claim_or_summary`
|
|
100
|
+
- `citation_or_provenance_refs`
|
|
101
|
+
- `visible_evidence`
|
|
102
|
+
- `verifier_decision`
|
|
103
|
+
- `failure_reason`
|
|
104
|
+
- `source_evidence_ref_ids`
|
|
105
|
+
- `confidence`
|
|
106
|
+
|
|
107
|
+
## Safety Rules
|
|
108
|
+
|
|
109
|
+
- Use only provided local source material or package evidence refs.
|
|
110
|
+
- Keep personal context as abstract constraints such as `pregnancy_context`, `medication_interaction_context`, or `allergy_context`; do not store identity or sensitive user details.
|
|
111
|
+
- Record uncertainty and provenance for every extracted claim.
|
|
112
|
+
- Do not infer treatment, cure, diagnosis, or patient-specific recommendations.
|
|
113
|
+
- Do not mark unsupported claims as accepted verifier rows.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Agent Apprenticeship Dataset And Package Schema
|
|
2
|
+
|
|
3
|
+
Agent Apprenticeship packages capture real agent workflows as reusable experience. A package may include task packets, Apprentice-generated task specs, audited rubrics, traces, actual outputs, artifacts, evaluator/verifier/grader records, mentor or expert checkpoint records, follow-ups, Experience Compiler outputs, and public ecosystem storage references.
|
|
4
|
+
|
|
5
|
+
## Apprenticeship Modes
|
|
6
|
+
|
|
7
|
+
New package metadata uses:
|
|
8
|
+
|
|
9
|
+
- `apprenticeship_mode = autonomous`
|
|
10
|
+
- `apprenticeship_mode = expert_led`
|
|
11
|
+
- `apprenticeship_mode = org_custom`
|
|
12
|
+
|
|
13
|
+
Legacy packages may include `mentor_mode` for internal compatibility. New public indexes, R2 ecosystem items, compiler manifests, and contribution manifests should include `apprenticeship_mode`.
|
|
14
|
+
|
|
15
|
+
## Agent Training Contribution Mode
|
|
16
|
+
|
|
17
|
+
Local settings support:
|
|
18
|
+
|
|
19
|
+
- Public Ecosystem: completed Experience Compilations are shared through the Forsy R2 ecosystem backend by default.
|
|
20
|
+
- Private Internal Only: completed packages remain local.
|
|
21
|
+
|
|
22
|
+
This setting is local user preference. It is not written as a public ecosystem item field.
|
|
23
|
+
|
|
24
|
+
## Core Package Layout
|
|
25
|
+
|
|
26
|
+
Typical local package content:
|
|
27
|
+
|
|
28
|
+
- `task/` for task packet, task brief, inputs, and task-intake spec
|
|
29
|
+
- `rubric/` for Apprentice-generated rubric plus audit metadata
|
|
30
|
+
- `attempts/<kind>/agent_trace.json`
|
|
31
|
+
- `attempts/<kind>/actual_outputs.json`
|
|
32
|
+
- `attempts/<kind>/artifacts/`
|
|
33
|
+
- `grading/`, `feedback/`, and `signals/`
|
|
34
|
+
- `mentor_checkpoints/` when expert or organization workflows record checkpoints
|
|
35
|
+
- `experience_compiler/`
|
|
36
|
+
- optional legacy `tdo/` compatibility outputs
|
|
37
|
+
|
|
38
|
+
`actual_outputs.json` remains the canonical output contract. Final/static outputs are represented by actual outputs, deliverable refs, artifact refs, and copied files rather than large top-level trace fields.
|
|
39
|
+
|
|
40
|
+
## Experience Compiler Outputs
|
|
41
|
+
|
|
42
|
+
The Experience Compiler turns completed workflows into reusable skills, evals, verifier specs, reward signals, environment-response rows, runtime learning packages, and training-ready datasets.
|
|
43
|
+
|
|
44
|
+
Public compiler layout:
|
|
45
|
+
|
|
46
|
+
- `experience_compiler/compiler_manifest.json`
|
|
47
|
+
- `experience_compiler/compiler_report.json`
|
|
48
|
+
- `experience_compiler/compiler_trace.jsonl`
|
|
49
|
+
- `experience_compiler/compiler_rounds.jsonl`
|
|
50
|
+
- `experience_compiler/compiler_recipe.json`
|
|
51
|
+
- `experience_compiler/compiler_judge_results.jsonl`
|
|
52
|
+
- `experience_compiler/learning_objects_index.json`
|
|
53
|
+
- `experience_compiler/experience_pack/`
|
|
54
|
+
- `experience_compiler/skill_pack/skill.md`
|
|
55
|
+
- `experience_compiler/runtime_learning_package/`
|
|
56
|
+
- `experience_compiler/training_time_package/`
|
|
57
|
+
- `experience_compiler/evals/`
|
|
58
|
+
- `experience_compiler/verifier/`
|
|
59
|
+
- `experience_compiler/reward/`
|
|
60
|
+
- `experience_compiler/environment/`
|
|
61
|
+
- `experience_compiler/reports/`
|
|
62
|
+
|
|
63
|
+
`skill_pack/skill.md` should be task-specific and evidence-grounded, with best-use guidance, prerequisites, workflow steps, decision points, common failure patterns, recovery strategies, evidence and artifact expectations, verification checklist, examples, and transfer notes.
|
|
64
|
+
|
|
65
|
+
## Loop Review Evidence
|
|
66
|
+
|
|
67
|
+
Current Experience Compilations may include per-iteration loop evidence under `loops/`. These artifacts make autonomous model-review loops and Expert-Led review loops inspectable before feedback or continuation decisions.
|
|
68
|
+
|
|
69
|
+
Required loop review artifacts, when a loop iteration runs:
|
|
70
|
+
|
|
71
|
+
- `loops/loop_manifest.json`
|
|
72
|
+
- `loops/iterations/<nnn>/review_packet.json`
|
|
73
|
+
- `loops/iterations/<nnn>/review_packet.md`
|
|
74
|
+
- `loops/iterations/<nnn>/output_snapshot.json`
|
|
75
|
+
- `loops/iterations/<nnn>/artifact_index.json`
|
|
76
|
+
- `loops/iterations/<nnn>/trace_refs.json`
|
|
77
|
+
- `loops/iterations/<nnn>/rubric_status.json`
|
|
78
|
+
- `loops/iterations/<nnn>/verifier_status.json`
|
|
79
|
+
- `loops/iterations/<nnn>/evaluator_feedback.json`
|
|
80
|
+
- `loops/iterations/<nnn>/reviewer_feedback.json`
|
|
81
|
+
- `loops/iterations/<nnn>/revision_plan.json`
|
|
82
|
+
- `loops/iterations/<nnn>/diff_report.json`
|
|
83
|
+
- `loops/iterations/<nnn>/loop_decision.json`
|
|
84
|
+
|
|
85
|
+
Review packets should summarize the current goal, current outputs, actual output contract, artifacts, trace refs, key trace evidence, rubric/verifier status, known failures, missing outputs, surface and environment summaries, diffs, review instructions, and stop/continue choices. `reviewer_feedback.json` should record whether feedback came from a Mentor Model Provider, human expert, organization/custom reviewer, or simulated test checkpoint. Simulated feedback must be labelled as simulated.
|
|
86
|
+
|
|
87
|
+
Experience Compiler evidence maps can reference `review_packet.json`, `reviewer_feedback.json`, `revision_plan.json`, `loop_decision.json`, and `diff_report.json`. Loop evidence can support critique/revision pairs, reward-model rows, verifier rows, process-supervision rows, failure modes, recovery strategies, and runtime decision rules. Older seed packages remain valid when loop review evidence is absent.
|
|
88
|
+
|
|
89
|
+
## Runtime Learning Package
|
|
90
|
+
|
|
91
|
+
Runtime learning material can be injected into future local runs as reusable experience. It may include runtime memory rows, tool-use hints, correction patterns, and Experience Pack references. It must not claim model weights were updated.
|
|
92
|
+
|
|
93
|
+
## Ecosystem Learning And Experience Packs
|
|
94
|
+
|
|
95
|
+
Ecosystem Learning creates reversible Experience Packs from seed tasks, Experience Compilations, or pulled ecosystem items. Each Experience Pack contains `skill.md`, compact source refs, replay results, status records, and activation metadata.
|
|
96
|
+
|
|
97
|
+
## Training-Time Package
|
|
98
|
+
|
|
99
|
+
Training-time material is ready for future supervised fine-tuning, eval building, verifier training, reward modeling, preference optimization, and environment-response training. It may include:
|
|
100
|
+
|
|
101
|
+
- `training_examples.jsonl`
|
|
102
|
+
- `evaluation_examples.jsonl`
|
|
103
|
+
- `verifier_examples.jsonl`
|
|
104
|
+
- `reward_model_rows.jsonl`
|
|
105
|
+
- `preference_pairs.jsonl`
|
|
106
|
+
- `failure_cases.jsonl`
|
|
107
|
+
- `task_variants.jsonl`
|
|
108
|
+
- `transfer_eval_tasks.jsonl`
|
|
109
|
+
|
|
110
|
+
Rows should preserve `source_package_id`, `source_task_id`, `source_trace_id`, `source_step_ids`, `source_artifact_refs`, `source_evaluation_refs`, provenance, quality/fidelity/difficulty/learnability/reuse scores, judge source, audit status, and acceptance status.
|
|
111
|
+
|
|
112
|
+
## Environment And Surface Data
|
|
113
|
+
|
|
114
|
+
The environment folder can include:
|
|
115
|
+
|
|
116
|
+
- `environment_spec.json`
|
|
117
|
+
- `environment_response_pairs.jsonl`
|
|
118
|
+
- `multi_agent_handoffs.jsonl`
|
|
119
|
+
- `multimodal_artifacts.jsonl`
|
|
120
|
+
- `ui_interaction_events.jsonl`
|
|
121
|
+
- `physical_environment_events.jsonl`
|
|
122
|
+
- `api_interaction_events.jsonl`
|
|
123
|
+
- `mcp_interaction_events.jsonl`
|
|
124
|
+
- `database_events.jsonl`
|
|
125
|
+
- `structured_table_events.jsonl`
|
|
126
|
+
- `software_execution_events.jsonl`
|
|
127
|
+
- `search_retrieval_events.jsonl`
|
|
128
|
+
- `enterprise_app_events.jsonl`
|
|
129
|
+
- `async_workflow_events.jsonl`
|
|
130
|
+
- `collaboration_events.jsonl`
|
|
131
|
+
- `document_events.jsonl`
|
|
132
|
+
- `cross_system_events.jsonl`
|
|
133
|
+
|
|
134
|
+
Empty optional files are valid when a surface is absent.
|
|
135
|
+
|
|
136
|
+
## Environment Spec
|
|
137
|
+
|
|
138
|
+
`environment_spec.json` describes replay and world-model readiness. It may include environment type/domain, interaction surfaces, tools, runtime dependencies, input artifacts, setup commands, initial-state refs, allowed actions, reset strategy, verification commands, scoring refs, expected outputs, replay smoke-test details, and sections for API, MCP, database, spreadsheet, software execution, async workflows, collaboration, documents, cross-system dependencies, multi-agent, multimodal, UI/software, and physical/industrial workflows.
|
|
139
|
+
|
|
140
|
+
## Evaluation Authority
|
|
141
|
+
|
|
142
|
+
Goal achievement and outcome quality belong to mentor, expert, evaluator, verifier, and grader records. Apprentice Agent self-assessment is not the source of truth. Structural guardrails may check schemas, paths, refs, secrets, and package completeness, but they are not semantic judges.
|
|
143
|
+
|
|
144
|
+
## R2 Public Ecosystem Records
|
|
145
|
+
|
|
146
|
+
R2 ecosystem index records include item id, kind, title, summary, domain, subdomain, tags, timestamps, source, package id, task id, `apprenticeship_mode`, Apprentice Agent, Mentor Model Provider, status, counts, Experience Compiler row counts, contributor pseudonymous user id, and storage refs.
|
|
147
|
+
|
|
148
|
+
Records do not include Agent Training Contribution Mode, local OS username, local hostname, secrets, Cloudflare credentials, or private local paths.
|
|
149
|
+
|
|
150
|
+
## Backward Compatibility
|
|
151
|
+
|
|
152
|
+
Raw seed traces and older local packages remain compatible even if new fields are missing. Normalizers should preserve new fields when present and tolerate missing optional fields in older traces. Derived/enriched outputs can be added later without mutating the original seed dataset.
|
|
153
|
+
|
|
154
|
+
## Future Central Dataset Readiness
|
|
155
|
+
|
|
156
|
+
Future enrichment can build environment specs, environment-response rows, training examples, eval examples, verifier examples, reward rows, preference pairs, failure cases, task variants, compiler reports, and meta-optimization records across the full seed dataset. This should be versioned clearly and uploaded through central infrastructure, not by mutating local seed data by default.
|
|
157
|
+
|
|
158
|
+
## Exclusions
|
|
159
|
+
|
|
160
|
+
Dataset and public package metadata must not include commerce metadata, public ranking language, Apprentice Agent self-eval as outcome truth, API keys, auth tokens, cookies, `.env`, `.env.local`, private local paths, source scrape internals, or huge embedded binaries.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Local Usage
|
|
2
|
+
|
|
3
|
+
Initialize Agent Apprenticeship:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
apprentice init --setup
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
`apprentice` is the short command used in normal docs. `agent-apprenticeship` remains available as the long-form compatibility command.
|
|
10
|
+
|
|
11
|
+
Run a task:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
apprentice run "Analyze this CSV and produce an executive summary" --asset ./data.csv
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Start interactively:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
apprentice start
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Continue or finish a run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
apprentice continue <run_id> "Add sensitivity analysis" --asset ./updated_assumptions.csv
|
|
27
|
+
apprentice finish <run_id>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Each run is written under `~/.agent-apprenticeship/runs/<run-id>/` with progress files, task outputs, traces, Experience Compiler outputs, and an Experience Compilation.
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
run_status.json
|
|
34
|
+
progress_events.jsonl
|
|
35
|
+
actual_outputs.json
|
|
36
|
+
experience_compiler/
|
|
37
|
+
contribution_bundle/
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Check or watch progress:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
apprentice status <run_id>
|
|
44
|
+
apprentice watch <run_id>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use output modes when scripting:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
apprentice run "Prepare a market brief" --quiet
|
|
51
|
+
apprentice run "Prepare a market brief" --verbose
|
|
52
|
+
apprentice run "Prepare a market brief" --json-progress
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
Configure the Apprentice Agent, Mentor Model Provider, Apprenticeship Mode, and Agent Training Contribution Mode:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
apprentice configure agent
|
|
61
|
+
apprentice configure model
|
|
62
|
+
apprentice configure apprenticeship
|
|
63
|
+
apprentice configure contribution
|
|
64
|
+
apprentice settings
|
|
65
|
+
apprentice doctor
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Apprenticeship Modes:
|
|
69
|
+
|
|
70
|
+
- `autonomous`: Autonomous Apprenticeship. The agent works through the task with model guidance, iterative improvement loops, evaluation, and Experience Compiler outputs.
|
|
71
|
+
- `expert-led`: Expert-Led Apprenticeship. The agent works with human expert checkpoints until acceptance criteria are met, expert sign-off is recorded, or the configured loop limit is reached.
|
|
72
|
+
- `org-custom`: Organization Custom. For teams that need private deployment, custom integrations, internal storage, workflow-specific capture, or forward-deployed setup.
|
|
73
|
+
|
|
74
|
+
Autonomous Apprenticeship needs a ready Mentor Model Provider. API keys are read from exported environment variables first and then from `.env.local` in the project or app home. `.env.local` is gitignored and key values are never printed.
|
|
75
|
+
|
|
76
|
+
Agent Training Contribution Modes:
|
|
77
|
+
|
|
78
|
+
- `public-ecosystem`: completed task and follow-up packages are shared to the Forsy ecosystem through Cloudflare R2.
|
|
79
|
+
- `private-internal-only`: packages stay local unless explicitly contributed later.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
apprentice ecosystem configure --training-contribution public-ecosystem
|
|
83
|
+
apprentice ecosystem configure --training-contribution private-internal-only
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Integrations
|
|
87
|
+
|
|
88
|
+
Apprentice Agents:
|
|
89
|
+
|
|
90
|
+
- `codex`
|
|
91
|
+
- `cursor`
|
|
92
|
+
- `claude-code`
|
|
93
|
+
- `openclaw`
|
|
94
|
+
- `opencode`
|
|
95
|
+
- `hermes-agent`
|
|
96
|
+
- `custom`
|
|
97
|
+
|
|
98
|
+
Mentor Model Providers:
|
|
99
|
+
|
|
100
|
+
- `openai`
|
|
101
|
+
- `anthropic`
|
|
102
|
+
- `google`
|
|
103
|
+
- `openrouter`
|
|
104
|
+
|
|
105
|
+
Run:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
apprentice integrations
|
|
109
|
+
apprentice certify-integrations --all
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Use `--all-combinations` only when you intentionally want every Apprentice Agent and Mentor Model Provider pair; it is slower and can consume provider quota.
|
|
113
|
+
|
|
114
|
+
## Experience Compiler
|
|
115
|
+
|
|
116
|
+
The Experience Compiler turns each completed workflow into reusable skills, evals, verifier specs, reward signals, environment-response data, runtime learning packages, and training-ready datasets.
|
|
117
|
+
|
|
118
|
+
Public packages include:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
experience_compiler/
|
|
122
|
+
experience_pack/
|
|
123
|
+
skill_pack/
|
|
124
|
+
runtime_learning_package/
|
|
125
|
+
training_time_package/
|
|
126
|
+
evals/
|
|
127
|
+
verifier/
|
|
128
|
+
reward/
|
|
129
|
+
environment/
|
|
130
|
+
reports/
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`actual_outputs.json` remains the canonical output contract for completed task artifacts.
|
|
134
|
+
|
|
135
|
+
## Ecosystem
|
|
136
|
+
|
|
137
|
+
Cloudflare R2 is the default ecosystem storage backend.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
apprentice ecosystem status
|
|
141
|
+
apprentice ecosystem list
|
|
142
|
+
apprentice ecosystem search "finance"
|
|
143
|
+
apprentice ecosystem inspect <item_id>
|
|
144
|
+
apprentice ecosystem pull <item_id>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Share a package explicitly:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
apprentice ecosystem contribute ~/.agent-apprenticeship/runs/<run-id>/contribution_bundle
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Dry-run a share:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
apprentice ecosystem contribute ~/.agent-apprenticeship/runs/<run-id>/contribution_bundle --dry-run
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Legacy GitHub issue submission remains available only when explicitly selected:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
apprentice ecosystem contribute <bundle_path> --storage github
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Inspect local sharing history:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
apprentice ecosystem identity
|
|
169
|
+
apprentice ecosystem shared
|
|
170
|
+
apprentice ecosystem shared --json
|
|
171
|
+
apprentice ecosystem list --mine
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Ecosystem Learning
|
|
175
|
+
|
|
176
|
+
Use Ecosystem Learning when you want your Apprentice Agent to learn from an ecosystem task, trace, or package through a reversible Experience Pack.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
apprentice ecosystem search cloud
|
|
180
|
+
apprentice ecosystem pull aa-seed-task-501
|
|
181
|
+
apprentice learn create aa-seed-task-501
|
|
182
|
+
apprentice learn preview <pack_id>
|
|
183
|
+
apprentice learn replay <pack_id>
|
|
184
|
+
apprentice learn keep <pack_id>
|
|
185
|
+
apprentice run "Create a related incident response checklist" --experience-pack <pack_id>
|
|
186
|
+
apprentice learn revert <pack_id>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Experience Packs live in `~/.agent-apprenticeship/experience_packs/<pack_id>/`.
|
|
190
|
+
|
|
191
|
+
Rich artifacts are included through indexing rather than special folder rules. Reports, spreadsheets, CSV/JSON/Markdown, screenshots, browser logs, MCP/tool logs, notebooks, code, and generated files are packaged when they appear in the run/package artifact areas and are linked to trace steps.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Scaling to 1000 tasks
|
|
2
|
+
|
|
3
|
+
Use `run-batch` with checkpointing, resume, progress logging, local packages, and release export. Start with 1, then 3, then 10 tasks before increasing parallelism. Each task packet preserves workflow traces, artifacts, model-judged evaluation, verifier-backed reliability, and revision signals for downstream research use.
|