2.26.5.32. pycsamt.agents.report#
pycsamt.agents.report#
ReportAgent — Assemble all agent results into a survey report.
The report is built in three formats:
Markdown — always produced; human-readable plain text + embedded image paths.
HTML — produced when
markdownpackage is installed.PDF — produced when
weasyprintorpdfkitis installed.
The agent queries the LLM once per section (optional) to write a narrative paragraph, then assembles everything into a structured document:
Title & metadata
Data loading summary
QC summary + figure
Static-shift correction summary + figure
Phase tensor analysis summary + figures
Forward modelling summary + figure
Recommendations
Classes
|
Generate a structured MT survey report from agent results. |
- class pycsamt.agents.report.ReportAgent(*, api_key=None, model=None, llm_provider='claude', report_title='MT/AMT Survey Report', formats=None)[source]
Bases:
BaseAgentGenerate a structured MT survey report from agent results.
- Parameters:
api_key (str)
model (str)
llm_provider (str)
report_title (str) – Title for the report.
formats (list of {"md", "html", "pdf"}) – Output formats. Default
["md", "html"].keys (Output data)
----------
results (dict) – Keyed by agent step name →
AgentResult. Expected keys:"load","qc","static_shift","phase_analysis","forward"(all optional).output_dir (str)
title (str, optional — overrides constructor default)
keys
----------------
text (report_md str — full markdown)
None (report_path_html str or)
file (report_path_md str — path to .md)
None
name (sections dict — section text keyed by)
Examples
>>> agent = ReportAgent(api_key="sk-ant-…") >>> result = agent.execute( ... { ... "results": {"load": load_result, "qc": qc_result}, ... "output_dir": "/out/report", ... "title": "WILLY_DATA AMT Survey — L22PLT", ... } ... ) >>> print(result["report_path_md"]) /out/report/survey_report.md
- SYSTEM_PROMPT: str = 'You are a geophysics technical writer specialising in MT surveys.\nWrite clear, concise report sections in formal scientific English.\nUse complete sentences. No markdown headings inside your response.\nKeep each section to 3–5 sentences.\n'
Override in subclasses to give the LLM its domain expertise.
- execute(input_data)[source]
Run this agent on input_data and return an
AgentResult.Subclasses must implement this method. The contract:
Reset
self._last_cost = 0.0at the top.Record wall-clock time with
t0 = time.time().Return
AgentResult(elapsed_seconds=time.time()-t0, cost_estimate_usd=self._last_cost, ...).
- Parameters:
- Return type: