Skip to main content
This guide provides instructions for integrating Strands Agents with the Truefoundry AI Gateway.

What is Strands Agents?

Strands Agents is an open-source framework developed by AWS for building production-ready, multi-agent AI systems. It leverages model reasoning to plan, orchestrate tasks, and reflect on goals, making it ideal for enterprise-grade agentic applications.

Key Features of Strands Agents

  • Model-Driven Orchestration: Leverages model reasoning to plan, orchestrate tasks, and reflect on goals autonomously
  • Model & Provider Agnostic: Work with any LLM provider - Amazon Bedrock, OpenAI, Anthropic, local models - without changing your code
  • Multi-Agent Primitives: Simple primitives for handoffs, swarms, and graph workflows with built-in support for Agent-to-Agent (A2A) communication
  • Native AWS Integration: Best-in-class AWS integrations with easy deployment to EKS, Lambda, EC2, and native MCP tool integration

How TrueFoundry Integrates with Strands Agents

TrueFoundry enhances Strands Agents with production-grade observability, cost management, and multi-provider support through its LLM Gateway.

Installation & Setup

1

Install Strands Agents

pip install -U strands-agents strands-agents-tools
2

Get TrueFoundry Access Token

  1. Sign up for a TrueFoundry account
  2. Follow the steps here in Quick start
3

Configure Strands with TrueFoundry

TrueFoundry Code Configuration
from strands.models.openai import OpenAIModel

# Create a model instance with TrueFoundry AI Gateway
truefoundry_model = OpenAIModel(
    client_args={
        "api_key": "your_truefoundry_api_key",
        "base_url": "your_truefoundry_gateway_base_url"
    },
    model_id="openai-main/gpt-4o",  
    params={"temperature": 0.7}
)

# Use in your Strands agent
from strands import Agent

agent = Agent(model=truefoundry_model)
response = agent("What is 2+2?")

Multi-Provider Support

TrueFoundry’s LLM Gateway provides an OpenAI-compatible API that works with all model providers:
# OpenAI
openai_model = OpenAIModel(
    client_args={
        "api_key": "your_truefoundry_api_key",
        "base_url": "your_truefoundry_gateway_base_url"
    },
    model_id="llm-gateway-prod/gpt-4o",
    params={"temperature": 0.7}
)

# Anthropic Claude
claude_model = OpenAIModel(
    client_args={
        "api_key": "your_truefoundry_api_key",
        "base_url": "your_truefoundry_gateway_base_url"
    },
    model_id="llm-gateway-prod/claude-sonnet-4-5",
    params={"temperature": 0.7}
)

# Google Gemini
gemini_model = OpenAIModel(
    client_args={
        "api_key": "your_truefoundry_api_key",
        "base_url": "your_truefoundry_gateway_base_url"
    },
    model_id="llm-gateway-prod/gemini-2-0-flash-lite-001",
    params={"temperature": 0.7}
)

# Use different models for different agents
researcher = Agent(model=claude_model, tools=[web_search])
calculator_agent = Agent(model=openai_model, tools=[calculator])

Observability and Governance

Monitor your Strands agents through TrueFoundry’s metrics tab: TrueFoundry metrics dashboard showing usage statistics, costs, and performance metrics for Strands agents With Truefoundry’s AI gateway, you can monitor and analyze:
  • Performance Metrics: Track key latency metrics like Request Latency, Time to First Token (TTFS), and Inter-Token Latency (ITL) with P99, P90, and P50 percentiles
  • Cost and Token Usage: Gain visibility into your application’s costs with detailed breakdowns of input/output tokens and the associated expenses for each model
  • Usage Patterns: Understand how your application is being used with detailed analytics on user activity, model distribution, and team-based usage
  • Rate limit and Load balancing: You can set up rate limiting, load balancing and fallback for your models
I