Patterns
Agent Loop in a Single Function
The simplest pattern: your entire agent loop runs inside one@function(). Tensorlake handles deployment, scaling, and durability.
- Run a single loop with tool calls
- Don’t need to fan out work to other agents
- Have predictable resource requirements
Sandboxing Functions
When your agent calls tools with different resource needs (CPU, memory, GPU, dependencies), wrap each tool in its own@function(). Each function runs in its own container with its own resource limits and dependencies.
@function():
- Runs in its own isolated container
- Has its own dependencies, CPU, memory, and GPU allocation
- Is independently retryable and durable
- Scales independently based on demand
Harness Pattern: Agent as Orchestrator
For complex agents, separate the harness (orchestration logic) from the work (tool execution). The harness is a lightweight function that coordinates heavier worker functions.Running Agent Frameworks on Tensorlake
OpenAI Agents SDK
LangGraph
Claude SDK
Parallel Sub-Agents
When your workflow involves multiple specialist agents, fan them out using futures or async functions so they run in parallel:Core Concepts
Functions
Building blocks of applications. Functions are Python functions that run in isolated containers with their own dependencies, compute, and storage.
Applications
HTTP-triggered entry points. Applications are functions exposed as HTTP endpoints that receive requests and orchestrate work across multiple functions.
Durable Execution
Resume from failures, not restart. Checkpoints are automatically created so retries continue from the last successful step instead of starting over.
Sandboxes
Run untrusted code safely. Every function runs in an isolated sandbox with configurable resource limits and network restrictions.
Map-Reduce
Parallel data processing. Fan out work across a list in parallel, then aggregate results—no queue setup required.
Observability
Built-in tracing and logging. Every function call is automatically traced with timing, logs, and execution timelines.