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

AgentMaster([provider, api_key, model, ...])

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: PyCSAMTObject

Plain-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, so AgentMaster() 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.WorkflowOrchestratorAgent

The 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_dir explicitly 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:

AgentResult

plan(request, **kwargs)[source]#

Shortcut for run() with dry_run=True.

Parameters:
Return type:

AgentResult