@@ -24,13 +24,14 @@ AWS Strands is an AI agent framework that:
2424Integration Approach
2525~~~~~~~~~~~~~~~~~~~~
2626
27- HoneyHive integrates with AWS Strands using the ** OpenTelemetry TracerProvider pattern **.
27+ HoneyHive integrates with AWS Strands using ** automatic OpenTelemetry provider setup **.
2828
2929**Key Difference from Other Integrations: **
3030
3131Unlike OpenAI or Anthropic (which require instrumentors like OpenInference or Traceloop), **AWS Strands has built-in OpenTelemetry tracing **. This means:
3232
3333- ✅ **NO instrumentor needed ** - Strands instruments its own LLM calls
34+ - ✅ **NO manual provider setup ** - ``HoneyHiveTracer.init() `` handles it automatically
3435- ✅ **Built-in GenAI conventions ** - All model calls automatically traced
3536- ✅ **Don't use OpenInference/Traceloop ** - Would create duplicate spans
3637- ✅ **Zero modifications to Strands code ** - Works with Strands as-is
@@ -41,10 +42,22 @@ Unlike OpenAI or Anthropic (which require instrumentors like OpenInference or Tr
4142
4243**How It Works: **
4344
44- 1. HoneyHive provides a TracerProvider
45- 2. Set it as the global OpenTelemetry provider
46- 3. Strands automatically uses it for all its built-in tracing
47- 4. All LLM calls, agent actions, and tool executions are traced
45+ 1. Call ``HoneyHiveTracer.init() `` - automatically sets up global TracerProvider
46+ 2. Strands automatically uses it for all its built-in tracing
47+ 3. All LLM calls, agent actions, and tool executions are traced
48+
49+ Complete Example
50+ ~~~~~~~~~~~~~~~~
51+
52+ **See the full code: ** `strands_integration.py <https://github.com/honeyhiveai/python-sdk/blob/main/examples/integrations/strands_integration.py >`_
53+
54+ A comprehensive working example is available in the repository at ``examples/integrations/strands_integration.py ``:
55+
56+ - ✅ All 8 integration patterns shown below
57+ - ✅ Basic agent invocation, tool execution, streaming responses
58+ - ✅ Custom trace attributes, structured outputs with Pydantic
59+ - ✅ Swarm multi-agent collaboration, graph workflows with parallel processing
60+ - ✅ Copy-paste ready code for quick start
4861
4962What Gets Traced
5063~~~~~~~~~~~~~~~~
@@ -138,22 +151,22 @@ Minimal Setup (3 Lines of Code)
138151
139152.. code-block :: python
140153
154+ # ============= HONEYHIVE INTEGRATION =============
141155 from honeyhive import HoneyHiveTracer
142- from strands import Agent
143- from strands.models import BedrockModel
144- from opentelemetry import trace as trace_api
145156 import os
146157
147- # 1. Initialize HoneyHive tracer
158+ # Initialize HoneyHive tracer - automatic global provider setup
148159 tracer = HoneyHiveTracer.init(
149160 api_key = os.getenv(" HH_API_KEY" ),
150161 project = " strands-demo" ,
151162 )
163+ # ==================================================
152164
153- # 2. Set as global TracerProvider (BEFORE creating agents)
154- trace_api.set_tracer_provider(tracer.provider)
165+ # ============= YOUR STRANDS CODE ==================
166+ from strands import Agent
167+ from strands.models import BedrockModel
155168
156- # 3. Use Strands normally - tracing is automatic!
169+ # Use Strands normally - tracing is automatic!
157170 agent = Agent(
158171 name = " BasicAgent" ,
159172 model = BedrockModel(model_id = " anthropic.claude-haiku-4-5-20251001-v1:0" ),
@@ -162,29 +175,37 @@ Minimal Setup (3 Lines of Code)
162175
163176 result = agent(" What is 2+2?" )
164177 print (result) # "2+2 equals 4"
178+ # ==================================================
165179
166180 **That's it! ** All agent activity is now automatically traced to HoneyHive.
167181
182+ .. note ::
183+ **No Manual Provider Setup Required **
184+
185+ Unlike some integrations, you don't need to manually call ``trace_api.set_tracer_provider() ``.
186+ The SDK automatically handles OpenTelemetry provider setup during ``HoneyHiveTracer.init() ``.
187+
188+ AWS Strands has built-in OpenTelemetry support that works seamlessly with HoneyHive's automatic configuration.
189+
168190Basic Agent Example
169191~~~~~~~~~~~~~~~~~~~
170192
171193.. code-block :: python
172194
195+ # ============= HONEYHIVE INTEGRATION =============
173196 from honeyhive import HoneyHiveTracer
174- from strands import Agent
175- from strands.models import BedrockModel
176- from opentelemetry import trace as trace_api
177197 import os
178198
179- # Initialize HoneyHive
180199 tracer = HoneyHiveTracer.init(
181200 api_key = os.getenv(" HH_API_KEY" ),
182201 project = " strands-agents" ,
183202 session_name = " basic-agent-demo"
184203 )
204+ # ==================================================
185205
186- # Set as global provider
187- trace_api.set_tracer_provider(tracer.provider)
206+ # ============= YOUR STRANDS CODE ==================
207+ from strands import Agent
208+ from strands.models import BedrockModel
188209
189210 # Create agent
190211 agent = Agent(
@@ -724,13 +745,11 @@ This happens if you accidentally enable LLM instrumentors (OpenInference/Tracelo
724745 from openinference.instrumentation.openai import OpenAIInstrumentor
725746 OpenAIInstrumentor().instrument() # Will create duplicate spans!
726747
727- # ✅ DO THIS - Just use TracerProvider pattern
748+ # ✅ DO THIS - Just initialize HoneyHive
728749 from honeyhive import HoneyHiveTracer
729- from opentelemetry import trace as trace_api
730750
731751 tracer = HoneyHiveTracer.init(... )
732- trace_api.set_tracer_provider(tracer.provider)
733- # That's it - Strands handles the rest!
752+ # That's it - automatic provider setup, Strands handles the rest!
734753
735754 **Issue: "Unable to locate credentials" **
736755
@@ -764,7 +783,7 @@ Use correct Bedrock model IDs (not OpenAI model names):
764783
7657841. Verify ``HH_API_KEY `` is set correctly
7667852. Check project name matches your HoneyHive project
767- 3. Ensure ``trace_api.set_tracer_provider () `` is called BEFORE creating agents
786+ 3. Ensure ``HoneyHiveTracer.init () `` is called BEFORE creating agents
7687874. Look for error messages in console output
769788
770789Debugging Traces
@@ -804,20 +823,19 @@ Print session ID for manual verification:
804823 Best Practices
805824--------------
806825
807- 1. **Set TracerProvider Early **
826+ 1. **Initialize Tracer Early **
808827
809- Always call ``trace_api.set_tracer_provider () `` before creating agents:
828+ Always call ``HoneyHiveTracer.init () `` before creating agents (automatic provider setup) :
810829
811830 .. code-block :: python
812831
813832 # ✅ Correct order
814- tracer = HoneyHiveTracer.init(... )
815- trace_api.set_tracer_provider(tracer.provider)
833+ tracer = HoneyHiveTracer.init(... ) # Automatic global provider setup
816834 agent = Agent(... ) # Now traced
817835
818836 # ❌ Wrong order
819837 agent = Agent(... ) # Not traced
820- tracer = HoneyHiveTracer.init(... )
838+ tracer = HoneyHiveTracer.init(... ) # Too late!
821839
822840 2. **Don't Use LLM Instrumentors **
823841
@@ -831,8 +849,7 @@ Best Practices
831849
832850 # ✅ DO THIS - Strands instruments itself
833851 tracer = HoneyHiveTracer.init(... )
834- trace_api.set_tracer_provider(tracer.provider)
835- # Strands' built-in tracing handles everything
852+ # Strands' built-in tracing handles everything (no manual provider setup needed)
836853
837854 3. **Use Meaningful Agent Names **
838855
@@ -894,21 +911,4 @@ Next Steps
894911- :doc: `/reference/api/tracer ` - Full tracer API reference
895912- `AWS Strands Documentation <https://github.com/strands-agents/sdk-python >`_ - Learn more about Strands
896913
897- Complete Example
898- ----------------
899-
900- A comprehensive example is available in the repository:
901-
902- **`examples/integrations/strands_integration.py` ** - Full integration demo with 8 test cases:
903-
904- - Basic agent invocation
905- - Tool execution with calculator
906- - Streaming responses
907- - Custom trace attributes
908- - Structured outputs with Pydantic
909- - Swarm multi-agent collaboration
910- - Graph workflows with parallel processing
911- - All patterns shown in this guide
912-
913- View it on GitHub: `strands_integration.py <https://github.com/honeyhiveai/python-sdk/blob/main/examples/integrations/strands_integration.py >`_
914914
0 commit comments