A sample project integrating Datadog LLM Observability into a LangGraph-based agent.
An agent that researches user questions via web search, summarizes the results, and sends them to AWS SNS.
- LLM: Amazon Bedrock (Claude Sonnet 4.6)
- Framework: LangGraph
- Tools: Tavily Web Search / AWS SNS
- Observability: Datadog LLM Observability / APM
START → agent → tools → agent → END
↑ |
└────────┘
agent: LLM decides whether to call a tooltools: Executes web search or SNS publish
Before setting up the project, prepare the following accounts and resources.
- Sign up at tavily.com
- Go to your dashboard and create an API key
- Copy the key — it will be used as
TAVILY_API_KEY
Create an IAM user or role with the following permissions:
AmazonBedrockFullAccess(or a scoped policy allowingbedrock:InvokeModel)AmazonSNSFullAccess(or a scoped policy allowingsns:Publishon your topic)
Generate an access key and secret for use as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
This project uses Claude Sonnet 4.6 via Amazon Bedrock in the us-west-2 region.
- Open the Amazon Bedrock console in
us-west-2 - Go to Model access and request access to Anthropic Claude Sonnet 4.6 (cross-region inference model ID:
us.anthropic.claude-sonnet-4-6) - Wait for access to be granted (usually instant)
aws sns create-topic --name langgraph-sample --region us-west-2Copy the returned TopicArn — it will be used as SNS_TOPIC_ARN.
Optionally, subscribe your email address to receive published messages:
aws sns subscribe \
--topic-arn <TopicArn> \
--protocol email \
--notification-endpoint your@email.comConfirm the subscription via the email that arrives.
- Log in to your Datadog account
- Go to Organization Settings → API Keys
- Create a new API key and copy it — it will be used as
DD_API_KEY
python -m venv .venv
source .venv/bin/activatepip install -r requirements.txtcp .env.example .envOpen .env and fill in the following values.
| Variable | Description |
|---|---|
AWS_ACCESS_KEY_ID |
AWS access key |
AWS_SECRET_ACCESS_KEY |
AWS secret key |
AWS_DEFAULT_REGION |
AWS region (e.g. us-west-2) |
SNS_TOPIC_ARN |
Target SNS topic ARN |
TAVILY_API_KEY |
Tavily API key |
DD_API_KEY |
Datadog API key |
DD_HOSTNAME |
Hostname for the Datadog Agent |
ML_APP_NAME |
App name shown in Datadog LLM Observability |
aws sts get-caller-identitydocker run -d --name datadog-agent \
--env-file .env \
-p 8126:8126 \
-p 8125:8125/udp \
datadog/agent:latestddtrace-run python 2_graph_agent.pydocker stop datadog-agent
docker rm datadog-agent- LLM Observability: Sends LLM traces directly via
LLMObs.enable(agentless_enabled=True)without a Datadog Agent - APM: Sends traces through the Datadog Agent via
ddtrace-run
Reference:
- Taka2 Blog: https://qiita.com/Taka2Noda/items/8a6aa17ee0d41b96a203
- Original Repo: https://github.com/minorun365/agent-book/tree/main