This tutorial walks you through wiring a LangChain agent with a tool that executes shell commands in a K7 sandbox.
Prerequisites
- K7 API running (
k7 install deploys it by default; from a laptop check GET /health or k7 api status after k7 config set) and reachable
- API key generated:
k7 generate-api-key <name> (on a cluster node)
- Python 3.10+
Setup
Create a .env file with your credentials and defaults:
Install dependencies (LangChain 1.x — initialize_agent was removed):
Agent code
You can exec into the same sandbox in parallel: k7 exec lc-agent -- ls /. k7 shell is node-local.