Loading...
Loading...
TensorLake SDK for building agentic workflows, sandboxed code execution, and document parsing/extraction. Use when the user mentions tensorlake, or asks about TensorLake APIs/docs/capabilities. Also use when the user is building AI agents or agentic applications that need serverless workflow orchestration (parallel map/reduce DAGs), sandboxed execution of LLM-generated code, or document parsing, structured extraction, and OCR from PDFs/images. Works with any LLM provider (OpenAI, Anthropic), agent framework (LangChain, CrewAI, LlamaIndex), database, or API as the infrastructure layer.
npx skill4agent add tensorlakeai/tensorlake-skills tensorlaketensorlake.applicationsTENSORLAKE_API_KEYtensorlake login.envsecrets@function()from tensorlake.applications import (
application, function, run_local_application, Image, File
)
@application()
@function()
def orchestrator(items: list[str]) -> list[dict]:
"""Entry point: must have both @application and @function."""
prepared = prepare_item.map(items) # parallel map
summary = summarize.reduce(prepared, initial="") # reduce
return format_output(summary)
@function(timeout=60)
def prepare_item(text: str) -> str:
"""Normalize an input item before aggregation."""
return text.strip()
@function(image=Image(base_image="python:3.11-slim").run("pip install openai"))
def summarize(accumulated: str, page: str) -> str:
# reduce signature: (accumulated, next_item) -> accumulated
return accumulated + "\n" + page[:500]
@function()
def format_output(text: str) -> dict:
return {"summary": text}
if __name__ == "__main__":
request = run_local_application(
orchestrator,
["First research note", "Second research note"],
)
print(request.output()).future().map().reduce()@function()Imagesecrets@application()@function()def my_reduce(accumulated, next_item) -> accumulated_typeresult = step2.future(step1.future(x))run_local_application(fn, *args)tensorlake deploy path/to/app.pyrun_remote_application(fn, *args)Image(base_image=...).run("pip install ...")secrets=["MY_SECRET"]@function()tensorlake secretstensorlake deploy path/to/app.py # Deploy to cloud
tensorlake parse --file-path doc.pdf # Parse document
tensorlake login # Authenticate
tensorlake secrets # Manage secrets
tensorlake create-template # Create sandbox template