I am experimenting with AWS Bedrock Agent Core runtime for production level deployments of Agents. I already have deployed an agent in a runtime successfully. But now, I want to enable the observability feature in it. According to the documentation from AWS, as long as we have aws-telemetry-distro in our requirements.txt, the tracing will be automatically instrumented.
But when I am launching my agent after configuration following the steps given here, I have this warning in my terminal:
Launching Bedrock AgentCore...Failed to enable observability for runtime/<agent_name>: AccessDeniedException - Access Denied for this Delivery Destination. Please make sure that you have correct permissions to access the Log Destination Resource.
⚠️ Traces delivery setup warning for agent <agent_name>: AccessDeniedException: Access Denied for this Delivery Destination. Please make sure that you have correct permissions to access the Log Destination Resource.
After this, even after I invoke my agent runtime, I cannot see any traces of it in the Cloudwatch dashboard. I have checked the permissions associated with the execution role and it has all necessary permissions.
Can anyone explain what exactly is happening and what should be done to ensure that observability is properly configured in the runtime.
This is the code that I am using to make agents:
from strands import Agent
from strands.models import BedrockModel
from bedrock_agentcore.runtime import BedrockAgentCoreApp
from strands_tools import current_time, calculator
app = BedrockAgentCoreApp()
#Define the detailed system prompt for the assistant
SYSTEM_PROMPT = """You are helpful assistant"""
# create agent once outside the handler so reuse is possible
model = BedrockModel(
model_id=<model_id>
)
agent = Agent(
model=model,
tools=[current_time, calculator],
system_prompt=SYSTEM_PROMPT
)
@app.entrypoint
async def invoke(payload):
user_message = payload.get("prompt", "")
# get the async streaming generator
stream = agent.stream_async(user_message)
# yield each event back to the AgentCore Runtime which will send them
async for event in stream:
# event is a dict with streaming tokens and structured blocks
yield event
if __name__ == "__main__":
app.run()