Skip to content

Commit 7d0e871

Browse files
Add Aperture instruqt
1 parent 7ef37f9 commit 7d0e871

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

instruqt/03-weather-agent/assignment.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,20 @@ Watch the Worker logs. The LLM chains through multiple tools before responding:
184184

185185
The LLM made autonomous decisions about which tool to call next, and Temporal recorded every call, input, and output in the Workflow history. If the process had crashed halfway through, Temporal could replay the history on a new Worker and the agent would resume from exactly where it left off, even partway through a multi-tool reasoning chain.
186186

187+
## Step 8: Explore the Aperture UI
188+
189+
Open the [button label="Aperture UI" background="#444CE7"](tab-4) tab to see every LLM call your Workers made.
190+
191+
**Dashboard** gives you the aggregate view: total requests, total tokens, estimated cost, quota remaining, and a per-model breakdown in the **Metrics by Model** table. The **Recent Requests** list at the bottom shows individual calls with per-request token counts and costs.
192+
193+
Click the **Logs** tab to browse individual requests. Click any row to expand it and read the full request payload and response body for that call.
194+
195+
Click the **Tool Calls** tab to see every tool invocation that came out of the agentic loop, listed separately from the LLM calls that spawned them.
196+
197+
Click the **Adoption** tab for a cost and token-usage breakdown across models and over time.
198+
199+
> **Note:** Every Instruqt machine authenticated using the same `tag:infra`, so the Dashboard and Logs show requests from all attendees, not just yours. In a real deployment, Aperture attributes usage per user via their Tailscale identity from your IDP. Agentic workloads should have their own tags too — both so Aperture tracks them separately from human users and because zero-trust ACLs depend on a well-defined tag taxonomy to enforce least-privilege access. The workshop `tailnet` has fully open ACLs for simplicity; in production you would give each user and each agent only the access they need.
200+
187201
## Wrapping Up
188202

189203
In this exercise you:
@@ -193,5 +207,6 @@ In this exercise you:
193207
- Turned that Workflow into an agentic loop where the LLM keeps calling tools until it has enough information to answer
194208
- Used Temporal's dynamic activities to dispatch whichever tool the LLM chose on each iteration
195209
- Watched Temporal record every LLM call and tool result as part of the Workflow history
210+
- Explored the Aperture UI to see per-request logs, tool calls, and cost attribution for every LLM call the agent made
196211

197212
In the final exercise you'll combine the `tsnet` pattern from Exercise 2 with the Aperture pattern you just used, in a single Go service. A metrics watcher that scrapes a `tailnet`-only endpoint, asks Claude for a health summary, and runs on a Temporal Schedule.

instruqt/04-go-agent/assignment.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The same `tsnet` pattern from Exercise 2, but against real services. The Worker
6767
6868
## Environment
6969
70-
All code for this exercise lives in `exercises/04_go_agent/practice/`. Unlike the earlier exercises, this one has no **TODO**s, the code is already complete. You'll read, run, and optionally tweak it in place. Step 5 invites you to customize the Claude prompt in `activities.go` if you want to experiment.
70+
All code for this exercise lives in `exercises/04_go_agent/practice/`. Unlike the earlier exercises, this one has no **TODO**s, the code is already complete. You'll read, run, and optionally tweak it in place. Step 7 invites you to customize the Claude prompt in `activities.go` if you want to experiment.
7171
7272
## Topology
7373
@@ -170,7 +170,11 @@ You should see at least one completed Workflow run whose result is a structured
170170
171171
> **Note:** The Schedule is capped at 5 runs to keep the shared Temporal server clean. Once all 5 fire, the Schedule pauses itself. Schedules live on the Temporal Server, not on the Worker, so restarting the Worker does nothing to the Schedule. To reset the count, re-run the starter, which deletes and recreates the Schedule.
172172
173-
## Step 5: Tune the cadence
173+
## Step 5: Explore the Aperture UI
174+
175+
Open the [button label="Aperture UI" background="#444CE7"](tab-4) tab and explore it the same way you did in Exercise 3. You should see the Claude calls from the `AnalyzeMetrics` activities that just ran.
176+
177+
## Step 6: Tune the cadence
174178

175179
To change the interval, re-run the starter with a different `HEALTH_CHECK_INTERVAL`. The Worker keeps running; only the Schedule changes.
176180

@@ -183,13 +187,13 @@ go run . starter
183187

184188
Any Go duration works (`30s`, `2m`, `5m`). The starter deletes the old Schedule and creates a new one with the new interval, so the 5-run count resets too. The Worker in the other terminal notices the new fires immediately.
185189

186-
## Step 6: Customize the Claude prompt (optional)
190+
## Step 7: Customize the Claude prompt (optional)
187191

188192
If you want to see how the summary changes when you change what you ask Claude, you can edit the prompt directly and restart the Worker.
189193

190194
Open `activities.go` in the [button label="Code Editor" background="#444CE7"](tab-0) tab, find `AnalyzeMetrics`. The prompt lives in a raw string. Change it however you like, ask Claude to flag anything unusual, add a field to the `HealthReport` struct, or try a different tone. Then restart the Worker (the starter doesn't need restarting; the Schedule is unchanged) and watch the next Schedule fire produce a different `HealthReport` in the UI.
191195

192-
## Step 7: Run the offline tests
196+
## Step 8: Run the offline tests (optional)
193197

194198
The Workflow and activities also come with offline tests that mock `node_exporter` and Aperture with `httptest.Server`, so they don't need the `tailnet` at all.
195199

@@ -209,6 +213,7 @@ In this exercise you:
209213
- Used the same Aperture pattern from Exercise 3, this time with Anthropic's Claude instead of OpenAI
210214
- Ran a separate starter process that registered a Temporal Schedule with `TriggerImmediately`, matching the production pattern of decoupling Workers from Schedule management
211215
- Watched the Schedule fire on creation and on a cadence in the Temporal UI, with the Worker picking up each fired run
216+
- Explored the Aperture UI to see per-request logs and cost attribution for the Claude calls the Worker made
212217
- Tuned the cadence by re-running the starter with a different `HEALTH_CHECK_INTERVAL`, without restarting the Worker
213218
- Optionally customized the Claude prompt and saw the structured `HealthReport` change on the next fire
214219
- Ran the offline tests that mock `node_exporter` and Aperture, no `tailnet` required

0 commit comments

Comments
 (0)