Lion Cipher Lab
Build a multi-step AI agent that must ask before it acts
- AI Security
- Intermediate
- ~75 min
- Free · no account required
Why it matters
"AI agent" is the most hyped and least understood phrase in the industry. Strip away the marketing and an agent is a small, honest thing: a loop where a model proposes one step, your code runs a tool, the model sees the result and decides what to do next, until the job is done or a budget stops it. Building one yourself is the fastest way to see both why it is powerful — it can handle open-ended tasks whose exact steps you could not script in advance — and why it is dangerous. The instant a model can chain steps and choose its own tools, you have handed it agency, and its central failure mode…
What you'll learn
- building a multi-step (ReAct-style) agent loop in Python
- chaining several tool calls to accomplish one open-ended task
- designing least-privilege tools: read-only vs state-changing
- adding a human-in-the-loop approval gate that denies by default
- enforcing a step budget so an agent cannot loop forever
- validating every requested action against a tool allowlist
- judging when multi-step agency is worth it and when it is dangerous over-engineering
Steps in this lab
- What a multi-step agent is — and when it's the right tool
- Install Ollama and a small model
- Define the world: synthetic data and least-privilege tools
- Let the model propose ONE step at a time
- The safety scaffolding: allowlist, approval gate, step budget
- Run it, and watch it get denied — then approved
- Make it better — and know when NOT to build an agent at all