{"product_id":"ai-agent-loop-starter-kit-for-claude","title":"AI Agent Loop Starter Kit for Claude","description":"\u003csection aria-label=\"About this AI agent starter\" style=\"box-sizing:border-box;width:100%;max-width:1200px;margin:0 auto;padding:clamp(18px,3vw,32px);border:1px solid #d5e3f4;border-top:4px solid #fcbd01;border-radius:12px;background:#eff5fc;color:#102d4e;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:1.8;overflow-wrap:break-word;\"\u003e\n\u003ch2 style=\"margin:0 0 20px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:30px;font-weight:700;line-height:1.3;\"\u003eOpen the code. Follow the tools. Check the result.\u003c\/h2\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eBuild a practical understanding of an AI agent by running a small, inspectable example. This free ZIP contains editable Python source, task instructions, fictional contacts and a price list. The example prepares an email draft with the correct recipient and a real CSV attachment, then checks the saved file.\u003c\/p\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe code makes the boundary between the model and the surrounding application visible. A model can request an action; the runtime validates and executes an allowed tool. Its result returns to the next model call, which can continue, ask for information or finish.\u003c\/p\u003e\n\u003cdiv style=\"display:flex;flex-wrap:wrap;gap:16px;align-items:stretch;margin:20px 0 28px;\"\u003e\n\u003cdiv style=\"box-sizing:border-box;flex:1 1 270px;min-width:0;padding:24px;border:1px solid #cbdcf1;border-radius:10px;background:#ffffff;\"\u003e\n\u003ch4 style=\"margin:0 0 15px;text-align:center;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:20px;font-weight:700;line-height:1.4;\"\u003eTry it offline\u003c\/h4\u003e\n\u003cp style=\"margin:0;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eStart with the scripted sample. No API key, model account or network connection is needed to inspect the loop and the files it creates.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003cdiv style=\"box-sizing:border-box;flex:1 1 270px;min-width:0;padding:24px;border:1px solid #cbdcf1;border-radius:10px;background:#ffffff;\"\u003e\n\u003ch4 style=\"margin:0 0 15px;text-align:center;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:20px;font-weight:700;line-height:1.4;\"\u003eConnect your Claude account\u003c\/h4\u003e\n\u003cp style=\"margin:0;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eUse live mode when you want Claude to choose the actions. Supply your own Anthropic API key and an accessible model ID; API usage is billed separately by the provider.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003ch3 style=\"margin:32px 0 16px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:24px;font-weight:700;line-height:1.35;\"\u003eUnderstand the complete agent loop\u003c\/h3\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe architecture brings together the request, relevant context, memory, model decisions, tools and returned evidence. Permissions and limits belong around that loop. A clear stopping condition helps distinguish a completed task from a reassuring sentence.\u003c\/p\u003e\n\u003cfigure style=\"box-sizing:border-box;display:block;margin:26px 0 32px;padding:12px;border:1px solid #d0def2;border-radius:12px;background:#ffffff;\"\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0522\/6191\/2762\/files\/ai-agent-loop-architecture.png?v=1793881672\" alt=\"Illustrated agent architecture with centered memory, guardrails, context, model, tools and a goal decision.\" loading=\"lazy\" style=\"display:block;width:100%;max-width:1100px;height:auto;margin:0 auto;border:0;border-radius:8px;\"\u003e\u003cfigcaption style=\"margin:14px auto 4px;max-width:1040px;padding:0 8px;text-align:center;color:#496582;font-size:14px;line-height:1.7;\"\u003eArchitecture illustration. The supplied starter runs locally from a terminal. Cost, latency and eval monitoring in the wider map are extension ideas.\u003c\/figcaption\u003e\u003c\/figure\u003e\n\u003ch3 style=\"margin:32px 0 16px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:24px;font-weight:700;line-height:1.35;\"\u003eFollow one task from request to draft\u003c\/h3\u003e\n\u003cdiv style=\"box-sizing:border-box;margin:20px 0 24px;padding:22px;border:1px solid #c6d7f2;border-left:4px solid #6067f2;border-radius:10px;background:#ffffff;text-align:center;\"\u003e\u003cp style=\"margin:0;color:#102d4e;font-size:18px;font-weight:700;line-height:1.6;\"\u003e“Prepare a short email to Sarah Lee with the current price list. Save a draft for review.”\u003c\/p\u003e\u003c\/div\u003e\n\u003cdiv style=\"display:flex;flex-wrap:wrap;gap:16px;align-items:stretch;margin:20px 0 28px;\"\u003e\n\u003cdiv style=\"box-sizing:border-box;flex:1 1 270px;min-width:0;padding:24px;border:1px solid #cbdcf1;border-radius:10px;background:#ffffff;\"\u003e\n\u003ch4 style=\"margin:0 0 15px;text-align:center;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:20px;font-weight:700;line-height:1.4;\"\u003e1. Verify the contact\u003c\/h4\u003e\n\u003cp style=\"margin:0;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe contact tool reads the local sample list. A full name identifies the recipient; an ambiguous match returns an error instead of silently selecting someone.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003cdiv style=\"box-sizing:border-box;flex:1 1 270px;min-width:0;padding:24px;border:1px solid #cbdcf1;border-radius:10px;background:#ffffff;\"\u003e\n\u003ch4 style=\"margin:0 0 15px;text-align:center;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:20px;font-weight:700;line-height:1.4;\"\u003e2. Retrieve the current file\u003c\/h4\u003e\n\u003cp style=\"margin:0;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe price-list tool reads the CSV and records its fingerprint. The source is checked again before saving, so a changed attachment requires a fresh lookup.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003cdiv style=\"box-sizing:border-box;flex:1 1 270px;min-width:0;padding:24px;border:1px solid #cbdcf1;border-radius:10px;background:#ffffff;\"\u003e\n\u003ch4 style=\"margin:0 0 15px;text-align:center;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:20px;font-weight:700;line-height:1.4;\"\u003e3. Create a checked draft\u003c\/h4\u003e\n\u003cp style=\"margin:0;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe draft tool saves an .eml file with the actual CSV attached. It opens the saved message data again to verify the recipient, filename and attachment bytes.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cfigure style=\"box-sizing:border-box;display:block;margin:26px 0 32px;padding:12px;border:1px solid #d0def2;border-radius:12px;background:#ffffff;\"\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0522\/6191\/2762\/files\/ai-agent-loop-tools.png?v=1793881677\" alt=\"The included find_contact, read_price_list and save_email_draft tools, with an illustrated returned result.\" loading=\"lazy\" style=\"display:block;width:100%;max-width:1100px;height:auto;margin:0 auto;border:0;border-radius:8px;\"\u003e\u003cfigcaption style=\"margin:14px auto 4px;max-width:1040px;padding:0 8px;text-align:center;color:#496582;font-size:14px;line-height:1.7;\"\u003eThe three local tools in the ZIP. This view illustrates dispatch and returned evidence; it is not a recording of a live Claude API session.\u003c\/figcaption\u003e\u003c\/figure\u003e\n\u003ch3 style=\"margin:32px 0 16px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:24px;font-weight:700;line-height:1.35;\"\u003eSee the file the included example produces\u003c\/h3\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe offline demo creates a real mail file in the output folder. The preview below is built from that generated .eml and its attached CSV. The sample uses a fictional contact and illustrative service prices. Inspect the message and attachment before adapting the source data.\u003c\/p\u003e\n\u003cfigure style=\"box-sizing:border-box;display:block;margin:26px 0 32px;padding:12px;border:1px solid #d0def2;border-radius:12px;background:#ffffff;\"\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0522\/6191\/2762\/files\/ai-agent-loop-demo-result.png?v=1793881685\" alt=\"Actual offline-demo draft to the fictional sarah.lee@example.com, with the sample CSV price list attached.\" loading=\"lazy\" style=\"display:block;width:100%;max-width:1100px;height:auto;margin:0 auto;border:0;border-radius:8px;\"\u003e\u003cfigcaption style=\"margin:14px auto 4px;max-width:1040px;padding:0 8px;text-align:center;color:#496582;font-size:14px;line-height:1.7;\"\u003ePreview generated from the included scripted demo output. The recipient and attachment were verified against the local source files.\u003c\/figcaption\u003e\u003c\/figure\u003e\n\u003ch3 style=\"margin:32px 0 16px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:24px;font-weight:700;line-height:1.35;\"\u003eWhat the ZIP contains\u003c\/h3\u003e\n\u003cul style=\"margin:0 0 26px;padding-left:24px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003e\n\u003cli style=\"margin:0 0 13px;padding-left:3px;\"\u003e\n\u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eagent.py\u003c\/code\u003e – the Claude adapter, three local tools, execution loop, source checks, memory and action logging.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 13px;padding-left:3px;\"\u003e\n\u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eAGENT_INSTRUCTIONS.md\u003c\/code\u003e – editable task instructions, permitted behavior and completion criteria.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 13px;padding-left:3px;\"\u003e\n\u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003esample_contacts.json\u003c\/code\u003e and \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003esample_price_list.csv\u003c\/code\u003e – fictional input records and the actual attachment used by the example.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 13px;padding-left:3px;\"\u003e\n\u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003etest_agent.py\u003c\/code\u003e – 16 offline tests covering ambiguous names, changed or missing sources, invalid tools, model errors, truncation and limits.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 13px;padding-left:3px;\"\u003e\n\u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eREADME.md\u003c\/code\u003e, \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eBUILD_IN_CLAUDE.md\u003c\/code\u003e and \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eVALIDATION.md\u003c\/code\u003e – setup instructions, a brief for extending the project in Claude Code and the scope of the checks performed.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 13px;padding-left:3px;\"\u003e\n\u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003ePACKAGE_MANIFEST.json\u003c\/code\u003e – file fingerprints for checking the contents of the download.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003ch3 style=\"margin:32px 0 16px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:24px;font-weight:700;line-height:1.35;\"\u003eGet started in four steps\u003c\/h3\u003e\n\u003col style=\"margin:0 0 24px;padding-left:24px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003e\n\u003cli style=\"margin:0 0 12px;\"\u003eExtract the complete ZIP into one folder. Use Python 3.10 or newer.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 12px;\"\u003eOpen a terminal in the extracted folder. The starter uses the standard library, so there are no extra Python packages to install.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 12px;\"\u003eRun \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003epython agent.py --demo\u003c\/code\u003e to generate the scripted sample.\u003c\/li\u003e\n\u003cli style=\"margin:0 0 12px;\"\u003eOpen \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eoutput\/result.json\u003c\/code\u003e and the draft named in its result. Review the recipient, message and attachment.\u003c\/li\u003e\n\u003c\/ol\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eFor the Claude-powered mode, configure \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eANTHROPIC_API_KEY\u003c\/code\u003e and \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003eANTHROPIC_MODEL\u003c\/code\u003e in your environment, then run \u003ccode style=\"padding:3px 6px;border-radius:4px;background:#e9effb;color:#2144a9;font-family:Consolas,monospace;font-size:14px;overflow-wrap:anywhere;\"\u003epython agent.py --live\u003c\/code\u003e. The key stays outside the downloadable source files. Your live task and relevant tool results are sent to Anthropic.\u003c\/p\u003e\n\u003ch3 style=\"margin:32px 0 16px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:24px;font-weight:700;line-height:1.35;\"\u003eKeep context, memory and evidence separate\u003c\/h3\u003e\n\u003cdiv style=\"display:flex;flex-wrap:wrap;gap:16px;align-items:stretch;margin:20px 0 28px;\"\u003e\n\u003cdiv style=\"box-sizing:border-box;flex:1 1 270px;min-width:0;padding:24px;border:1px solid #cbdcf1;border-radius:10px;background:#ffffff;\"\u003e\n\u003ch4 style=\"margin:0 0 15px;text-align:center;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:20px;font-weight:700;line-height:1.4;\"\u003eMemory for the next run\u003c\/h4\u003e\n\u003cp style=\"margin:0;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eAfter a successful run, a small memory file records the last verified draft, recipient and attachment fingerprint. A later run still looks up the current sources again.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003cdiv style=\"box-sizing:border-box;flex:1 1 270px;min-width:0;padding:24px;border:1px solid #cbdcf1;border-radius:10px;background:#ffffff;\"\u003e\n\u003ch4 style=\"margin:0 0 15px;text-align:center;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:20px;font-weight:700;line-height:1.4;\"\u003eAn action log you can inspect\u003c\/h4\u003e\n\u003cp style=\"margin:0;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe JSONL log records model calls, requested tools, returned results, errors and the final status. This makes it easier to find where a run succeeded or stopped.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eDefault controls allow up to eight model calls and twelve tool calls, with a run-time budget checked between operations. A missing source, a limit or an API error can stop the run. A plain-text claim of success does not replace a verified draft file.\u003c\/p\u003e\n\u003ch3 style=\"margin:32px 0 16px;text-align:center;color:#102d4e;font-family:Poppins,Arial,sans-serif;font-size:24px;font-weight:700;line-height:1.35;\"\u003eCommon questions\u003c\/h3\u003e\n\u003ch4 style=\"margin:22px 0 10px;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:18px;font-weight:700;line-height:1.45;\"\u003eCan I try it without an API key?\u003c\/h4\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eYes. The offline demo and included tests run locally without network calls or API credits. That mode uses fixed responses to demonstrate the tool loop. Live Claude decisions require your own API access.\u003c\/p\u003e\n\u003ch4 style=\"margin:22px 0 10px;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:18px;font-weight:700;line-height:1.45;\"\u003eDoes it send the email?\u003c\/h4\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe result is a local draft for human review. You review the message and attachment, choose an email account and send it separately. The supplied tool set ends at creating and verifying the draft.\u003c\/p\u003e\n\u003ch4 style=\"margin:22px 0 10px;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:18px;font-weight:700;line-height:1.45;\"\u003eCan I change the data and instructions?\u003c\/h4\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eYes. The Python source, Markdown instructions, contact records and CSV are editable. Use the fictional sample to understand the formats before substituting real data. Review model-written content before use.\u003c\/p\u003e\n\u003ch4 style=\"margin:22px 0 10px;color:#2561df;font-family:Poppins,Arial,sans-serif;font-size:18px;font-weight:700;line-height:1.45;\"\u003eWhat has been checked?\u003c\/h4\u003e\n\u003cp style=\"margin:0 0 18px;color:#102d4e;font-size:16px;line-height:1.8;\"\u003eThe package passes 16 offline tests and an extracted-ZIP demo run, including verification of the generated attachment. Model responses and API-message structure are tested with offline fixtures. Configure and verify a real API run with your own account before relying on live output.\u003c\/p\u003e\n\u003cp style=\"margin:26px 0 0;padding-top:18px;border-top:1px solid #ccdcf1;color:#496582;font-size:14px;line-height:1.75;\"\u003eA downloadable educational starter with source code and fictional sample data. It runs on your computer; the ZIP is not a hosted automation service or a course subscription.\u003c\/p\u003e\n\u003c\/section\u003e\n","brand":"FinancialModelsLab","offers":[{"title":"Default Title","offer_id":68430672625907,"sku":"ai-agent-loop-starter-kit-for-claude","price":0.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0522\/6191\/2762\/files\/ai-agent-loop-starter-kit-cover.png?v=1793881640","url":"https:\/\/financialmodelslab.com\/products\/ai-agent-loop-starter-kit-for-claude","provider":"Financial Models Lab Templates","version":"1.0","type":"link"}