Separate generation from authority | Introduction to Generative AI
Understand how generative AI works, write source-bounded prompts, validate outputs, evaluate grounded answers and design a responsible career-learning assistant.
Prerequisites: No prior AI experience required. Basic familiarity with reading short code examples is helpful; no paid API account is needed.
Separate generation from authority
An AI assistant may suggest an action, but your application must decide whether the action is authorized. A generated request to send an email, change a profile or delete a document is not proof of the user permission needed for that operation. Treat every proposed tool call as an untrusted request. Check the authenticated user, allowed operation, target record and input constraints before any side effect.
Keep service credentials on the server. A React application delivered to a browser cannot keep an API key private, even if the key is placed in a build-time environment variable. A backend endpoint should enforce authentication, input limits and provider-specific timeouts before calling an external AI service. Return only the information required by the interface and avoid storing personal prompts in diagnostic logs by default.
Use the least authority necessary. A lesson-search helper does not need permission to update candidate records. A drafting tool can show text for review without sending it anywhere. When an action has an external effect, use a clear review step that displays the exact action and target. The diagram below is an application design aid, not an executable agent workflow. Our practice editor does not run code on the application server.
Worked example
record DraftRequest(String sourceFacts, String tone) {}
// Illustrative service boundary, not a provider SDK integration.
// 1. Authenticate the candidate.
// 2. Validate request size and allowed task.
// 3. Call the provider with server-side credentials and a timeout.
// 4. Validate the response and return a reviewable draft.
// 5. Require a separate authorized operation to publish or send it.
Try it yourself
Draw a boundary between drafting a message and sending it. List the permissions needed for each. Explain where an API key belongs and why putting it in a frontend bundle is unsafe.
Check your understanding: explain why the example works, state one limitation, and record how you would test it.
Candidate → authenticated backend → approved model provider
↓
validated draft → candidate review
A separate permission check gates any external action.
1. Understand generative AI
2. Give clear instructions
3. Ground and evaluate answers
4. Build a responsible learning prototype