{"id":88,"date":"2026-05-30T15:36:28","date_gmt":"2026-05-30T13:36:28","guid":{"rendered":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/"},"modified":"2026-05-30T15:36:28","modified_gmt":"2026-05-30T13:36:28","slug":"guide-creer-votre-premier-agent-ia-autonome-en-python","status":"publish","type":"post","link":"https:\/\/shop.bluedolomites.com\/es\/guide-creer-votre-premier-agent-ia-autonome-en-python\/","title":{"rendered":"Guide : Creer votre premier agent IA autonome en Python"},"content":{"rendered":"<p>Un agent IA est un programme qui utilise un LLM pour raisonner et executer des actions de facon autonome. Contrairement a un chatbot qui repond passivement, un agent peut envoyer des emails, naviguer sur le web, executer du code et gerer des fichiers. Voici comment en construire un from scratch.<\/p>\n<h2>Architecture d un agent<\/h2>\n<p>Un agent se compose de 4 elements :<\/p>\n<ul>\n<li><strong>Le cerveau<\/strong> \u2014 un LLM (Llama, Qwen, Mistral) qui raisonne<\/li>\n<li><strong>Les outils<\/strong> \u2014 des fonctions Python que l agent peut appeler (envoyer un email, lire un fichier, faire une recherche web)<\/li>\n<li><strong>La memoire<\/strong> \u2014 l historique des actions et resultats<\/li>\n<li><strong>La boucle<\/strong> \u2014 observer, reflechir, agir, evaluer, repeter<\/li>\n<\/ul>\n<h2>Etape 1 \u2014 Le LLM local<\/h2>\n<p>Installez llama-cpp-python et telechargez un modele :<\/p>\n<pre><code>pip install llama-cpp-python\n\n# Telecharger Qwen 2.5 3B (leger, bon en francais)\n# depuis huggingface.co\/Qwen\/Qwen2.5-3B-Instruct-GGUF<\/code><\/pre>\n<h2>Etape 2 \u2014 Definir les outils<\/h2>\n<pre><code>import subprocess, datetime, os\n\nTOOLS = {\n    \"datetime\": lambda arg: datetime.datetime.now().strftime(\"%d\/%m\/%Y %H:%M\"),\n    \"shell\": lambda arg: subprocess.run(arg, shell=True, capture_output=True, text=True).stdout[:500],\n    \"file_read\": lambda arg: open(arg).read()[:2000],\n    \"file_write\": lambda arg: open(arg.split('|')[0],'w').write(arg.split('|',1)[1]),\n    \"web_search\": lambda arg: \"Resultat de recherche pour: \" + arg,\n}\n\nTOOL_DESC = \"\"\"\nTu as acces aux outils suivants :\n- datetime : donne la date et l heure\n- shell <commande> : execute une commande systeme\n- file_read <chemin> : lit un fichier\n- file_write <chemin>|<contenu> : ecrit dans un fichier\n- web_search <requete> : recherche sur le web\nPour utiliser un outil, reponds : TOOL: nom_outil argument\n\"\"\"<\/code><\/pre>\n<h2>Etape 3 \u2014 La boucle agent<\/h2>\n<pre><code>from llama_cpp import Llama\n\nllm = Llama(model_path=\"qwen2.5-3b-instruct-q4_k_m.gguf\", n_ctx=2048)\n\ndef run_agent(task, max_steps=5):\n    history = []\n    system = f\"Tu es un agent IA autonome. {TOOL_DESC}\"\n    \n    for step in range(max_steps):\n        prompt = f\"[SYSTEM] {system}\\n[TASK] {task}\\n\"\n        for h in history:\n            prompt += f\"[STEP {h['step']}] {h['action']}\\n[RESULT] {h['result']}\\n\"\n        prompt += f\"[STEP {step+1}] Que fais-tu ?\\n\"\n        \n        response = llm(prompt, max_tokens=256, stop=[\"\\n[STEP\"])\n        text = response[\"choices\"][0][\"text\"].strip()\n        \n        if text.startswith(\"TOOL:\"):\n            tool_line = text[5:].strip()\n            tool_name = tool_line.split()[0]\n            tool_arg = tool_line[len(tool_name):].strip()\n            if tool_name in TOOLS:\n                result = TOOLS[tool_name](tool_arg)\n            else:\n                result = f\"Outil {tool_name} inconnu\"\n        elif \"DONE\" in text or \"termine\" in text.lower():\n            return text\n        else:\n            result = text\n        \n        history.append({\"step\": step+1, \"action\": text, \"result\": str(result)[:500]})\n    \n    return \"Agent termine apres \" + str(max_steps) + \" etapes\"\n\n# Test\nprint(run_agent(\"Quelle heure est-il et cree un fichier rapport.txt avec la date\"))<\/code><\/pre>\n<h2>Etape 4 \u2014 Ajouter des vrais outils<\/h2>\n<p>Gmail, calendrier, Slack, base de donnees \u2014 chaque outil est une simple fonction Python. L agent apprend a les utiliser grace aux descriptions dans le prompt systeme. Plus vous ajoutez d outils, plus l agent devient capable.<\/p>\n<h2>Notre experience : AgentBMax<\/h2>\n<p>Nous avons construit AgentBMax avec exactement cette architecture. Il tourne sur un <a href='\/recommends\/mini-pc-ia\/'>mini PC a 300 euros<\/a> avec 8 Go de RAM, sans GPU, et gere nos 5 sites e-commerce au quotidien. Preuve que l IA autonome est accessible a tous.<\/p>\n<p>\ud83d\udc49 <a href='\/recommends\/mini-pc-ia\/'>Mini PC pour votre agent<\/a> | <a href='\/recommends\/ram-ddr5\/'>RAM 32 Go pour plus d outils<\/a> | <a href='\/recommends\/ssd-nvme\/'>SSD rapide pour les donnees<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un agent IA est un programme qui utilise un LLM pour raisonner et executer des actions de facon autonome. Contrairement a un chatbot qui repond passivement, un agent peut envoyer des emails, naviguer sur le web, executer du code et gerer des fichiers. Voici comment en construire un from scratch. Architecture d un agent Un [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":111,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guides-pratiques"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Guide : Creer votre premier agent IA autonome en Python - Blue Dolomites Shop<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/shop.bluedolomites.com\/es\/guide-creer-votre-premier-agent-ia-autonome-en-python\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Guide : Creer votre premier agent IA autonome en Python - Blue Dolomites Shop\" \/>\n<meta property=\"og:description\" content=\"Un agent IA est un programme qui utilise un LLM pour raisonner et executer des actions de facon autonome. Contrairement a un chatbot qui repond passivement, un agent peut envoyer des emails, naviguer sur le web, executer du code et gerer des fichiers. Voici comment en construire un from scratch. Architecture d un agent Un [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/shop.bluedolomites.com\/es\/guide-creer-votre-premier-agent-ia-autonome-en-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Blue Dolomites Shop\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-30T13:36:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/img-shopbluedolomites-88.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"533\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Guide : Creer votre premier agent IA autonome en Python\",\"datePublished\":\"2026-05-30T13:36:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/\"},\"wordCount\":229,\"publisher\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/shop.bluedolomites.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/img-shopbluedolomites-88.jpg\",\"articleSection\":[\"Guides Pratiques\"],\"inLanguage\":\"es\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/\",\"url\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/\",\"name\":\"Guide : Creer votre premier agent IA autonome en Python - Blue Dolomites Shop\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/shop.bluedolomites.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/img-shopbluedolomites-88.jpg\",\"datePublished\":\"2026-05-30T13:36:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/shop.bluedolomites.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/img-shopbluedolomites-88.jpg\",\"contentUrl\":\"https:\\\/\\\/shop.bluedolomites.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/img-shopbluedolomites-88.jpg\",\"width\":800,\"height\":533},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/guide-creer-votre-premier-agent-ia-autonome-en-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/shop.bluedolomites.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Guide : Creer votre premier agent IA autonome en Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/#website\",\"url\":\"https:\\\/\\\/shop.bluedolomites.com\\\/\",\"name\":\"Blue Dolomites Shop\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/shop.bluedolomites.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/#organization\",\"name\":\"Blue Dolomites Shop\",\"url\":\"https:\\\/\\\/shop.bluedolomites.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/shop.bluedolomites.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/logo-bd.png\",\"contentUrl\":\"https:\\\/\\\/shop.bluedolomites.com\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/logo-bd.png\",\"width\":540,\"height\":59,\"caption\":\"Blue Dolomites Shop\"},\"image\":{\"@id\":\"https:\\\/\\\/shop.bluedolomites.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Guide : Creer votre premier agent IA autonome en Python - Blue Dolomites Shop","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/shop.bluedolomites.com\/es\/guide-creer-votre-premier-agent-ia-autonome-en-python\/","og_locale":"es_ES","og_type":"article","og_title":"Guide : Creer votre premier agent IA autonome en Python - Blue Dolomites Shop","og_description":"Un agent IA est un programme qui utilise un LLM pour raisonner et executer des actions de facon autonome. Contrairement a un chatbot qui repond passivement, un agent peut envoyer des emails, naviguer sur le web, executer du code et gerer des fichiers. Voici comment en construire un from scratch. Architecture d un agent Un [&hellip;]","og_url":"https:\/\/shop.bluedolomites.com\/es\/guide-creer-votre-premier-agent-ia-autonome-en-python\/","og_site_name":"Blue Dolomites Shop","article_published_time":"2026-05-30T13:36:28+00:00","og_image":[{"width":800,"height":533,"url":"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/img-shopbluedolomites-88.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/#article","isPartOf":{"@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/"},"author":{"name":"","@id":""},"headline":"Guide : Creer votre premier agent IA autonome en Python","datePublished":"2026-05-30T13:36:28+00:00","mainEntityOfPage":{"@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/"},"wordCount":229,"publisher":{"@id":"https:\/\/shop.bluedolomites.com\/#organization"},"image":{"@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/#primaryimage"},"thumbnailUrl":"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/img-shopbluedolomites-88.jpg","articleSection":["Guides Pratiques"],"inLanguage":"es"},{"@type":"WebPage","@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/","url":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/","name":"Guide : Creer votre premier agent IA autonome en Python - Blue Dolomites Shop","isPartOf":{"@id":"https:\/\/shop.bluedolomites.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/#primaryimage"},"image":{"@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/#primaryimage"},"thumbnailUrl":"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/img-shopbluedolomites-88.jpg","datePublished":"2026-05-30T13:36:28+00:00","breadcrumb":{"@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/#primaryimage","url":"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/img-shopbluedolomites-88.jpg","contentUrl":"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/img-shopbluedolomites-88.jpg","width":800,"height":533},{"@type":"BreadcrumbList","@id":"https:\/\/shop.bluedolomites.com\/guide-creer-votre-premier-agent-ia-autonome-en-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/shop.bluedolomites.com\/"},{"@type":"ListItem","position":2,"name":"Guide : Creer votre premier agent IA autonome en Python"}]},{"@type":"WebSite","@id":"https:\/\/shop.bluedolomites.com\/#website","url":"https:\/\/shop.bluedolomites.com\/","name":"Blue Dolomites Shop","description":"","publisher":{"@id":"https:\/\/shop.bluedolomites.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/shop.bluedolomites.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/shop.bluedolomites.com\/#organization","name":"Blue Dolomites Shop","url":"https:\/\/shop.bluedolomites.com\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/shop.bluedolomites.com\/#\/schema\/logo\/image\/","url":"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/logo-bd.png","contentUrl":"https:\/\/shop.bluedolomites.com\/wp-content\/uploads\/2026\/05\/logo-bd.png","width":540,"height":59,"caption":"Blue Dolomites Shop"},"image":{"@id":"https:\/\/shop.bluedolomites.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":0,"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/media\/111"}],"wp:attachment":[{"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shop.bluedolomites.com\/es\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}