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

推荐订阅源

博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
博客园_首页
C
Check Point Blog
小众软件
小众软件
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta
美团技术团队
Martin Fowler
Martin Fowler
Vercel News
Vercel News
D
Docker
罗磊的独立博客
B
Blog RSS Feed
The Cloudflare Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
雷峰网
雷峰网
博客园 - Franky

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
Stop Flying Blind: Add Audit Logs to Your AI Agent in 5 M...
pmestre-Forg · 2026-05-12 · via DEV Community

pmestre-Forge

The Problem Nobody Talks About

You ship an AI agent. It runs in production. Something goes wrong.

Now what? You dig through stdout logs, reconstruct what the LLM "decided," and try to figure out why it did that at that moment. It's painful — and most teams solve it by building a custom observability stack before they've even validated the product.

I ran into this exact wall while building botwire.dev, an agent infrastructure API. So I added Agent Audit Logs as a free primitive: a simple POST /logs/{agent_id} endpoint that gives every agent an immutable, timestamped activity trail — no setup required.

Here's how to wire it into your agent in about 5 minutes.


Setup

No SDK to install. Just your HTTP client of choice. If your agent already has an identity registered (also free):

import httpx

BASE_URL = "https://botwire.dev"
AGENT_ID = "my-trading-agent-v1"

Enter fullscreen mode Exit fullscreen mode


Logging an Action

def log_action(action: str, reason: str, result: str = None, metadata: dict = None):
    payload = {
        "action": action,
        "reason": reason,
        "result": result,
        "metadata": metadata or {}
    }
    r = httpx.post(f"{BASE_URL}/logs/{AGENT_ID}", json=payload)
    return r.json()

# Example: log a trading decision
log_action(
    action="BUY NVDA",
    reason="RSI oversold + ADX trending + MACD crossover confirmed",
    result="order_placed",
    metadata={"confidence": 0.82, "price": 118.40, "signal_id": "sig_8x2k"}
)

Enter fullscreen mode Exit fullscreen mode

That's it. The entry is written, timestamped server-side, and immutable. You get 100 free writes per day per agent.


Reading It Back

def get_audit_trail(limit: int = 50):
    r = httpx.get(f"{BASE_URL}/logs/{AGENT_ID}", params={"limit": limit})
    for entry in r.json()["logs"]:
        print(f"[{entry['timestamp']}] {entry['action']}{entry['reason']}")

get_audit_trail()

Enter fullscreen mode Exit fullscreen mode

[2025-05-11T14:32:01Z] BUY NVDA — RSI oversold + ADX trending + MACD crossover confirmed
[2025-05-11T14:28:44Z] SKIP TSLA — confidence below threshold (0.51)
[2025-05-11T13:01:22Z] HOLD AAPL — no signal consensus

Enter fullscreen mode Exit fullscreen mode

When something breaks, you have a clean chain of custody: what the agent decided, why, and what happened.


Pair It With Other Primitives

The audit log works well alongside the rest of the platform:

  • Agent Memory — store state between runs ($0.001/read, $0.002/write)
  • Trading Signals — BUY/SELL/HOLD with RSI, MACD, ADX confidence scores
  • Agent Notifications — subscribe to market_open/market_close events, poll GET /notify/check/{agent_id}
  • Agent Config Store — 50 free key-value entries per agent for schedules, rules, flags

Micropayments on the paid endpoints run via x402 over USDC on Base L2 — sub-cent pricing, no subscription required.


Pricing

Operation Cost
Write log entry FREE (100/day)
Read audit trail FREE

No credit card. No rate-limit surprises for the free tier.


Why I Built This

Most agent infrastructure is either "roll your own" or "pay for a full observability platform." I wanted something in between — lightweight primitives you can compose without lock-in.

The whole stack is FastAPI + SQLite + Python, MIT licensed, and self-hostable if you'd rather own it.

GitHub: github.com/pmestre-Forge/signal-api