~/beer-and-code
▪ Clã Beer and Code the largest AI Engineering community in Brazil · live, every week join the Clã ›
~ / tutorials $ ls -la

Tutorials

Practical step-by-step guides on Laravel, Filament, and the PHP ecosystem.

26 tutorials
13 #ai-agents · #llm
LLM Intent Classification: How the Agent Decides Which Route to Take

The agent decides on its own which flow to use, but nobody can explain why it picked the wrong one yesterday at 2 p.m. Deterministic router vs. LLM router, intent classification with a closed schema and evidence, an explicit fallback policy, trace attributes to audit the decision, and how to measure routing accuracy without hand-labeling ten thousand conversations.

02 Sep · 17 min ›
14 #ia · #api
JSON That Doesn't Break: LLM Structured Output Without a Defensive Parser

If your code has a try/catch wrapped around a json_decode of the model's response, you don't have a contract. You have hope. How to get truly guaranteed structured output from an LLM: constrained decoding at the provider, a schema the model can satisfy, semantic validation and retry with a fixed budget, with no infinite loop and no defensive parser.

02 Sep · 16 min ›
15 #ai-agents · #cache
What an AI Agent Costs in Production: The Real Token Bill

Your prototype cost R$ 12 on day one. In production, with 200 users, it costs almost R$ 4,000 a month. We open up the token bill of a real agent layer by layer (system prompt, tool definitions, RAG chunks, history, tool results) and show where almost 80% of the money disappears. In the end, prompt compression, history pruning, and context selection cut the bill by 73%, with the before-and-after spreadsheet.

01 Sep · 13 min ›
16 #ia · #produto-ia
Oracle Generative AI: Which Models OCI Has and When to Choose It Over Bedrock

The third LLM infrastructure provider already has a São Paulo region, a catalog with Grok 4.3, Gemini 2.5, Llama 4, and Cohere Command A, and bills per character instead of per token. The real Oracle Generative AI catalog, how to call the service with the OpenAI SDK, the dedicated cluster math, and the objective criteria for deciding between OCI and Bedrock.

01 Sep · 13 min ›
17 #ai-agents · #llm
LangGraph, Mem0, LangChain, MCP: What You Actually Need

An honest map of the agent orchestration and memory ecosystem. What LangGraph, Mem0, LangChain and MCP actually do, the point where each one stops being overhead, and the 5-question decision tree to run before installing anything.

01 Sep · 15 min ›
18 #ia · #produto-ia
AWS Bedrock: What It Is and How to Run Claude in Production with Governance (and the Bill in Reais)

AWS documents how to turn on Bedrock really well. Nobody documents the rest: the difference between CloudTrail and model invocation logging, the fact that São Paulo doesn't give you data residency, and what shows up on the bill in reais at the end of the month. A practical guide to Claude in production on AWS Bedrock: model IDs, inference profiles, the four governance layers and the full cost breakdown for an internal agent.

27 Aug · 15 min ›
19 #ia · #produto-ia
OpenRouter: What It Is, How to Use It, and When It's Worth It

One OpenAI-compatible endpoint for hundreds of models, with automatic fallback between providers. What OpenRouter is, how to call it from curl, Python, and PHP, how to control routing, provider, and cost caps, and the scenarios where this extra layer hurts more than it helps.

25 Aug · 9 min ›
20 #laravel · #php
Laravel AI SDK vs Prism PHP: Which One to Use in Each Case

The internet treats the Laravel AI SDK and Prism PHP as competitors and keeps repeating that the official SDK uses Prism under the hood. The composer.json says otherwise. In this post: what each package actually does, the code side by side, the table of what only exists in one of them, the release cadence of both, and a decision guide by concrete case. No "it depends".

20 Aug · 4 min ›
21 #laravel · #php
What Is the Laravel AI SDK: A Practical Guide to Laravel's Native AI SDK

The Laravel AI SDK is Laravel's first-party AI package: agents as PHP classes, tool calling, structured output, streaming, embeddings with pgvector and fakes for testing without burning tokens. A practical guide from composer require to your first running agent, covering what the SDK solves, what it doesn't, and the limitations nobody tells you about.

18 Aug · 5 min ›
22 #cache · #contexto
How to Save Tokens in Claude Code, Codex, and Cursor: Stop Breaking the Cache

You send a one-line question and /usage reports a whole day's worth of consumption. Saving tokens in a coding assistant has nothing to do with prompt size: it's about prefix caching. How it works in Claude Code, Codex, and Cursor, the seven actions that invalidate it without you noticing, how to measure it with cache_read vs cache_creation, and eight levers to stretch the session.

06 Aug · 16 min ›
23 #openai · #boas-praticas
10 Codex Best Practices (Straight from the Official Documentation)

We combed through the new official Codex documentation (learn.chatgpt.com) and boiled it down to the 10 best practices OpenAI itself recommends: outcome-first prompting, a living AGENTS.md, restrictive permissions, model selection, skills, cloud, and automation.

26 Jul · 8 min ›
24 #ia · #llm
How to Run an LLM Locally: Step by Step with Ollama in 2 Commands (No GPU)

A step-by-step guide to running an LLM locally with Ollama: install it, run qwen3:8b in 2 commands, and plug it into your code through the OpenAI-compatible endpoint. It runs on 8 GB of RAM with no GPU required. As a bonus, the VRAM math by model size and when local beats the API.

22 Jul · 9 min ›
Meet the Clã Beer and Code
playing