Free Stage 3 Sample — Build Your First Safe Agent
Learn what makes an agent different from an ordinary chat, then design and run a safe, deterministic mini-agent using fictional tasks.
FREE PREVIEW 45–65 MINUTES1. What makes something an agent?
A simple agent loop is observe → decide → act → check → stop. For example, a transport operations agent might inspect a list of planned departures, query an approved live system and flag differences for review. It must not invent live readings or act outside its permissions.
2. Define the goal, tools and boundaries
Write a contract: Input is a list of tasks with an
urgent flag. Decision is a transparent rule. Output is an ordered list of recommendations. Approval is always human before any real-world action. The stopping condition is that every input task has been processed once.3. Run the simplest possible Python example
This code is intentionally ordinary Python, not a live generative model. That’s the point: you learn the control flow and failure boundaries before granting an AI access to tools. Copy it into a local Python environment or read through it line by line.
tasks = [
{"title": "Review fictional delivery list", "urgent": True},
{"title": "Draft tomorrow's meeting agenda", "urgent": False},
{"title": "Check sample discrepancy report", "urgent": True},
]
def triage(items):
if not isinstance(items, list):
raise TypeError("Expected a list")
checked = []
for item in items:
if not isinstance(item, dict):
raise TypeError("Task must be an object")
title = item.get("title")
urgent = item.get("urgent")
if not isinstance(title, str) or not isinstance(urgent, bool):
raise ValueError("Invalid task format")
checked.append((0 if urgent else 1, title))
return [title for _, title in sorted(checked)]
for title in triage(tasks):
print("REVIEW:", title)
print("No tasks were changed or sent.")The loop validates input, applies a rule, prints recommendations and stops. It has no network access, credentials or external side effects. A real AI agent adds model reasoning and possibly tool calls, which means more uncertainty and a greater need for tests.
4. Add an agentic decision, carefully
Never give the model unbounded permission to execute arbitrary code, email third parties or edit business records. Start in a sandbox with fabricated data, then introduce read-only real integrations only with explicit organisational approval.
5. Test failure before success
urgent: "yes" instead of a boolean — the example should refuse it. Try a missing title — it should refuse it. Try an empty list — it should produce no tasks without crashing. After testing, write one sentence explaining why a refusal is better than silently guessing the data. That’s the beginning of professional agent engineering.
Reusable starter prompt
Build something now
Run or reason through the toy Python example. Identify inputs, validation, decisions, outputs and stopping conditions. Design three failure tests. Then draw a six-box architecture for a hypothetical AI-powered version, making the model’s decision output explicitly untrusted until validated.
Turn the agent loop into your own safe blueprint
Choose a fictional goal, permissions and human approval gate, then save a reusable architecture brief.
Try Agent Workflow StudioKnowledge check
Try answering before opening the explanations.
1. Does a deterministic Python sorting script automatically count as a generative-AI agent?
No. It demonstrates agent-like workflow control, but contains no model, probabilistic decision-making or tool-planning intelligence.
2. What should happen when a model returns an invalid task record?
Reject or quarantine it, log the problem and avoid unsafe downstream actions.
3. Why use fictional data before real business integrations?
To test logic and failure handling without risking confidential information or operational changes.
