Docs

Get your LangChain or LangGraph agents reporting into agentwach in under five minutes.

STEP 01

Create a workspace

Sign up — a workspace and starter API key are provisioned automatically. Find your key in Settings → API Keys.

STEP 02

POST events to the ingest endpoint

Send any agent event with your API key in the x-api-key header. The endpoint accepts two kinds: event (agent activity) and message (inter-agent communication).

POST /api/public/ingest
x-api-key: as_xxxxxxxxxxxxxxxx
Content-Type: application/json

{
  "kind": "event",
  "agent": { "external_id": "search_alpha", "name": "Search Agent", "type": "langgraph" },
  "status": "running",
  "current_task": "scraping SEC filings",
  "event": { "type": "tool_call", "name": "web_search", "data": { "query": "NVDA Q4" } }
}
STEP 03

Or use the Python callback handler

Drop this handler into your existing LangChain pipeline. No re-architecting required.

import os, time, requests
from langchain.callbacks.base import BaseCallbackHandler

AGENTWACH_URL = "https://agentwach.com/api/public/ingest"
AGENTWACH_KEY = os.environ["AGENTWACH_API_KEY"]

class agentwachHandler(BaseCallbackHandler):
    def __init__(self, agent_name: str, agent_type: str = "langchain"):
        self.agent_name = agent_name
        self.agent_type = agent_type
        self.external_id = agent_name.lower().replace(" ", "_")

    def _post(self, body):
        requests.post(
            AGENTWACH_URL,
            headers={"x-api-key": AGENTWACH_KEY, "Content-Type": "application/json"},
            json=body, timeout=2,
        )

    def on_chain_start(self, serialized, inputs, **kwargs):
        self._post({
            "kind": "event",
            "agent": {"external_id": self.external_id, "name": self.agent_name, "type": self.agent_type},
            "status": "running",
            "current_task": str(inputs)[:120],
            "event": {"type": "chain_start", "name": serialized.get("name"), "data": inputs},
        })

    def on_chain_end(self, outputs, **kwargs):
        self._post({
            "kind": "event",
            "agent": {"external_id": self.external_id, "name": self.agent_name, "type": self.agent_type},
            "status": "idle",
            "event": {"type": "chain_end", "data": outputs},
        })

    def on_tool_start(self, serialized, input_str, **kwargs):
        self._post({
            "kind": "event",
            "agent": {"external_id": self.external_id, "name": self.agent_name, "type": self.agent_type},
            "status": "running",
            "current_task": f"tool: {serialized.get('name')}",
            "event": {"type": "tool_call", "name": serialized.get("name"), "data": {"input": input_str}},
        })

# Send a message from one agent to another
def send_message(from_name, to_name, content):
    requests.post(AGENTWACH_URL, headers={"x-api-key": AGENTWACH_KEY},
        json={"kind": "message", "from": from_name, "to": to_name, "content": content})
STEP 04

Watch it flow

Open the dashboard. Agents appear as soon as their first event arrives. Status, current task, and message stream update live.

STEP 05

Know your plan limits

Every event sent to /api/public/ingest counts toward your monthly quota. Once you exceed your plan, overage is billed at $5 per 100k events.

PlanEvents / moRetentionWorkspaces
Free10k14 days1
Hobby50k30 days1
Pro500k90 days3
Team2M1 year10
EnterpriseCustomCustomUnlimited

Batch low-value events client-side to stay within quota. See pricing for the full breakdown.

Authentication

Every ingest request must include your workspace API key in the x-api-key header — this is the single header used across REST, OTLP, and SDK transports. Keys are scoped to a single workspace. Rotate from Settings → API Keys — old keys keep working for 60 seconds to drain in-flight requests.

Never embed keys in client-side bundles. Use a server-side proxy or pass the key from your agent runtime's secret store.

Guardrails & security

Every event runs through three layers before it's stored:

  • Rate & loop detection — repeat-event ceiling per window.
  • Token / cost ceilings — hourly token cap and daily $ cap per agent.
  • Prompt-injection scanner — 15+ regex rules; hits create warnings.

When a guardrail trips, the ingest response includes { guardrail: { stop, reason, limit } }. Your agent should halt or back off. Try the scanner live at /playground.

SDKs & frameworks

First-class adapters for LangGraph, CrewAI, AutoGen, Mastra, Vercel AI SDK, OpenAI Agents, and LlamaIndex — plus a raw HTTP recipe for anything else.

Browse the SDK directory →

Troubleshooting

401 Unauthorized
Missing or invalid x-api-key header. Verify the key in Settings → API Keys.
429 Too Many Requests
You've hit your monthly event quota or a per-second burst limit. Upgrade your plan or batch events.
Response includes guardrail.stop = true
An agent-level guardrail tripped. Your agent should stop the current run. Inspect the alarm in the dashboard.
Events delayed in dashboard
Ingest is async; expect < 2 s lag. If you see > 30 s, check /pulse for network status.