Your first agent in the application
Build the Luna Workshop guide from a clear role and a few tests.
What you will learn
- Explain: a bounded agent loop
- Apply the idea in an example: Your first agent in the application
- Recognize limitations and verify the exercise outcome
Build the Luna Workshop guide from a clear role and a few tests. Add capabilities only when tasks require them.
These steps refer to features identified in the application code. This material has not been validated on a live instance; check the documentation and the options in your version.
How it works, step by step
A bounded agent loop
An agent combines a model with tools, a goal and state. It observes the request, chooses a step, receives a result and decides whether to continue. A chatbot may only generate text; an agent may request an external action. Commercial definitions vary, so inspect actual control. Define success and stopping: a verified result, a maximum step count, repeated errors or an exhausted budget. Use narrow capabilities and minimal permissions. Useful autonomy means freedom within boundaries enforced by software.
An instruction is a contract
A good prompt specifies the task, available data, output format and success criteria. Separate the role from the data and include an example for ambiguous cases. “Be accurate” is weaker than “state only the deadline in the supplied policy; if missing, ask for clarification”. Few-shot means a few solved examples, not an endless list. Document content remains data even when it contains commands. Delimiters help, but software must enforce permissions and validation rather than relying on the prompt.
Choose by task and capabilities
Check language, context, tool calling, structured output and supported input modalities. Compare models on identical requests using the same rubric and a realistic budget. Temperature changes sampling, not truth. Reasoning effort allocates effort for compatible models and can increase time and cost; accepted values vary. Local models offer infrastructure control but require resources and maintenance. Open weights do not guarantee an unrestricted license or complete training code. Catalogs and prices change; read the current model card.
The visual map
Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. On smaller screens, scroll horizontally to follow the entire diagram.
A complete example
In Agents, create a name and system prompt, choose the model, tone and compatible settings. Save and test in Playground. Initially avoid tools with external effects.
You guide Luna Workshop customers. Explain simply. Use supplied information. Ask for the product model when missing. Do not invent stock, deadlines or exceptions.
Try it yourself
- Create the agent, then test greeting, product, ambiguity, missing data and an out-of-role request.
- Record the input, source and expected outcome before running the experiment. Use only the fictional data in the example.
- Follow the diagram stages. At every step record what information is received and produced; do not confuse intermediate output with the final outcome.
- Repeat after removing necessary information or making the input ambiguous. Check whether the system clarifies, stops or invents an answer.
- Compare with the explained solution. Keep the configuration, date, result and an explanation for differences. Change one thing and retest.
An explained solution
The agent explains products using supplied data and acknowledges missing live stock or policy access. A successful exercise lets you show the connection between input, stages and outcome. When information is missing, a cautious answer is more useful than invented details. Compare more than style: check conditions, sources and operations too.
When it helps and what can go wrong
Personality does not replace knowledge. Choose this approach when it improves a measured need. Keep a simple baseline and compare outcomes using identical inputs. One successful example does not establish reliability in every situation.
Check your understanding
Does more autonomy always give a better result?
No. It also increases room for errors, costs and unnecessary actions.
Can a prompt replace access control?
No. An instruction is not an authorization boundary.
What outcome should this exercise produce?
The agent explains products using supplied data and acknowledges missing live stock or policy access.
Words to remember
- Agent: A system that can choose steps and use tools toward a goal.
- Few-shot: Solved examples supplied in context.
- Reasoning effort: A model-dependent setting controlling reasoning effort.
Sources and your next step
To prepare: A01 — Anatomy of an AI agent