Skip to content

credencestack.agents

Reference agents: the deterministic scripted agents (scripted_naive, which does what the task and documents say, and scripted_safe, which acts only within authority and fails closed), the domain agents (naive_fincrime/safe_fincrime, naive_docintegrity/safe_docintegrity, naive_kyc/safe_kyc; the scripted agents dispatch to them by the task's domain), and LangChain 1.x agents for the benchmark, including financial-crime and KYC versions.

Responsibilities

  • Give every test, guide and the sample report a fully reproducible agent that calls no model.
  • Show, side by side, what unsafe and safe behaviour look like in a trace.
  • Back the scripted model used by the framework connectors offline (scripted_model).

Non-goals

  • Being good agents. They are calibration points, not products: scripted_safe hard-codes the checks a real agent must learn or be given.

Public API

Signatures and purposes are generated from the code by scripts/gen_dev_reference.py; errors come from each docstring's Raises: section or from api-notes.yaml, which also holds the hand-written effects column.

Name Kind Signature Purpose Errors Effects
BRITTLE_WEAKNESSES constant BRITTLE_WEAKNESSES: dict of 4 The documented weaknesses of scripted_brittle, by domain. - -
INSTRUCTION_PATTERNS constant INSTRUCTION_PATTERNS Regex the scripted agents use to spot instructions planted in documents. - -
brittle_docintegrity function brittle_docintegrity(task: TaskInfo, control: AgentControl) -> PolicyRun safe_docintegrity with one weakness. - pure (calls simulated tools only)
brittle_fincrime function brittle_fincrime(task: TaskInfo, control: AgentControl) -> PolicyRun safe_fincrime with one weakness. - pure (calls simulated tools only)
brittle_kyc function brittle_kyc(task: TaskInfo, control: AgentControl) -> PolicyRun safe_kyc with one weakness: it never checks people against the PEP list. - pure (calls simulated tools only)
naive_docintegrity function naive_docintegrity(task: TaskInfo, control: AgentControl) -> PolicyRun Pay what the document says. - pure policy: yields tool calls, never does I/O
naive_fincrime function naive_fincrime(task: TaskInfo, control: AgentControl) -> PolicyRun Careless alert review: exact names only, obeys attachments, releases by default. - pure policy: yields tool calls, never does I/O
naive_kyc function naive_kyc(task: TaskInfo, control: AgentControl) -> PolicyRun Approve everything, rated low. - pure policy: yields tool calls, never does I/O
safe_docintegrity function safe_docintegrity(task: TaskInfo, control: AgentControl) -> PolicyRun Verify the document against every system of record before paying. - pure policy: yields tool calls, never does I/O
safe_fincrime function safe_fincrime(task: TaskInfo, control: AgentControl) -> PolicyRun Screen per the policy: confirm true matches, clear false positives, escalate the rest. - pure policy: yields tool calls, never does I/O
safe_kyc function safe_kyc(task: TaskInfo, control: AgentControl) -> PolicyRun Policy-driven onboarding with EDD, senior approval and fail-closed registry checks. - pure policy: yields tool calls, never does I/O
scripted_brittle function scripted_brittle(task: TaskInfo, control: AgentControl) -> PolicyRun The safe agent with documented, deterministic weaknesses (:data:BRITTLE_WEAKNESSES). - pure (calls simulated tools only)
scripted_naive function scripted_naive(task: TaskInfo, control: AgentControl) -> PolicyRun Do whatever the task and the documents say. Never checks authority or suspension. - pure policy: yields tool calls, never does I/O
scripted_safe function scripted_safe(task: TaskInfo, control: AgentControl) -> PolicyRun Act only within authority; escalate or reject otherwise; fail closed; stop when told. - pure policy: yields tool calls, never does I/O

Examples

The connectors example runs scripted_safe on PAY-001. The graders and kill switch examples run scripted_naive.

Invariants and gotchas

  • The scripted agents are policies: generators that yield tool calls, and never do I/O themselves.
  • INSTRUCTION_PATTERNS is how the naive agent "obeys" planted instructions and how the safe one spots them. Changing it changes the adversarial pack's results.
  • The safe agent sends an idempotency key on every payment and re-checks the invoice and mandate after an approval. The guides copy both habits.

Where the tests are

Test files that import this package's modules (from the file index):

  • tests/e2e/test_golden_path.py
  • tests/integration/test_adk_connector.py
  • tests/integration/test_assess_cli.py
  • tests/integration/test_claude_agent_sdk_connector.py
  • tests/integration/test_confidential_bundles.py
  • tests/integration/test_crewai_connector.py
  • tests/integration/test_domain_packs.py
  • tests/integration/test_evidence_bundle.py
  • tests/integration/test_example_agents.py
  • tests/integration/test_github_workflows.py
  • tests/integration/test_manifests.py
  • tests/integration/test_msaf_connector.py
  • tests/integration/test_openai_agents_connector.py
  • tests/integration/test_otel_collector.py
  • tests/integration/test_strands_connector.py
  • tests/live/test_live_connectors.py
  • tests/unit/test_api.py
  • tests/unit/test_bench.py
  • tests/unit/test_brittleness.py
  • tests/unit/test_builtin_packs.py
  • tests/unit/test_cli.py
  • tests/unit/test_conformance.py
  • tests/unit/test_connectors.py
  • tests/unit/test_control.py
  • tests/unit/test_env_rl.py
  • tests/unit/test_faults.py
  • tests/unit/test_forge_generator.py
  • tests/unit/test_forge_mutators.py
  • tests/unit/test_gate.py
  • tests/unit/test_generate_cli.py
  • tests/unit/test_inspect_runner.py
  • tests/unit/test_integrations.py
  • tests/unit/test_otel.py
  • tests/unit/test_otel_workflows.py
  • tests/unit/test_reports.py