Concept · extraction
An extraction reads pinned Files through one Shape or typeset, costs AI credits, and opens its own new workspace.
Use when
You turn the text of Files into entities and relationships, or you check on, stop or finish an extraction that already started.
Looking for something else?
Facts a person tells you or you write by hand (recipe Save facts a person tells you as entities). Changing entities that are already in the Graph (card Workspace). Reading a File (card File).
For
An extraction reads the text of Files and finds entities and relationships that fit a Shape. It opens its own new workspace and stages them there. Nobody has approved them yet. A submit of that workspace puts them in the Graph. An extraction costs AI credits and takes time, so you plan it, start it once, follow it, and then review what it staged.Use when
- A person asks for the knowledge in one File, several Files or a collection.
- You must know the cost of a run before you start it.
- A run is slow, has failed, or ended with some Files unread.
- A run costs more than you want, and you must stop it.
Not this
- Facts you already know: stage them yourself (recipe capture-by-hand).
- An entity that is already in the Graph and needs a change: use card workspace.
- Whether a File is ready to read: use card Collection and its readiness check.
Rules
extraction.1Plan before you start. Your job: runpenumbra extractions planwith the Files or the collection, a Shape and an extraction level. It lists the Files and versions the run would read, the types, and the credit range. It holds nothing and charges nothing. Give the person the range before you start.extraction.2A run takes one perspective: one Shape or one typeset. Enforced:penumbra graph extractrefuses both or neither withinvalid_arguments. Your job: to use several Shapes, start one extraction for each Shape. Each one opens its own workspace.extraction.3A run reads Files by id or reads one collection, never both. Enforced: the CLI refuses both or neither withinvalid_arguments. One run takes 1 to 256 Files, and a larger collection is refused (card rule collection.5).extraction.4A run reads the versions that are current when it starts. Your job: a File that you replace, or add to the collection, after the start is not read by that run. Start another run for it (problem new-version-not-extracted).extraction.5Starting a run costs AI credits and, with an API key or as a connected agent, waits for approval (card rules approval.2 and approval.3). Your job: pass--request-id <key>and keep it. Enforced when you ask: the same key returns the same extraction and does not charge again. Without the flag, the CLI makes a new key, and a second run charges a second time.extraction.6Penumbra charges for work done. A failed run is not charged. A stopped run is charged for the work done, and a queued run that is stopped is not charged. Your job: tell the person what a stop costs before you stop a run that is already reading.extraction.7What an extraction finds waits in the workspace that the extraction opened. Your job: review it and submit it (recipe review-and-submit). Nothing is in the Graph until the submit returnsapplied(card rule workspace.2).extraction.8Leave that workspace alone until the extraction ends. Your job: do not modify it while the run is working. When the run ends in part, decide on Try again before you read or edit the workspace (rule extraction.13). Then review the items withpenumbra graph workspace show.extraction.9An extraction compares each item with the entities that the Graph already has. The comparison runs the first time anyone reads, validates, edits or submits the workspace. When it matches or flags an item, it saves that as a change to the workspace. An item with the same Shape type and the same name as exactly one live entity becomes an update to that entity. The workspace shows it asupdates existing. Every other item stays a new entity. Your job: check eachupdates existingitem before you submit. Runpenumbra graph workspace keep-newfor one that is a different thing (problem extraction-duplicates-existing-entity). Search for an item whose entity has another name, because only the exact name matches.extraction.10Follow a run with its extraction id. Your job: runpenumbra graph extractions "<workspace>" --run <id> --watch, with the workspace name thatpenumbra graph extractprinted. The count of items so far can go down as well as up. Ctrl-C ends the watch and does not stop the run. Use the id exactly aspenumbra graph extractprinted it. Do not build one.extraction.11Stop keeps what the run has found. Enforced:penumbra graph extractions stopdoes not wait for approval and is safe to repeat. A stopped run is not offered Try again: it is refused withretry_not_offered. Your job: after a stop, the rest of the Files are not read, and the stop message does not say which Files were read. To read the rest, start a new extraction for those Files (recipe extract-files). A new extraction charges for the Files it reads.extraction.12Try again finishes a run that failed, or that ended in part because the engine could not finish some work (the CLI saysPartly finished). Your job: runpenumbra extractions try-again <run-id>. It reads the same Files at the same versions with the same Shape, reuses the work that finished, and charges only for the rest. It costs credits and waits for approval under the same rules as a start. It closes the old workspace and opens a new one under a new name. Follow the workspace name and the run id that it prints (rule extraction.10), and not the old ones.extraction.13Try again is offered only on the newest run of a lineage, while its workspace is still open and has not been changed. Enforced: it is refused withretry_not_offered,retry_in_progress,retry_review_editedorretry_stale. Your job: decide on Try again before you read or edit a workspace that ended in part. The first read can change it (rule extraction.9). If the workspace changed, submit it or close it (rule workspace.11), then start a new extraction.extraction.14The extraction level sets how thorough a run is,standardorfast. Enforced: a level that the project does not offer is refused withextraction_level_unavailable, and the reply names the levels it offers. Without--level, the run uses the project’s default.extraction.15Every extraction opens its own new workspace, and you do not name one. Enforced: the start takes no workspace argument, and the answer names the workspace it opened. That workspace holds only the items of that run. Your job: use that name to follow, review and submit the run. Do not capture into it.
Failure signs
- A start returns
pendingor exit code 4: problem change-waits-for-approval. - A start is refused with
collection_too_large: rule collection.5. - A start is refused with
review_not_empty: problem extraction-incomplete. - A run ended and some Files were not read: problem extraction-incomplete.
- After the owner approved the start, you cannot follow the run: problem cannot-follow-approved-extraction.
- The workspace holds items that the Graph already has: problem extraction-duplicates-existing-entity.
- A File has a new version and the Graph shows the old text: problem new-version-not-extracted.
Doors
A Kit with
extraction_start also has the four tools that follow and finish a
run.
HTTP reference
- Get extraction capabilities
- Plan file extraction
- Start extraction
- List extractions
- Get extraction
- Get extraction results
- Stop extraction
- Retry extraction