LangChain provides a powerful framework for building chains and agents that combine LLMs with tools like search, retrieval, or calculators. By connecting LangChain to ZenML, you can run these chains inside reproducible pipelines with full artifact tracking, observability, and seamless scaling from notebooks to production orchestrators.
from zenml import ExternalArtifact, pipeline, step
from langchain_agent import chain
@step
def run_chain(url_input: str) -> str:
# Extract URL from "Summarize: URL" format
if ":" in url_input and url_input.startswith("Summarize"):
url = url_input.split(":", 1)[1].strip()
else:
url = url_input # Fallback to use input as URL directly
return chain.invoke({"url": url})
@pipeline
def langchain_summarization_pipeline() -> str:
doc = ExternalArtifact(
value="Summarize: https://python.langchain.com/docs/introduction/"
)
return run_chain(doc.value)
if __name__ == "__main__":
print(langchain_summarization_pipeline())Expand your ML pipelines with more than 50 ZenML Integrations