Repository navigation
Drill · lap 1 · 1/9 · AGL-101 · Pull the answer out of a model message #80
akash-coded
started this conversation in
Hands-on Labs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
1 of 9 · AGL-101 · Pull the answer out of a model message
agent-loop· easy ·implement· ~8 min · no AWS accountA model's final message is not a string. It is a list of content blocks, and only some of them carry text. Every agent loop has a line that turns that list into the sentence a user reads — and it is a line people get subtly wrong for months.
The shape
{"role": "assistant", "content": [{"text": "Let me check that booking."}, {"toolUse": {"toolUseId": "t1", "name": "get_booking", "input": {}}}, {"text": "It was cancelled by the carrier, so it is refundable."}]}Three blocks. Two are text. One is a tool request the loop has already handled. The answer is the two text blocks, in order, joined — not the last block, and not the first.
Implement
Copy the block, fill it in, and post it as a comment:
What this proves
That you read the message shape rather than assuming the answer is
content[0]["text"]orcontent[-1]["text"]. Both assumptions pass a demo and fail the first time the model narrates before calling a tool.Submit in this thread
Copy the block from the brief, edit it, and post it as a comment here. The bot replies within a couple of minutes with every check, the skill you demonstrated, and what to do next.
Brief in the repo: labs/drills/agent-loop/AGL-101 · next in the sequence:
AGL-102· how grading works · scoreboardAll reactions