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 — calls are proxied to the original agent
result = smart_agent("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 recovery and retries automatically

Manual Step Recording

from zubbl.types import TaskStatus

tid = zubbl.start_trajectory("code_review")
zubbl.record_step(action="read_file", tool_name="file_reader", tool_output=content)
zubbl.record_step(action="analyze", tool_name="ast_parser", tool_output=analysis)
zubbl.end_trajectory(status=TaskStatus.SUCCESS)