Skip to main content

Claude Agent SDK

Integrate AgentSuite with the Claude Agent SDK via the Virtue Gateway for full protection: MCP Guard, AgentGuard, and Access Control — with full session tracing and observability in the dashboard.

Installation

pip install agentsuite-sdk[claude]

How It Works

  • adapter.options() — returns a dict to spread into ClaudeAgentOptions(...), wiring up the MCP server and gateway hooks.
  • adapter.record_query(message) — call before each sdk.query() to track the user message (no automatic hook available in Claude Agent SDK).

Quickstart

from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient
from agentsuite import GatewayClient

client = GatewayClient(url="...", api_key="sk-vai-...")
adapter = client.claude()

options = ClaudeAgentOptions(
**adapter.options(),
model="claude-sonnet-4-5",
max_turns=10,
)

async with ClaudeSDKClient(options=options) as sdk:
user_message = "What are my open tickets?"

adapter.record_query(user_message)
await sdk.query(user_message)

async for event in sdk.receive_response():
...

Full runnable example: demo_claude.py

Example Output

The agent responds to the query and prints the session ID:

Claude demo terminal output

View the full session trace in the VirtueAgent dashboard (Observability → Sessions):

VirtueAgent Sessions tab: session overview and execution trace

Environment Variables

VariableDescription
VIRTUE_GATEWAY_URLGateway MCP endpoint URL
VIRTUE_API_KEYVirtueAI API key
ANTHROPIC_API_KEYAnthropic API key
CLAUDE_MODELModel name (default: claude-sonnet-4-5)