AI Hero Club

AI Agent Engineering · Lesson 6

Marked Complete by You0 / 8

Saved in this browser only. Marking a lesson complete does not mean the project has passed verification.

Lesson Outline 10 subsections
Course Contents 8 lessons
Full course plan.
AI Agent Engineering / Learning Plan ↗

LESSON 06 / 8Suggested study 120 minutes

From Tool Observations to Automatically Checkable Results

If an answer cites a real document ID, how do we verify every conclusion and the actual reservation result?

3 Questions for This Lesson
  • Automatically extract evidence from real documents on tape version and line numbers
  • Distinguishing text support, factual authenticity and confirmation of events
  • Construct reference mutation against fake completion
Course Project ZIP ↓

Environment Facts Must Support the Result

The first five controls how they occur, and now the control system describes the results. A reliable executor cannot accept fluid answers returned by Policy, especially because it says “Saved” is successful. Only limited status is given, and the text is generated by the executor on the basis of already observed and actual information; reserved must have reserve returned, info must be the only document that has been read and the insufficient must have an under-observed inventory. The strategy can be abstain, but the tool cannot be manufactured without the reported effect. The result is a definitive extract, not a free-language creation.

The information is actually stored in the SQLite documents table, which contains id,title, body and sha. The importer reads the original device card in data/docs, calculates the summary by the UTF-8 byte and freezes it. The evidence(item) item lists the real text line, automatically generating claim:text from the symbol line that starts with a short cross-space, with the prefix attached to item_id, shah256, a base line and original quote. No single claims answers were written manually for each task; the same information was imported, read, extracted, quoted and automatically checked at the same entry point.

A Precise Definition of Support Checks

Gives a claim, first to find a version of the information by pressing itm_id and then to request the same summary; subtracts a base line number from a list index, checks that it is legal and that line amounts to Quote, and finally checks that quate is just “- ” plus text. Four conditions are established at the same time to be considered as extracted support. This will detect errors in the wrong document, the wrong version, the wrong location and the change of text without recitation. It is better than “Attach a link”, but its scope is still narrow: only precise extracts are accepted, and it does not judge whether synonyms or cross-section reasoning are supported.

Support(c,d)=ID(c,d)∧Hash(c,d)∧Line(c,d)∧ExactQuote(c,d)\mathrm{Support}(c,d)=\mathrm{ID}(c,d)\land\mathrm{Hash}(c,d)\land\mathrm{Line}(c,d)\land\mathrm{ExactQuote}(c,d)
c For a claim, d is the specified document version; the word is an executable definition of an exact extract and not a generic syntax sensor.

A base line number is an agreement to locate the reader. The Python list index starts from zero, and the difference between the two is inevitable. The change of line is also frozen: the item is calculated by reference to a read slides list, and the summary is based on the UTF-8 byte of the original text string. If the editor changes content or changes the text, it cannot be quoted in the same version, even if the sentence appears to be the same. The current importer directly rejects the id content change and preserves the recovery evidence; the dynamic version management and revocation should be based on a clear version protocol that cannot be used to refer to the original reference as valid when the text is changed locally on the record.

Worked Example 1: Automatically Deriving Four Camera Facts

The first line of the camera document is the name of the device, its use, the condition of its loan and the claim of return. When you search the camera, the only hit camera, document returns the body of the freeze; ends the creation of four claims, the first text being “Device Name:Enter camera。” Line is two. Quote reserves. “- ” Prefixes. Supported retraces the actual second line from the database, comparing it with the true one. All four articles complete normal results. The exact lines and summaries are from documents, not from tactical guesses, and the reader can open the text for review article by article.

If policy uses the local JSON or HTTP to propose the same end action, the implementer will still follow the same evidence function and will not accept the home-made reference for external returns. This makes the supportive validation independent of the decision-making source. But it also limits output: the system will only provide extracts from current information, will not make a synthesis of “Which student is the best?”, and there is no open recommendation for comparing different devices. The course uses this restricted generator as an acceptable baseline; Future free generation must increase the split of statements, the matching of quotations and the rejection of answers when they fail, rather than treating the current rate of passage of excerpts as a semantic question-and-answer quality.

Run in the Project DirectoryProject directory run: Generates evidence from the actual import document and then mutate text check failed.
import tempfile,pathlib
from agent import Store
from run import ROOT
with tempfile.TemporaryDirectory() as td:
    s=Store(pathlib.Path(td)/'e.sqlite',ROOT/'data');s.import_documents()
    claims=s.evidence('camera')
    assert len(claims)==4 and claims[0]['line']==2
    assert all(s.supported(c) for c in claims)
    wrong={**claims[0],'text':'库存有一百台'}
    assert not s.supported(wrong)
    s.db.close()
print('extraction and mutation PASS')

Worked Example 2: A Cited but False Completion Claim Must Fail

One task is only that of Seerch and Document, where Policy proposes a true text reved with a reference to the real camera. The reference, even if accurate, only supports the material statement, which does not support the fact that the matter has already occurred; and the fact that Finalize refused the observation due to a lack of reservation. Conversely, there is a real reserve but the false SHA is not available as a complete information result. No single piece of integrity automatically fills another gap.

Another example of failure is to change the line from two to three for the correct claim and to leave text unchanged. The third line is a purpose, inconsistent with the Quote, which is false; the last precise prefix comparison fails if the Quote is changed to the third line and the last one remains a name. If both text and Quote are replaced by the third line, it can be adopted, but it is now another fact that cannot claim to answer the original question. The project did not achieve semantic judgement on the relevance of the statement to the facts, and retrieval of the mission template for certainty provided only limited relevance control, which needed to be noted separately in the report.

How Transaction Receipts Support Claims About Outcomes

Reservation results include: item_id, Quality, remaining, revision, and receipt. “Three.”. The failure task after the submission of chapter IV also reminds us that when no client returns to observation, it should not be said that the business has not occurred, that the mark should be confirmed and that the key is returned.

For normal read-only info tasks, ledger must be zero; for preset successful tasks, ledger should be reduced accordingly; and for missing or non-permissive tasks, no writing is expected to take place. The automatic evaluation looks not only at status, but also at the number of effects and surplus stocks, and then examines claims for replaying with events. This multi-path check is stronger than a single answer string, because answers, states and databases may be inconsistent with each other. It still cannot identify external facts such as the loss of equipment in a real warehouse, which is the only environmental state of the current model.

Support Rate, Coverage, and Honest Abstention

Defines the rate of support by dividing the number of claims through the output that supports the check by exporting the total number of claims. If a single output is not exported, the denominator is zero, it cannot automatically be said to be 100% quality; “Noneclaims” can be listed separately and an evaluation of whether the task should be supported. Coverage requires the fact set required by the task, and the current template requires the export of four item symbols facts when reading the information, which are automatically obtained from the document structure. High support rates but miss all key facts may still be bad, covering complete, but incorrect references. The two dimensions need to be defined separately, without a single sum to cover up the answer.

Ps=nsupportednemitted,Cs=ncoverednrequiredP_s=\frac{n_{supported}}{n_{emitted}},\qquad C_s=\frac{n_{covered}}{n_{required}}
A separate label does not apply when the denominator is zero, and no empty collection is performed by an imposted task.

Item all(supported(c) For c in manifests) returns the empty list and only indicates that unsupported entries have not been found. The revised evaluator also independently creates a collection of required answers, checks full coverage and repeats references. The normal info, reserved, insufficient lack of any required fact fails; not_found, denied, or abstain can have no information according to the mission norms. Supporting inspection is not a task to complete judgement.

Two Validation Methods and the Limits of Transfer

The first category consists of field-by-field mutations: changing text, SHA, line or item_id to require support failure. The second category is cross-effects: Policy falsely claims that reserved failed; the real reserve stock, ledger and client results should be consistent. The two types of checks are separate from the source of binding text and operational facts. A true language model may summarize multiple segments into new sentences and precise extracts are no longer sufficient; The extraction model can be retained as a positive control, and semantic support for data and manual review can be designed, but cannot be said to have achieved automatic factual authenticity until it is completed.

Information may contain false, contradictory or dangerous advice, and correct quotations help only to pursue blame and not to judge the truth. To extend to real school management, controlled sources, version updates, validity periods and authorized governance are required, and users should be able to see from which editions to quote. The original information in this course is not an external institutional rule, and they are not used to create authoritative endorsements.

This item does not make Unicode unicode or blurry. A full corner point, different spaces or homogenous characters affect accurate comparisons, which is an acceptable and strict agreement on freezing extracts. If regularization is allowed, it is important to define the expressions used in the body storage, summary, line positioning and comparison, avoiding a set of rules that show text as opposed to the Hasi bytes.

Standalone ProgramThe Standard Library is independently inspected and does not rely on the project catalogue.
lines=['# title','- name: camera','- purpose: light']
claim={'line':2,'text':'name: camera','quote':'- name: camera'}
def supported(c):
    i=c['line']-1
    return 0<=i<len(lines) and lines[i]==c['quote']=='- '+c['text']
assert supported(claim)
assert not supported({**claim,'line':3})
assert not supported({**claim,'text':'invented'})
print('exact-source support PASS')

Exercises and Project Contributions

TRY IT YOURSELF

Basis: Support four conditions

One of the claim texts is correct, and the line is correct, but the SHA is the old text. Can you pass? Why?

Hint 1
Which fields were to be bound together to quote identities and whether the exact same sentence could not be filled with a different version?
Hint 2
Compares the current text to the current one, SHA, and the designated line; the text must be clearly edited when updated, without treating the text as identical as old hash.
Compare with the Solution
No. The reference must be bound to the current specified version, and the SHA does not match the source identity. Even if the sentence happens to remain unchanged, the correct version should be clearly used instead of bypassing it. The current item is conservatively refusing to update with the id text to prevent a mix of sources on recovery.

TRY IT YOURSELF

Step: An empty answer to the trap

A system does not export any claim, the all-check is True, and the support rate is 100%. How?

Hint 1
It was a logical agreement to ask how much truth the mandate actually required.
Hint 2
Separates the supporting denominator from field coverage; subtracts the missing output identity check by required.
Compare with the Solution
The empty boolean value is not a meaningful support rate. The denominator should not be applied to the zero mark, and an independent determination should be made as to whether the mission requires information facts; if four are required to export zero, the coverage is zero and the task fails.

TRY IT YOURSELF

Challenges: extracts and semantics

The file says “Borrowing premises:I'll show you how it works.”, model output “Any student can focus alone.”. Can you use the same reference?

Hint 1
A word-for-word comparison of the reference and a comparison of the permissible conduct in both sentences.
Hint 2
What can the current accurate extract check prove? If changed to free rewrite, additional semantic support is needed to judge rather than to follow the old threshold.
Compare with the Solution
No, the text is inconsistent and semantic. The precise extracting of this item would reject the new sentence without any general synonyms. If free generation is allowed, a separate definition of supportive labels and judges would be required to retain reverses and manual checks; the new sentence with quotes should not be automatically taken for granted at this time.

This chapter adds information and services in two chains. The subsequent assessment will be done using the same information, the same strategy portal, and a fixed task set, and actual statistics should be completed, rejected, budget failure and recovery success instead of manually selecting several good answers.

Check Missing Answers Independently of Support

The revised texture is first created by required_claims(row) from catalog and the original Markdown line by line, without calling the candidate Street. For info, reserved, insufficient, the output must cover all project symbols of the only device. To recalculate covered_claims / required_claims and repeat references; Eventually passed simultaneously required status, support, integrity, operational effectiveness and inventory. The original camera had four facts: normal result coverage=1; event was replaced with an empty list support_pass=True, but coverage=0, completeness_pass=False, passed=False; delete one obtained 3/4; repeated references could not be deleted and the separate repeat door failed. The denial denominator for which no information is required is zero, with coverage marked as not applicable, instead of 100 %. The new error is returned to retain the three intended errors and 17 normal tasks are rerun on the same revised code; the result of the original 17 question remains 17/17.

BUILD THE MECHANISM

Achieve joint acceptance of support with necessary facts

Realization of LearnerRunner.validate_claims; no empty collection of charges as true or repeated claims is considered to be complete. Downloading this full course, running in the project root directory; editing learner/starter.py only, with a tectonic framework provided by the project.

Input and Output All bullet facts of the true document are supported by an item-by-source and the normal result covers; empty, missing and repeated rejections.
The answer can be denied without claims; the obligation is read from the real source, and expectations are not generated by calling the evidence extractor.

Run in the Project DirectoryStudy tasks to be completed
# LearnerRunner.validate_claims(替换已提供类的此方法)
def validate_claims(self,item,claims,status):
        raise NotImplementedError('evidence')
Hint 1

The writing support rate and the content integrity are two brevs and cannot be combined with a denominator.

Hint 2

Constructs a separate identity pool from the original document line number and factual text.

Hint 3

The list length is required to be equal to the unique identity number, and a comparison must be made.

Independent inspection python3 -m learner.check --stage evidence --output runs/learner-evidence.json

Migration test Delete one, repeat one, change SHA predict which door to reject separately; and then review the new equipment file, not just the number of camera 4.

Reference Implementation and Explanation
Run in the Project DirectoryReference achieved
# LearnerRunner.validate_claims(替换已提供类的此方法)
def validate_claims(self,item,claims,status):
        if not all(self.store.supported(c) for c in claims):return False
        if status not in ['info','reserved','insufficient']:return not claims
        # Independent obligations are read from actual source facts, never Store.evidence.
        row=self.store.db.execute('SELECT * FROM documents WHERE id=?',(item,)).fetchone()
        if not row:return False
        expected={(i,line[2:])for i,line in enumerate(row['body'].splitlines(),1)if line.startswith('- ')}
        actual=[(c['line'],c['text'])for c in claims]
        return len(actual)==len(set(actual)) and set(actual)==expected and bool(expected)

CHECK YOUR UNDERSTANDING

Check Your Understanding

Answer first, then open the explanation to check your reasoning. These questions help reveal gaps in understanding; independent implementation and transfer require separate evaluation.

1. Accurate support check-up?

Show ExplanationIt is the unity of origin, not the truth.
2. What is the main reliance on for success?

Show ExplanationDescription document does not prove that something happened.
3. The airclaims' all for True means?

Show ExplanationThe empty name does not equal an effective support rate.
4. How did this project claims come out?

Show ExplanationSources, line numbers and text from the same physical information chain.

Manual completion records your progress; it does not certify your project.