Openai has released two open weight models. gpt-oss-120b (117 billion parameters) and gpt-oss-20b (21 billion parameters), both are built with a mixture of expert (MOE) designs and 128K context windows. These models are the leading open source models, according to artificial analysis benchmarks, and are excellent at inference and agent workflows. Amazon Sagemaker AI allows you to fine-tune or customize your model and deploy it in your framework of choice through a fully managed service. Amazon Sagemaker inference gives you the flexibility to bring your own inference code and framework without having to build and maintain your own cluster.
Large-scale language models (LLMs) are excellent at understanding languages and generating content, but building real agent applications requires complex workflow management, tool invocation capabilities, and context management. By dividing complex systems into specialized components, multi-agent architectures address these challenges, but introduce new complexities in agent coordination, memory management, and workflow orchestration.
This post shows how to unfold gpt-oss-20b The model to Sagemaker manages endpoints and provides examples of practical Stock Analyzer Agent Assistant using Langgraph. It is a powerful graph-based framework that handles state management, coordinated workflows, and persistent memory systems. You then deploy the agent to Amazon Bedrock AgentCore. It is an integrated orchestration layer that abstracts infrastructure and allows you to safely deploy and operate AI agents at scale.
Solution overview
This solution builds an agent stock analyzer with the following key components:
- GPT OSS 20B model deployed to Sagemaker endpoints using VLLM, LLM's open source serving framework
- Lang graphs for building multi-agent orchestration frameworks
- Amazon Bedrock AgentCore deploys agents
The following diagram illustrates the solution architecture.

This architecture illustrates a multi-agent workflow hosted by the Amazon Bedrock AgentCore runtime running on AWS. Users submit queries that are processed by the pipelines of the DATA Gathering Agent, Stock Performance Analyzer Agent, and Stock Report Generation Agent, respectively, which are responsible for a clear part of the stock valuation process.
These agents collaborate within Amazon Bedrock's agent core runtime and invoke the GPT OSS model hosted by Sagemaker AI if language understanding or generation is required. This model processes input and returns structured output that informs agent actions, allowing for fully serverless, modular, and scalable agent systems using the open source model.
Prerequisites
- Make sure that your G6E instance requires quotas to deploy the model. If not, please request a quota here.
- If you are working with Amazon Sagemaker Studio for the first time, you must first create a Sagemaker domain.
- Make sure that the IAM role requires permission to deploy the Sagemaker model and endpoints. For more information, see How Amazon Sagemaker AI Works with IAM with Sagemaker Developer Guide.
Deploying the gpt-soss model to sage maker inference
Customers who want to customize their models and frameworks can deploy using a server-full deployment, but need access to GPU, serving framework, load balancer and infrastructure setup. Sagemaker AI provides a fully managed hosting platform to handle infrastructure provisioning with the required drivers, download models, and deploy them. OpenAI's GPT-OSS model is launched with a 4-bit quantization scheme (MXFP4) that allows for fast inference while keeping resource usage low. These models can run on P5 (H100), P6 (H200), and P4 (A100) and G6E (L40) instances. The GPT-OSS model is a sparse MOE architecture with 128 experts (120B) or 32 experts (20B). Using MXFP4 for MOE weights alone reduces the model size to 63 GB (120B) and 14 GB (20B) and makes it possible to run on a single H100 GPU.
Effective deployment of these models requires a powerful serving framework like VLLM. To deploy the model, build a VLLM container with the latest version that supports the GPT OSS model of Sagemaker AI.
You can use the following Docker files and scripts to build containers and push them to your local Amazon Elastic Container Registry (Amazon ECR). The recommended approach is to do this directly from Amazon Sagemaker Studio. It provides a managed JupyterLab environment with AWS CLI access that allows you to build and push images to ECR as part of your SageMaker workflow. Alternatively, you can perform the same steps on your Amazon Elastic Compute Cloud (Amazon EC2) instance with Docker installed.
After building the container into Amazon ECR and pressing it, you can open Amazon Sagemaker Studio by going to the SageMaker AI console, as shown in the following screenshot.

You can then create a Jupyter space or start JupyterLab with the existing space to run the notebook.

Clone the following notebook and run “Option 3: Extract from HF using BYOC”. Update the required parameters, such as inference images in notebooks with container images. It also provides the required environment variables, as shown in the following code:
After you set up your deployment configuration, you can deploy it to Sagemaker AI using the following code:
You can run an inference example.
Use Langgraph to build a Stock Analyzer Agent
Use Langgraph to adjust the workflow to analyze multi-agent systems. The Jupyter notebook for your code can be found in this GitHub repository. The system consists of three specialized tools that work together to comprehensively analyze stocks.
-
gather_stock_dataThe tool collects comprehensive stock data for specific ticker symbols, including current prices, historical performance, financial indicators, and market data. Returns formatted information covering price history, company foundations, transaction metrics, and recent news headlines. -
analyze_stock_performanceThe tool performs detailed technical and basic analysis of stock price data and calculates metrics such as price trends, volatility, and overall investment scores. Evaluate multiple factors including P/E ratio, profit margin and dividend yield to provide a comprehensive performance analysis -
generate_stock_reportThe tool creates professional PDF reports from collected inventory data and analysis and automatically uploads them to Amazon S3 using organized date-based folders.
Local testing allows you to use a simplified version of the system by importing the required functionality from a local script. for example:
In this way, before deploying the agent on a scalable platform, iterate through the agent logic quickly to ensure that each component works correctly and that the overall workflow produces the expected results for different types of inventory.
Deploy to Amazon Bedrock AgentCore
After developing and testing the Langgraph framework locally, you can deploy it to the Amazon Bedrock Agentcore runtime. Amazon Bedrock Agentcore handles heavy objects that abstract container orchestration, session management, scalability, and infrastructure management. Provides a persistent execution environment where multiple calls can maintain the agent's state.
Before you can deploy the Stock Analyzer Agent to the Amazon Bedrock AgentCore runtime, you must create an AWS Identity and Access Management IAM role with the appropriate permissions. This role allows Amazon Bedrock AgentCore to invoke SageMaker endpoints for inference of the GPT-OSS model, manage the ECR repository for storing container images, write Amazon CloudWatch logs for monitoring and debugging, access Amazon Bedrock Agemcore Workload Services for runtime operations, and send telemetry data to AWS Xray and Cloudwatch. See the following code:
After you create a role, you can deploy the agent using the Amazon Bedrock AgentCore Starter Toolkit. The toolkit simplifies the deployment process by packaging code, creating the required container images, and configuring the runtime environment.
When you are using BedrockAgentCoreAppAutomatically create an HTTP server that listens to port 8080 and implements what you need /invocations An endpoint for handling agent requirements implements/ping Handles health check endpoints (very important for asynchronous agents), the appropriate content type and response format, and manages error handling according to AWS standards.
After deploying to the Amazon Bedrock AgentCore runtime, you can see the status show as follows Ready Amazon Bedrock Agentcore Console.

Call the agent
Once you have created the agent, you need to set up the call entry point for the agent. The Amazon AgentCore runtime decorates the calling portion of the agent. @app.entrypoint Use the decorator and it as the runtime entry point. After you deploy the agent to the Amazon AgentCore runtime, you can invoke it using the AWS SDK.
After calling the Stock Analyzer Agent via the Amazon Bedrock AgentCore runtime, you must parse and format the response for a clear presentation. The response process includes the following steps:
- Decodes a byte stream from Amazon Bedrock AgentCore into readable text.
- Analyze JSON responses that include a complete inventory analysis.
- Extract three main sections using regular expression pattern matching.
- Inventory data collection section: Extract core stock information including symbols, company details, current pricing, market metrics, financial ratios, transaction data, and recent news headlines.
- Performance Analysis Section: Analyze technical indicators, basic indicators, and volatility measures to generate comprehensive stock analysis.
- Inventory Report Generation Section: Generate a detailed PDF report using all inventory technology analysis.
The system also includes error handling that gracefully handles JSON parsing errors, and returns to the plain text display if structured analysis fails, providing debugging information to troubleshoot analysis problems in stock analysis responses.
This formatted output makes it easy to review the agent's decision-making process, present professional stock analysis results to stakeholders, and complete end-to-end workflows from model deployment to meaningful business output.
cleaning
You can delete the SageMaker endpoint by running the following cells in the same notebook to avoid acquiring costs after testing.
You can also delete an Amazon Bedrock AgentCore resource using the following command:
Conclusion
In this post, we built an end-to-end solution for deploying OpenAI's open weight model on a single G6E (L40S) GPU, created a multi-agent stock analysis system with Langgraph, and deployed seamlessly with Amazon Bedrock Agemcore. This implementation shows that efficient serving frameworks such as VLLM allow organizations to use powerful open source LLM in cost-effective use. Beyond technical implementation, this workflow can be enhanced to deliver important business value, such as reducing inventory analysis processing time and increasing analyst productivity by automating daily inventory valuations. Additionally, by releasing analysts from repeated tasks, organizations can redirect skilled professionals to complex cases and relationship building activities that drive business growth.
I recommend trying the code samples and repeating the agent workflow to meet your use case.
About the author
Vivek Gangasani The world leader in Sagemaker's inference is Genai Specialist Solutions Architect. He is driving markets to markets (GTM) and outbound product strategies for Sagemaker reasoning. He also helps enterprises and startups deploy, manage and expand Genai models with Sage Makers and GPUs. Currently he focuses on developing strategies and solutions to optimize inference performance and GPU efficiency to host large language models. During his free time, Vivek will hike, watch movies and try a variety of dishes.
Surya Kali He is a senior-generated AI data scientist at AWS, specializing in developing solutions that utilize the latest basic models. He has extensive experience working together on advanced language models such as the Deepseek-R1, the Llama family, and Qwen to focus on fine-tuning and optimizing specific scientific applications. His expertise extends to implementing efficient training pipelines and deployment strategies using AWS Sagemaker, allowing for scaling basic models from development to production. He works with his clients to design and implement generated AI solutions and navigate model selection, fine-tuning approaches, and deployment strategies to achieve optimal performance for a particular use case.
