dagster-anthropic
A dagster module that provides integration with Anthropic.
Installation
The dagster_anthropic module is available as a PyPI package - install with your preferred python
environment manager (We recommend uv).
source .venv/bin/activate
uv pip install dagster-anthropic
Example Usage
In addition to wrapping the Anthropic client (get_client/get_client_for_asset methods), this resource logs the usage of the Anthropic API to to the asset metadata (both number of calls, and tokens). This is achieved by wrapping the Anthropic.messages.create method.
Note that the usage will only be logged to the asset metadata from an Asset context - not from an Op context. Also note that only the synchronous API usage metadata will be automatically logged - not the streaming or batching API.
from dagster import AssetExecutionContext, Definitions, EnvVar, asset, define_asset_job
from dagster_anthropic import AnthropicResource
@asset(compute_kind="anthropic")
def anthropic_asset(context: AssetExecutionContext, anthropic: AnthropicResource):
with anthropic.get_client(context) as client:
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[
{"role": "user", "content": "Say this is a test"}
]
)
defs = Definitions(
assets=[anthropic_asset],
resources={
"anthropic": AnthropicResource(api_key=EnvVar("ANTHROPIC_API_KEY")),
},
)
Development
The Makefile provides the tools required to test and lint your local installation
make test
make ruff
make check
Metadata
Release files for dagster-anthropic 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dagster_anthropic-0.0.6.tar.gz | 4.5 kB | Without provenance | Details for dagster_anthropic-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dagster_anthropic-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for dagster_anthropic-0.0.6-py3-none-any.whl |
Total release size: 9.8 kB
Release files / dagster_anthropic-0.0.6.tar.gz
| Download URL | dagster_anthropic-0.0.6.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c09aa362bac1620682c679f998bd4f1eb64733fee585df27c981dfbfcd24e89
|
|
BLAKE2b-256 checksum How to use checksums |
582e0654960fc99144b87d1c5e459cf521747987d3aa4010c30ce5096ddc79af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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 / dagster_anthropic-0.0.6-py3-none-any.whl
| Download URL | dagster_anthropic-0.0.6-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39dfb225015647e7e36d48339969e7d1d3d321fc7794ddc5f531f446f269df65
|
|
BLAKE2b-256 checksum How to use checksums |
24479d8d0a090a0c7833fae44c42fd16a7a20e726e5d644026e75990e904865d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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 dagster-anthropic 0.0.6
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.