2.1. First Agent
In one glance
- You will: Create your first agent, run an offline check, and inspect a Gemini conversation in ADK Web.
- You need: install:learner completed; a valid Gemini configuration for the interactive portion.
- Time: about 20 minutes, hands-on.
How do you create the first agent?
Start with one small Python file rather than the full reference application.
Run from the repository root. If you already created step 1 from the README quickstart, skip start 1 and continue with check 1:
mise run lab -- start 1
mise run lab -- check 1
The first command creates learning/step-1/learner_agent/agent.py. Open it in your editor. It contains an instruction and build_agent(model), which constructs an ADK agent without making a model request.
The check should pass before you change anything. The starter is a working checkpoint; later steps ask you to add capabilities. Re-running start 1 refuses to overwrite your file.
How do you run it in the browser?
The interactive command loads the root .env and starts ADK Web on your laptop.
This interaction uses your configured model
With the default Gemini configuration, sending a message transmits it to the hosted API and may consume paid quota. Use only fictional course data.
mise run lab -- run 1
Open http://127.0.0.1:8002, select learner_agent, and ask: What can you help me investigate?
Inspect the Events timeline and session state. This agent has no tools yet, so it cannot know the seed's incidents. A plausible incident invented by the model is a failure of grounding, not evidence that a tool ran.
Stop the development server with Ctrl-C. ADK Web is a development debugger, not the production application interface.
Your turn: can you make the limitation explicit?
Change the instruction so the agent explains when it lacks evidence.
- Mode:
keep - Goal: Explain the agent's incident-assistance role and its current inability to retrieve incident records.
- Files to touch:
learning/step-1/learner_agent/agent.pyonly. - Preflight: Run
mise run lab -- check 1and read the instruction before editing it. Predict what happens if you ask aboutINC-002without any tool. - Gate that proves completion: Run
mise run lab -- check 1again. If model access is available, ask the same question and compare the answer to the actual available evidence. The offline check validates construction; it cannot grade prompt behavior. - Final state: Keep your edited file and a short note describing the model's limitation. Use
mise run lab -- solution 1to inspect the baseline without replacing your work.
Where does the completed reference fit?
The reference adds tested tools, policy, persistence, evaluation, and transport around this same agent concept.
Its source-owned constructor is available when you are ready to inspect it:
return Agent(
model=build_model(),
generate_content_config=build_generation_config(),
name="agentops_agent",
description="An on-call AgentOps Agent that triages and resolves incidents from a local dataset.",
instruction=_instruction(),
tools=[*_read_tools(), *ACTION_TOOLS, *MEMORY_TOOLS, skill_toolset()],
# No guardrail wiring here on purpose. Budget, compaction, PII redaction, write
# validation, output hardening, and error handling are attached once for the whole
# application by AgentOpsPolicyPlugin (governance.py), so every agent — including
# sub-agents and workflow nodes — is governed without repeating a line of it.
)
To run the completed reference with your existing Gemini configuration:
cd agents/python
mise run web
Stop the workshop UI before running this command because both use port 8002. Ask List the open incidents. The seed contains exactly INC-002, INC-005, and INC-010. Verify the answer against tool events; any extra incident is ungrounded.
The reference keeps prompts in Git and attaches policy once at the application boundary. You will learn those mechanisms after building the smaller versions yourself.
What proves this page worked?
Return to the repository root if you entered agents/python to inspect the reference.
mise run lab -- check 1
You are done when:
- Your small agent constructs successfully and its source is in your learner directory.
- You can explain why an agent without retrieval tools cannot know the incident dataset.
- If you ran the model, you inspected the conversation and stopped the UI afterward.
Continue to 2.6. Workshop to add tools and carry your work forward.