Skip to main content

SDK — Observe Mode

Observe mode wraps your agent's tool calls and sends telemetry to AgenticGuard without blocking any calls. Use this to understand what your agent does before enforcing policies.

Install​

pip install agentic-guard-sdk

Basic usage​

from agentic_guard import AgenticGuard

gate = AgenticGuard(
api_key="ag_xxxxxxxxxxxx",
base_url="https://api.agentic-guard.com",
mode="observe", # default
)

# Wrap a tool call
result = gate.call(
tool="github",
action="get_repo",
tool_url="https://api.github.com/repos/openai/openai-python",
method="GET",
reasoning="Checking repo stats for analysis",
task_id="task_001",
)

In observe mode:

  • All calls are allowed regardless of policy
  • Every call is logged to the audit trail
  • Policy matches are recorded as would_deny events

With the convenience wrappers​

from agentic_guard import AgenticGuard
from agentic_guard.wrappers import GitHubWrapper

gate = AgenticGuard(api_key="ag_xxx", mode="observe")
github = GitHubWrapper(gate, task_id="research_task_1")

repo = github.get_repo("openai/openai-python", reasoning="Checking dependencies")
issues = github.list_issues("openai/openai-python", state="open")

Configuration options​

gate = AgenticGuard(
api_key="ag_xxxxxxxxxxxx", # required
base_url="https://...", # required
mode="observe", # "observe" or "enforce"
timeout=30, # seconds, default 30
default_task_id="workflow_xyz", # applied to all calls if set
)

Call parameters​

ParameterTypeDescription
toolstrTool name (used for policy matching)
actionstrAction name or HTTP method
tool_urlstrTarget URL
methodstrHTTP method
reasoningstrWhy the agent is making this call
task_idstrTask or workflow identifier
paramsdictQuery parameters
bodydictRequest body
headersdictAdditional headers

Viewing logs​

All calls appear in the Audit Log tab in the dashboard. You can filter by agent, tool, decision, and date range.

Moving to enforce mode​

Once you've reviewed the observe logs and written appropriate policies, switch to enforce mode:

gate = AgenticGuard(api_key="ag_xxx", mode="enforce")

See SDK Enforce Mode → for details.