Skip to content

Wrap Your Agent

The simplest way to integrate Zubbl — wrap any callable agent.

Basic Wrapping

from zubbl import ZubblClient

zubbl = ZubblClient(api_key="zubbl_xxx")

# Wrap any callable
smart_agent = zubbl.wrap(my_agent)

# Use exactly like before
result = smart_agent.run("Review this pull request")

What Wrapping Does

  1. Before execution — queries Zubbl for policy recommendations
  2. During execution — records steps, tools used, tokens, latency
  3. After execution — ingests the trajectory for learning
  4. On failure — triggers reflexion and retries automatically

Custom Step Recording

with zubbl.trace("code_review") as trace:
    trace.step("read_file", tool="file_reader", output=content)
    trace.step("analyze", tool="ast_parser", output=analysis)
    trace.complete(status="success")