> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Bedrock AgentCore integration

> Run agents inside AWS Bedrock AgentCore and route LLM calls through the Orq.ai AI Gateway. Access 300+ models with built-in fallbacks and cost tracking.

**AWS Bedrock AgentCore Runtime** is a serverless hosting environment for deploying agents built with any framework (Strands, LangGraph, CrewAI) at production scale, without managing infrastructure. Connect the **AI Gateway** from inside AgentCore to access 300+ models across 20+ providers with automatic fallbacks, cost tracking, and full observability.

## AI Gateway

Connect the **AI Gateway** to an AgentCore entrypoint to access 300+ LLMs across 20+ providers, with automatic fallbacks, cost tracking, and observability.

### OpenAI Agents SDK

**Install:**

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  pip install openai-agents openai bedrock-agentcore
  ```
</CodeGroup>

Configure an `AsyncOpenAI` client with the **AI Gateway** base URL, then wrap the agent in a `BedrockAgentCoreApp` entrypoint:

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  from openai import AsyncOpenAI
  from agents import Agent, Runner, set_default_openai_client, set_tracing_disabled
  from bedrock_agentcore.runtime import BedrockAgentCoreApp

  client = AsyncOpenAI(
      api_key=os.getenv("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router"
  )
  set_tracing_disabled(True)
  set_default_openai_client(client)

  agent = Agent(
      name="Assistant",
      instructions="You are a helpful assistant.",
      model="openai/gpt-4o"
  )

  app = BedrockAgentCoreApp()

  @app.entrypoint
  async def agent_invocation(payload, context):
      query = payload.get("prompt", "How can I help you?")
      result = await Runner.run(agent, query)
      return {"result": result.final_output}

  app.run()
  ```
</CodeGroup>

### Strands Agents

**Install:**

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  pip install strands-agents bedrock-agentcore
  ```
</CodeGroup>

Use `OpenAIModel` with the **AI Gateway** base URL inside a Strands agent:

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  from strands import Agent
  from strands.models.openai import OpenAIModel
  from bedrock_agentcore.runtime import BedrockAgentCoreApp

  model = OpenAIModel(
      model_id="openai/gpt-4o",
      client_args={
          "api_key": os.getenv("ORQ_API_KEY"),
          "base_url": "https://api.orq.ai/v3/router"
      }
  )

  agent = Agent(
      model=model,
      system_prompt="You are a helpful assistant."
  )

  app = BedrockAgentCoreApp()

  @app.entrypoint
  def agent_invocation(payload, context):
      result = agent(payload.get("prompt", "How can I help?"))
      return {"result": str(result)}

  app.run()
  ```
</CodeGroup>

## Orq Agents

Invoke any **Orq.ai** Agent by key using `model="agent/YOUR_AGENT_KEY"` with the OpenAI Responses API. The **AI Gateway** executes the configured agent including its system prompt, tools, evaluators, and model settings.

<Info>
  Find the agent key on the [Agents](/docs/ai-studio/ai-engineering/build-agents) page in **Orq.ai**.
</Info>

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  from openai import AsyncOpenAI
  from bedrock_agentcore.runtime import BedrockAgentCoreApp

  client = AsyncOpenAI(
      api_key=os.getenv("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router"
  )

  app = BedrockAgentCoreApp()

  @app.entrypoint
  async def agent_invocation(payload, context):
      query = payload.get("prompt", "How can I help you?")
      response = await client.responses.create(
          model="agent/YOUR_AGENT_KEY",
          input=query
      )
      return {"result": response.output_text}

  app.run()
  ```
</CodeGroup>
