from agentx import AgentX
from agentx.integrations.anthropic import patch_anthropic_client
import anthropic
client = AgentX.from_env()
ant = anthropic.Anthropic()
patch_anthropic_client(ant, tracer=client.tracer, name="claude-support-agent")
def claude_agent(case):
with client.tracer.trace("claude-support-agent-call", framework="anthropic", sync=True, monitor=False) as span:
msg = ant.messages.create(
model="claude-haiku-4-5-20251001",
max_tokens=1024,
system="You are a helpful customer support agent.",
messages=[{"role": "user", "content": case.query}],
)
span.output = msg.content[0].text
return {
"output": msg.content[0].text,
"metadata": {"model": msg.model},
"trace_id": span.trace_id,
}