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_denyevents
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
| Parameter | Type | Description |
|---|---|---|
tool | str | Tool name (used for policy matching) |
action | str | Action name or HTTP method |
tool_url | str | Target URL |
method | str | HTTP method |
reasoning | str | Why the agent is making this call |
task_id | str | Task or workflow identifier |
params | dict | Query parameters |
body | dict | Request body |
headers | dict | Additional 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.