pycsamt.agents.master#
One-line front door to the pyCSAMT agent stack.
AgentMaster is a thin façade over
WorkflowOrchestratorAgent: one object, one
run() call from a plain-language request to an executed agent
chain. It exists so the friendly entry point advertised across the
docs works verbatim:
from pycsamt.agents import AgentMaster
master = AgentMaster(provider="anthropic")
report = master.run(
"Load data/edi/, flag stations with RMS > 2, build an Occam2D "
"input for profile L22, launch inversion, and produce a PDF report."
)
Everything heavier (the orchestrator, LLM clients) is imported lazily
on first use, so from pycsamt.agents import AgentMaster stays cheap
and free of circular imports.
Classes
|
Plain-language entry point to the agent workflows. |
- class pycsamt.agents.master.AgentMaster(provider='claude', *, api_key=None, model=None, default_workflow='qc')[source]#
Bases:
PyCSAMTObjectPlain-language entry point to the agent workflows.
- Parameters:
provider (str, default
"claude") – LLM provider. Friendly aliases are accepted:"anthropic"→"claude"and"google"→"gemini". Without an API key the agents fall back to the rule-based (regex/keyword) path, soAgentMaster()works offline.api_key (str, optional) – Provider API key. When omitted, the provider’s environment variable is used if set; otherwise the rule-based fallback runs at zero cost.
model (str, optional) – Provider model override (defaults per provider).
default_workflow (str, default
"qc") – Workflow used when a request cannot be classified.
Examples
Plan first (no files touched), then execute:
>>> from pycsamt.agents import AgentMaster >>> master = AgentMaster(provider="anthropic") >>> plan = master.plan("QC the EDI files and prepare a short report", ... data_path="data/edi/") >>> plan["workflow_type"] 'qc' >>> report = master.run( ... "Load data/edi/, flag stations with RMS > 2, build an Occam2D " ... "input for profile L22, launch inversion, and produce a PDF " ... "report." ... )
See also
pycsamt.agents.WorkflowOrchestratorAgentThe dispatcher this façade drives; use it directly for structured workflow configurations.
- property orchestrator: WorkflowOrchestratorAgent[source]#
The lazily-built orchestrator behind this façade.
- run(request, *, data_path=None, output_dir=None, dry_run=False, **extra)[source]#
Classify request into a workflow and execute the chain.
- Parameters:
request (str) – Plain-language description of what to do. Paths mentioned in the text are extracted when possible; pass
data_path/output_direxplicitly for scripts and CI.data_path (str, optional) – Survey input (EDI/AVG/J directory or file).
output_dir (str, optional) – Where products (figures, inputs, reports) are written.
dry_run (bool, default False) – Preview the selected chain without reading or writing.
**extra – Additional orchestrator payload fields, passed through.
- Returns:
Status, per-step outputs, reasoning, and cost tracking.
- Return type: