惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
H
Help Net Security
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Full Disclosure
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
Cisco Talos Blog
Cisco Talos Blog
I
InfoQ
T
Tenable Blog
T
Tor Project blog
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
博客园 - 叶小钗
B
Blog
V
V2EX
Jina AI
Jina AI
L
LangChain Blog
月光博客
月光博客
W
WeLiveSecurity
U
Unit 42
AWS News Blog
AWS News Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 聂微东
V
Visual Studio Blog
A
Arctic Wolf
T
Tailwind CSS Blog
The Cloudflare Blog
SecWiki News
SecWiki News
S
SegmentFault 最新的问题
Hacker News - Newest:
Hacker News - Newest: "LLM"
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Securelist
www.infosecurity-magazine.com
www.infosecurity-magazine.com
腾讯CDC
雷峰网
雷峰网

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How I Built My First Real AI Agent with DeepSeek — A Bootcamp Grad's Guide...
RileyKim · 2026-06-14 · via DEV Community

So here's what happened: how I Built My First Real AI Agent with DeepSeek — A Bootcamp Grad's Guide for 2026

I had no idea what I was getting into when I first heard about AI agents. Seriously, six months ago I thought ChatGPT just... answered questions. That's it. One prompt in, one response out, done. Then someone at my bootcamp showed me a demo where an AI was booking flights, checking calendars, and sending emails — all by itself. I was shocked. My whole mental model of what LLMs could do just shattered.

So I went down a rabbit hole. I read blog posts. I watched way too many YouTube tutorials. And eventually I built my own working agent using DeepSeek's models through Global API. This is everything I learned along the way, written for people like me who are still figuring this stuff out.


Wait, What Even IS an AI Agent?

Okay, so the simplest way I can explain it: a regular chatbot is like asking a really smart friend a single question. An AI agent is like giving that friend a goal and watching them figure out how to accomplish it step by step.

Here's the comparison that finally made it click for me:

Normal Chatbot AI Agent
You ask one question, you get one answer You give a goal, it plans multiple steps to get there
Doesn't remember anything between sessions Keeps track of what it's done and what's left
Can't do anything in the real world Can call APIs, search the web, read files
One shot and you're done Thinks through the problem, checks its work, tries again

A real example that blew my mind: instead of just asking "what's the weather in Beijing right now" and getting a text reply, an agent would actually figure out it needs to hit a weather API, make the call, read the response, and then turn that data into something a human would actually want to hear.

DeepSeek's models — specifically deepseek-v4-flash and deepseek-reasoner — handle this stuff natively through something called function calling. That's the secret sauce.


Getting Set Up (The Part I Always Skip and Then Regret)

Before you can build anything cool, you need an API key. I grabbed mine from Global API — it's just a 32-character hexadecimal string, nothing fancy. If you're going to follow along with my code, you'll need one too.

For Python folks:

pip install openai httpx

And here's the basic client setup that I use for literally everything now:

from openai import OpenAI

# Point this at Global API's proxy endpoint
client = OpenAI(
    api_key="YOUR_DEEPSEEK_API_KEY",
    base_url="https://global-apis.com/v1"
)

def chat(messages: list[dict], model: str = "deepseek-v4-flash") -> str:
    """Send a chat request to DeepSeek through Global API."""
    response = client.chat.completions.create(
        model=model,
        messages=messages,
        temperature=0.7,
        max_tokens=2048
    )
    return response.choices[0].message.content

# Quick sanity check
messages = [{"role": "user", "content": "Say hello in one sentence."}]
print(chat(messages))

If you're more of a JavaScript person, here's the same thing in Node:

// my_first_agent/client.js
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_DEEPSEEK_API_KEY',
  baseURL: 'https://global-apis.com/v1'
});

async function chat(messages, model = 'deepseek-v4-flash') {
  const response = await client.chat.completions.create({
    model,
    messages,
    temperature: 0.7,
    max_tokens: 2048
  });
  return response.choices[0].message.content;
}

// Quick sanity check
const messages = [{ role: 'user', content: 'Say hello in one sentence.' }];
console.log(await chat(messages));

Honestly, this part alone saved me hours of debugging. Using Global API's base URL means I don't have to worry about regional routing or weird authentication quirks — it just works.


Function Calling: The Actual Magic Part

This is where I spent the most time staring at my screen going "wait, how does it know to do that?" Function calling is basically a way for the model to say "hey, I need you to run this specific function with these specific arguments" instead of just spitting out text.

Here's the flow in plain English:

  1. User asks something like "what's Bitcoin at right now?"
  2. The model looks at its available tools and decides "I need the get_bitcoin_price tool"
  3. It returns a structured JSON response saying exactly which tool to call and what to pass in
  4. Your code runs that tool (probably an API call)
  5. You feed the result back to the model
  6. The model turns that raw data into a human-friendly answer

When I first saw this working I actually said "whoa" out loud. Like, the model wasn't just hallucinating a price — it was asking my code to fetch a real one. That's the difference between a chatbot and an agent.


Letting the Agent Run in a Loop

Okay so here's where things get spicy. The real power of agents isn't a single function call — it's chaining them together. The model needs to be able to:

  • Look at the conversation so far
  • Decide if it needs more information
  • Pick the right tool if it does
  • Evaluate the result
  • Keep going until the original goal is solved

This is what people call the "agent loop" and honestly, writing one from scratch made me feel like a wizard. Here's the Python version I ended up with after a lot of trial and error:

# my_first_agent/agent_loop.py
from openai import OpenAI
import json

client = OpenAI(
    api_key="YOUR_DEEPSEEK_API_KEY",
    base_url="https://global-apis.com/v1"
)

# These are the tools our agent knows how to use
tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get the current weather for a city",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {"type": "string", "description": "City name"}
                },
                "required": ["city"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "calculate",
            "description": "Evaluate a math expression",
            "parameters": {
                "type": "object",
                "properties": {
                    "expression": {"type": "string", "description": "Math expression"}
                },
                "required": ["expression"]
            }
        }
    }
]

def get_weather(city: str) -> str:
    # In real life this would hit a real API
    return f"It's currently 72°F and sunny in {city}"

def calculate(expression: str) -> str:
    return str(eval(expression))

def run_agent(user_message: str, max_steps: int = 5) -> str:
    messages = [{"role": "user", "content": user_message}]

    for step in range(max_steps):
        response = client.chat.completions.create(
            model="deepseek-v4-flash",
            messages=messages,
            tools=tools,
            tool_choice="auto"
        )

        message = response.choices[0].message
        messages.append(message)

        # If the model didn't call any tools, we're done
        if not message.tool_calls:
            return message.content

        # Otherwise, run each tool the model asked for
        for tool_call in message.tool_calls:
            function_name = tool_call.function.name
            arguments = json.loads(tool_call.function.arguments)

            if function_name == "get_weather":
                result = get_weather(**arguments)
            elif function_name == "calculate":
                result = calculate(**arguments)
            else:
                result = f"Unknown function: {function_name}"

            messages.append({
                "role": "tool",
                "tool_call_id": tool_call.id,
                "content": result
            })

    return "Agent hit max steps without finishing"

# Try it out
answer = run_agent("What's the weather in Tokyo and what's 15% of 847?")
print(answer)

The thing that took me forever to figure out? You have to feed the tool's result back to the model as a tool role message with the matching tool_call_id. Miss that and nothing works and you get cryptic errors. I lost an entire Saturday to that.


The Cost Thing Nobody Warned Me About

Okay, real talk — I burned through way too much of my bootcamp credits before I figured out pricing. So let me save you the trouble.

Here's the deal with DeepSeek's models (and yes, these are the actual numbers from Global API):

  • deepseek-v4-flash is the cheap one. Like, really cheap. Around $0.14 per million input tokens and $0.28 per million output tokens.
  • deepseek-reasoner is the smarter one. It actually thinks before it answers, which is wild to watch. But it costs more — about $0.55 per million input tokens and $2.19 per million output tokens.

I was shocked when I ran the numbers on my first agent. A complex multi-step task that used deepseek-reasoner maybe 20 times? Cost me less than a coffee. A few cents. Compare that to GPT-4o which runs $5.00 per million input and $10.00 per million output and you'll understand why I basically stopped using anything else.

Here's the thing though — you don't always need the smart model. For simple tool calls and routing decisions, deepseek-v4-flash is plenty good and way cheaper. My pattern now is: use the cheap one for the loop logic and only escalate to the reasoner when I'm dealing with a hard problem.


Why Global API's Routing Matters (A Section I Wish Existed When I Started)

So one of the things Global API does that I didn't appreciate at first is called "GA Fusion routing." I know, sounds like marketing nonsense. But it actually saved my bacon during a hackathon.

Basically, when you send a request through Global API's endpoint, it figures out the fastest and cheapest path to actually reach DeepSeek's servers. Sometimes that means routing through different regions or using cached responses when the same query has been made recently.

In practice this means:

  • Fewer timeouts when DeepSeek's servers are having a bad day
  • Sometimes you get a response back in under 200ms when you'd otherwise wait 2 seconds
  • Lower costs because you're not always paying for full inference on identical requests

I noticed this when I was stress-testing my agent with 100 simultaneous requests. Half my friends' setups were choking. Mine was fine. That was enough for me.


A Real Example That Actually Does Something Useful

Let me show you what I built for my bootcamp final project. It's a research agent that takes a topic, searches for it, summarizes what it finds, and writes a short report. It uses two tools: a search function and a note-taking function.

# research_agent/agent.py
from openai import OpenAI
import json

client = OpenAI(
    api_key="YOUR_DEEPSEEK_API_KEY",
    base_url="https://global-apis.com/v1"
)

tools = [
    {
        "type": "function",
        "function": {
            "name": "web_search",
            "description": "Search the web for information on a topic",
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {"type": "string"}
                },
                "required": ["query"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "save_note",
            "description": "Save a piece of information to the research notes",
            "parameters": {
                "type": "object",
                "properties": {
                    "fact": {"type": "string"},
                    "source": {"type": "string"}
                },
                "required": ["fact", "source"]
            }
        }
    }
]

notes = []

def web_search(query: str) -> str:
    # You'd plug in a real search API here
    fake_results = {
        "default": f"Three articles found about {query}: 'Introduction to {query}', '{query} explained', 'Why {query} matters in 2026'"
    }
    return fake_results.get("default", "No results")

def save_note(fact: str, source: str) -> str:
    notes.append({"fact": fact, "source": source})
    return "Note saved"

def research_agent(topic: str, max_steps: int = 8) -> str:
    messages = [
        {"role": "system", "content": f"You are a research assistant. Your goal is to gather 5 useful facts about: {topic}. Use web_search to find information and save_note to store each fact with its source. When you have 5 notes, write a summary."},
        {"role": "user", "content": f"Research this topic: {topic}"}
    ]

    for step in range(max_steps):
        response = client.chat.completions.create(
            model="deepseek-reasoner",
            messages=messages,
            tools=tools,
            tool_choice="auto"
        )

        message = response.choices[0].message
        messages.append(message)

        if not message.tool_calls:
            return message.content

        for tool_call in message.tool_calls:
            fn = tool_call.function.name
            args = json.loads(tool_call.function.arguments)

            if fn == "web_search":
                result = web_search(**args)
            elif fn == "save_note":
                result = save_note(**args)
            else:
                result = "Unknown tool"

            messages.append({
                "role": "tool",
                "tool_call_id": tool_call.id,
                "content": result
            })

    return f"Done. Collected {len(notes)} notes."

# Run it
report = research_agent("quantum computing")
print(report)
print("\nAll notes collected:")
for note in notes:
    print(f"- {note['fact']} (source: {note['source']})")

Watching this thing run is genuinely mesmerizing. The model searches, saves a fact, searches again with a more specific query, saves another fact, and keeps going until it has enough material. It feels like watching someone actually do research.


Mistakes I Made So You Don't Have To

Since this is supposed to be the stuff I wish someone had told me, here's a quick list of things that bit me:

  1. Forgetting to append the assistant message to the conversation history. The model needs to see what it said last time or it gets confused.

  2. Using tool_choice="auto" when I actually meant "required". Auto lets the model decide if it even needs a tool. Sometimes you want to force it.

  3. Not setting a max step limit. Without one, a confused agent can loop forever and rack up charges. Always cap it.

  4. Confusing tool_call_id. Every tool call has its own ID and you need to use the right one in your response. Mismatch = silent failure.

  5. Trying to parse JSON from regular text responses instead of using the function calling API properly. Just don't. Use the structured tools.


What's Next If You Want to Go Deeper

Once you've got a basic agent loop working, the world kind of opens up. Here are things I'm exploring now:

  • Multi-agent systems where one agent delegates to others
  • Memory layers that persist across conversations
  • Streaming responses so users don't wait for the whole agent to finish
  • Safety guardrails that prevent agents from calling dangerous tools

But honestly, if you're at the same stage I was a few months ago — just start with one tool, one loop, and one goal. Get that working. Then add complexity. That's how I learned and it's how every other bootcamp grad I know learned too.


Final Thoughts

Look, I'm not going to pretend I'm an AI expert now. I'm not. But I went from "what's an LLM" to "I built an agent that does my research for me" in about six weeks. The tools are there. The pricing is absurdly good (especially if you go through Global API). The only thing standing between you and a working agent is actually sitting down and writing the code.

If you want to mess around with this yourself, Global API is what I used and I'd recommend checking it out. They have a dead-simple signup, the DeepSeek models work right out of the box, and their routing setup means you don't have to stress about reliability. That's it. That's the pitch. Go build something weird.