Home›Practice
Practice
Practice
Hands-on guides and first-hand notes on agent frameworks, skills and AI tools.
Total 217
Vision Agents with smolagentssmolagents vision agents inject images two ways: pass task_images up front for static verification, or wire a step_callback that saves browser screenshots into memory so a VLM can watch the task unfold while browsing.Building Agentic RAG Systems with smolagentsWrap retrievers as smolagents tools and hand retrieval planning to the agent: query reformulation, multi-step search, reranking, and validation turn static RAG into an iterative, self-correcting loop.Tool Calling Agents in smolagentssmolagents' ToolCallingAgent expresses actions as JSON tool calls rather than code: strict, provider-friendly, and best suited to simple systems, while CodeAgent remains the framework's default for anything needing variables or control flow.Building an agent without a frameworkHand-writing an agent without a framework: packing tool descriptions and the Thought-Action-Observation cycle into a system prompt, cutting hallucinated observations with a stop sequence, executing functions manually, and re-prompting.Messages and special tokens: how agents assemble promptsHow chat messages become model prompts: the system, user, and assistant roles, the special-token differences across model families, ChatML templates, and apply_chat_template in transformers.Fine-tuning with ms-swiftGetting started with ms-swift: a 10-minute self-cognition fine-tune of Qwen3-4B on one RTX 3090, LoRA parameters explained line by line, then inference validation, merge-lora with vLLM acceleration, and pushing to ModelScope.Ollama FAQ: model paths, ports and memoryThe Ollama local deployment FAQ as a working checklist: checking context windows and GPU residency, relocating model files, opening ports and origins, and tuning keep_alive with the concurrency knobs.Structured outputs with OllamaConstraining local models with Ollama's structured outputs: json mode versus full JSON schemas, the Pydantic and Zod generate-validate loop, nested extraction fields, and deterministic image descriptions.Tool calling with OllamaOllama's tool-calling forms end to end: single-shot calls with result pass-back, parallel multi-tool dispatch, agent loops with termination conditions, and accumulating streamed fields chunk by chunk.Using Ollama's OpenAI-compatible APIOllama's OpenAI compatibility layer in practice: cloud and local entry points, one protocol across three languages, per-endpoint support lists, and the two common adaptation points — context size and default model names.Guardrails in LangChain: Filtering Sensitive Data and Unsafe OutputUse LangChain guardrails to redact or block personal data, require human approval for sensitive tools, and add custom before- and after-agent checks layered in middleware.Long-Term Memory in LangChain AgentsGive a LangChain agent long-term memory with a LangGraph store, organized by namespace and key, read and written from tools, and set up with PostgreSQL dependencies.Building a Voice Agent with LangChainBuild a voice agent with a streaming speech-to-text, LangChain agent, and text-to-speech pipeline, and learn the trade-offs against speech-to-speech models.Message Types in LangChainLearn LangChain's message objects: what SystemMessage, HumanMessage, AIMessage and ToolMessage do, how content blocks and multimodal input are structured, and how streamed chunks are combined.Using Chat Models in LangChainUse LangChain's init_chat_model to set up chat models from many providers, tune parameters and retries, call models with invoke, stream and batch, bind tools, and connect to OpenAI-compatible servers such as vLLM.Teaching a model function calling with LoRA fine-tuningFunction calling lets a model act through structured tool calls, learned through fine-tuning. This guide shows the conversation format, the three training steps, and how LoRA adds a small trainable adapter.Agent observability and evaluation: traces, metrics and testsObservability records what an AI agent does through traces, spans and metrics. Offline and online evaluation then show whether it works and how to improve it before and after launch.LangGraph building blocks: state, nodes and edgesLangGraph runs an LLM application as a graph of nodes, edges and shared state. This guide builds a small conditional graph and explains when control matters more than freedom.LlamaIndex Workflows: steps, events and multi-agent systemsLlamaIndex Workflows organise code into steps triggered by events, with state and multi-agent handoffs. This guide builds single-step, looping and multi-agent workflows.LlamaIndex core components: building a RAG pipelineLlamaIndex splits retrieval-augmented generation into loading, indexing, storage, querying and evaluation components. This guide chains them into a document question-answering pipeline.Deploying MiniCPM-o 2.6 with FastAPIWrap the MiniCPM-o 2.6 multimodal model in a local FastAPI server, then send image, multi-turn, multi-image and video requests with Python requests.GRPO reinforcement-learning fine-tuning of Qwen3Fine-tune Qwen3-8B with GRPO reinforcement learning using Unsloth: write reward functions, run training, save LoRA weights, and log experiments with SwanLab.Deploying Qwen2.5-Coder with vLLMDeploy Qwen2.5-Coder-7B-Instruct with vLLM: run offline inference, serve an OpenAI-compatible API, call it with curl, and compare throughput with Transformers.Running gpt-oss-20b locally with LM StudioRun the gpt-oss-20b model on your own computer with LM Studio, call it through a local OpenAI-compatible API, and connect tools through MCP.