<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl" -->

---
title: Onboarding Agent from Scratch. Part 1: One API Call,...
description: A practical walkthrough of building the foundation of an AI onboarding agent, starting with a single clean LLM API call using the Anthropic Python SDK. Covers...
canonical: https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Onboarding Agent from Scratch. Part 1: One API Call, Done Right | daily.dev
og:description: A practical walkthrough of building the foundation of an AI onboarding agent, starting with a single clean LLM API call using the Anthropic Python SDK. Covers...
og:url: https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl
og:image: https://api.daily.dev/og/posts/dvYFOlSbl.png
og:image:alt: Onboarding Agent from Scratch. Part 1: One API Call, Done Right
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Onboarding Agent from Scratch. Part 1: One API Call, Done Right

**[Medium](https://daily.dev/sources/medium_js)** · 5 min read · 1 upvotes · 0 comments

## Summary

A practical walkthrough of building the foundation of an AI onboarding agent, starting with a single clean LLM API call using the Anthropic Python SDK. Covers secure API key handling via .env files and python-dotenv, structured response parsing, typed exception handling for different error categories, and git hygiene practices like committing .gitignore before any secret-bearing files. The post emphasizes that getting even this basic step right requires real engineering discipline, pushing back against the notion that AI automation is trivial.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@spodsky/onboarding-agent-from-scratch-part-1-one-api-call-done-right-11d49548f294>

## Questions this post answers

### How do I securely store my Anthropic API key when building a Python script with the Anthropic SDK?

Store the key in a local, git-ignored .env file loaded into the process environment with python-dotenv, rather than hard-coding it or typing it into a terminal command. The Anthropic Python SDK automatically reads ANTHROPIC_API_KEY from the environment, so calling anthropic.Anthropic() with no arguments picks up the key without it ever touching application code. Commit .gitignore and a placeholder .env.example before creating the real .env file so a secret can never accidentally get staged.

_Developers wiring up their first LLM integration can find more API key hygiene patterns like this on daily.dev._

### How should I handle errors when calling the Anthropic Claude API in Python?

Catch errors by type rather than parsing error message strings, since the Anthropic Python SDK exposes distinct exception types for authentication failures, network connection errors, and API-side status errors. Each represents a different problem with a different fix, so a script's except clauses should target each exception type separately for more reliable failure handling.

_Anyone hardening an LLM-backed script against real-world failures can track patterns like this on daily.dev._

## Similar posts on daily.dev

- [How \(and Why\) to Build an AI Agent from Scratch in Python](https://daily.dev/posts/how-and-why-to-build-an-ai-agent-from-scratch-in-python-rynpfwbws) · Machine Learning Mastery · 3 upvotes · 0 comments
- [The Ultimate Beginners’ Guide to Building an AI Agent in Python](https://daily.dev/posts/the-ultimate-beginners-guide-to-building-an-ai-agent-in-python-dkhiab38j) · Towards Data Science · 0 upvotes · 0 comments
- [Onboarding Agent from Scratch. Part 5: From Chatbot to Agent](https://daily.dev/posts/onboarding-agent-from-scratch-part-5-from-chatbot-to-agent-2zhnlvdly) · Medium · 2 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#llm](https://daily.dev/tags/llm), [#ai-agents](https://daily.dev/tags/ai-agents), [#anthropic](https://daily.dev/tags/anthropic)

[View this post on daily.dev](https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Onboarding Agent from Scratch. Part 1: One API Call, Done Right","url":"https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl"},"datePublished":"2026-07-21T18:09:41.252Z","dateModified":"2026-09-14T09:09:40.299Z","description":"A practical walkthrough of building the foundation of an AI onboarding agent, starting with a single clean LLM API call using the Anthropic Python SDK. Covers...","image":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","thumbnailUrl":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,llm,ai-agents,anthropic","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Onboarding Agent from Scratch. Part 1: One API Call, Done Right"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/onboarding-agent-from-scratch-part-1-one-api-call-done-right-dvyfolsbl#faq","mainEntity":[{"@type":"Question","name":"How do I securely store my Anthropic API key when building a Python script with the Anthropic SDK?","acceptedAnswer":{"@type":"Answer","text":"Store the key in a local, git-ignored .env file loaded into the process environment with python-dotenv, rather than hard-coding it or typing it into a terminal command. The Anthropic Python SDK automatically reads ANTHROPIC_API_KEY from the environment, so calling anthropic.Anthropic() with no arguments picks up the key without it ever touching application code. Commit .gitignore and a placeholder .env.example before creating the real .env file so a secret can never accidentally get staged. Developers wiring up their first LLM integration can find more API key hygiene patterns like this on daily.dev."}},{"@type":"Question","name":"How should I handle errors when calling the Anthropic Claude API in Python?","acceptedAnswer":{"@type":"Answer","text":"Catch errors by type rather than parsing error message strings, since the Anthropic Python SDK exposes distinct exception types for authentication failures, network connection errors, and API-side status errors. Each represents a different problem with a different fix, so a script's except clauses should target each exception type separately for more reliable failure handling. Anyone hardening an LLM-backed script against real-world failures can track patterns like this on daily.dev."}}]}
```

