Skip to main content

datagoat-decide (Python)

pip install datagoat-decide     # or: uv add datagoat-decide
export DATAGOAT_API_KEY=dg_live_...

Wrap a LangGraph node

from datagoat_decide import Datagoat
dg = Datagoat()  # reads DATAGOAT_API_KEY and DATAGOAT_BASE_URL (your Datagoat deployment URL)

graph.add_node("qualify", dg.wrap("sdr.qualify", qualify_lead,
    input_key="lead", output_key="qualification", case_id="lead_id"))
  • Valid answer → Datagoat's answer goes into state["qualification"], your node does not run.
  • No valid answer → your fallback (set in the dashboard): your node runs as before, or the case goes to a person, or no decision (None).
  • Datagoat unreachable (or past the SDK's budget) → your node runs. Datagoat reachable but its engine down or slow → the outage fallback you set (your node by default). The SDK never blocks your agent past its budget (timeout, default 2.5 s). Every call carries an idempotency key, so a call that timed out after Datagoat logged it is replayed off your agent's path and still counted.

When a person decides

If the decision's fallback is Send to a person (or its outage fallback is, during an outage), a case Datagoat has no answer for goes to the dashboard Queue, and the node writes None. Keep the decision id and read the person's answer once it's in:

graph.add_node("qualify", dg.wrap("sdr.qualify", qualify_lead,
    input_key="lead", output_key="qualification", case_id="lead_id",
    on_queued=lambda d, state: save_for_later(state["lead"]["lead_id"], d.decision_id)))

# later, in a worker
s = dg.get_decision(decision_id)            # {"status": "pending" | "resolved" | "final", "answer": {...}}
answer = dg.wait_for_human(decision_id, timeout=600)   # polls; None if nobody answered in time (or the id is unknown)

answer has the same fields as Datagoat's answer (flag, label, choice) plus what the person picked (value) and their note. Async: aget_decision, await_for_human. @dg.point takes on_queued too. With a LangGraph checkpointer you can route a None to a node that calls interrupt(), and resume the run with Command(resume=answer) once the answer is in. The person's answer also goes onto the case, so training sees what was decided; it never counts as your AI's.

Using the decision in later nodes

When you change the steps after a decision (see the handoff on the decision's pattern), later nodes read the decision from the graph state:

class State(TypedDict, total=False):
    lead: dict
    qualification: dict
    datagoat: dict   # {"steered": bool, "reasons": [str]}

graph.add_node("qualify", dg.wrap("sdr.qualify", qualify_lead,
    input_key="lead", output_key="qualification", case_id="lead_id", decision_key="datagoat"))

Declare the key in your state: LangGraph drops undeclared keys without an error. Keep the old behaviour when steered is false (the unchanged cases of the A/B test), and never give the reasons to the node Datagoat wraps. Outside LangGraph, @dg.point(..., on_decision=fn) calls fn(decision, case).

Any function

@dg.point("cs.risk_tier", case_id=lambda acct: acct["account_id"])
def risk_tier(acct: dict) -> dict: ...

Outcomes

dg.outcomes("sdr.qualify", [{"case_id": "L-20419", "value": 1}])

Map your agent

datagoat-decide map my_agent.graph:graph --name "SDR agent"

Metadata

Release files for datagoat-decide 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datagoat-decide 0.5.0
File Size Uploaded Provenance
datagoat_decide-0.5.0.tar.gz 166.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for datagoat-decide 0.5.0
File Interpreter ABI Platform
datagoat_decide-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 219.6 kB

Release files / datagoat_decide-0.5.0.tar.gz

Download URL datagoat_decide-0.5.0.tar.gz
Size 166.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fecc273126419aca996c1f94ea4c04e01d0a635741ac8f1dfc61600283dcc9ba
BLAKE2b-256 checksum
How to use checksums
b62cbf22d9858cad0f0510aed206ad62576185190954d0d95f7fb2d2c0a34bcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / datagoat_decide-0.5.0-py3-none-any.whl

Download URL datagoat_decide-0.5.0-py3-none-any.whl
Size 53.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae1ccb9fff4f93934c0b6afe1cfc9a0fb17c18511e5752dfead3a0f20bab78c5
BLAKE2b-256 checksum
How to use checksums
ad0c7f9d6a0ead13844ae83ddc4f31c2a88e24537a0463397140c9b0764bc5b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for datagoat-decide 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page