Skip to content

Commit ef510c4

Browse files
kuojianluCopilot
authored andcommitted
feat: Add LangGraph hosted-agent samples on top of langchain_azure_ai.agents.hosting (#324)
* Add LangGraph Responses sample: chat with local tools Adds samples/python/hosted-agents/langgraph/responses/01-langgraph-chat: - LangGraph agent built with langchain.agents.create_agent - Two local tools: get_current_time, calculator - Hosted with LangGraphResponsesHostServer (langchain_azure_ai.agents.hosting) - Multi-turn via platform-managed previous_response_id Also adds the LangGraph parent README (samples/python/hosted-agents/langgraph/README.md) modeled on the agent-framework parent, and the test-payload for cloud E2E pipeline. * Add LangGraph Responses sample: Foundry Toolbox Adds samples/python/hosted-agents/langgraph/responses/02-foundry-toolbox: - LangGraph agent loading tools from a Foundry Toolbox via AzureAIProjectToolbox - Manifest provisions a toolbox with web_search + code_interpreter - Hosted with LangGraphResponsesHostServer (langchain_azure_ai.agents.hosting) Includes test-payload for the cloud E2E pipeline. * Add LangGraph Invocations sample: chat with local tools Adds samples/python/hosted-agents/langgraph/invocations/01-langgraph-chat: - LangGraph agent with get_current_time + calculator tools - Hosted with LangGraphInvocationsHostServer (langchain_azure_ai.agents.hosting) - Multi-turn via agent_session_id wired to a LangGraph MemorySaver checkpointer - Supports streaming SSE token deltas with {\"stream\": true} Includes test-payload for the cloud E2E pipeline. * fix(cloud-e2e): pass --output json to azd ai agent show for jq parsing * use AzureChatOpenAI * revert to use ChatOpenAI but keeps token provider * sync with new class name * Add LangGraph Responses sample: remote MCP tools * Add LangGraph Responses sample: multi-agent workflow * Add LangGraph Responses sample: files and code interpreter * Add LangGraph Responses sample: human-in-the-loop * Add LangGraph Responses sample: observability * docs: list new LangGraph samples in parent READMEs * tweak to fix e2e * use AzureAIOpenAIApiChatModel * revert to use ChatOpenAI * docs(langgraph): add Foundry Toolkit VS Code Extension subsections to sample READMEs Adds two subsections to all 8 LangGraph sample READMEs, mirroring the agent-framework sample convention: - Test in Agent Inspector (under 'Interacting with the agent') with a sample-specific message - Deploying with the Foundry Toolkit VS Code Extension (under 'Deploying the Agent to Foundry') with the 5-step wizard * refactor(langgraph): rename 02-foundry-toolbox -> 02-langgraph-toolbox; align with BYO Mirror samples/python/hosted-agents/bring-your-own/responses/langgraph-toolbox: - Rename folder via git mv (history preserved); agent name is now toolbox-langgraph. - Swap scenario from web_search + code_interpreter to web_search + GitHub Copilot MCP via a connection-backed Toolbox tool (custom-keys auth). - agent.manifest.yaml: add github_pat parameter (kind: string, secret: true) and a github-mcp-conn RemoteTool connection; toolbox now lists web_search + the MCP tool wired via project_connection_id. - main.py: add citation-grounded SYSTEM_PROMPT, OAuth consent helpers, and a tool schema sanitizer; install handle_tool_error on every loaded tool so consent (-32006) errors surface a friendly URL instead of crashing. - README.md: rewrite scenario, add Prerequisites (azd env set GITHUB_PAT), sample queries for web_search and GitHub MCP, and a Troubleshooting section adapted from BYO. - Update parent sample tables in langgraph/README.md and hosted-agents/README.md. * build(langgraph): use public langchain-azure-ai 1.2.4 instead of local wheels The hosting extra (ResponsesHostServer / InvocationsHostServer) shipped in langchain-azure-ai 1.2.4 on PyPI, so the samples no longer need to install the local 1.2.3+local wheel from a wheels/ directory. - Drop --find-links ./wheels and pin langchain-azure-ai[hosting]>=1.2.4 (and [hosting,opentelemetry]>=1.2.4 for 08-observability). - Remove the vendored langchain_azure_ai-1.2.3+local wheel from all 8 langgraph samples. * fix(langgraph): align 02-langgraph-toolbox manifest with BYO for E2E pipeline The cloud E2E pipeline (azd) failed to resolve the github_pat secret with the parameters.properties[] form, erroring: 'unable to prompt for secret parameter in no-prompt mode'. The BYO langgraph-toolbox manifest, which the pipeline accepts, uses the flat-map parameters.<name> form instead. - Switch parameters to the flat-map form (drops kind: string). - Drop the yaml-language-server schema reference: the IDE schema requires parameters.properties[] which the cloud pipeline does not accept. - Align the github-mcp-conn connection with BYO: category: remoteTool (lowercase) and drop the redundant authType field. - Add server_url to the MCP toolbox tool to match BYO. * fix(langgraph): lazy-load toolbox in 02-langgraph-toolbox to fix session_not_ready Foundry's session manager waits for /readiness to return 200 before routing the first /responses request. The eager asyncio.run(_load_toolbox_tools()) in main() blocked the HTTP server from coming up; if the toolbox call exceeded the readiness timeout the session never became ready and clients got HTTP 424 session_not_ready. Subclass ResponsesHostServer as _LazyToolboxHostServer: start with a placeholder empty-tools graph so the server can serve /readiness immediately, then build the real toolbox-bound graph inside a double-checked lock on the first request. Mirrors the lazy pattern used by the BYO langgraph-toolbox sample. Update README to mention tools are loaded lazily on the first request. * test(hosted-agents): split 06-files payload, drop dead 02-foundry-toolbox payload 06-files: turn 2 timed out on the cloud E2E pipeline (HTTP 408) because a single turn chained get_cwd -> list_files -> read_file -> code_interpreter and exceeded Foundry's per-request timeout. Split into three independent turns: list tools, read file & report Q1 revenue, then compute the diff with the code interpreter standalone. 02-foundry-toolbox: delete test-payload.txt — the cloud E2E workflow detects any hosted-agents sample whose dir name contains 'toolbox' as is_toolbox=true and overrides PAYLOAD_FILE with TOOLBOX_QUERY, so the per-sample payload was never read. * ci(hosted-agents): route 02-langgraph-toolbox to westus2 toolbox project The ncus toolbox project still reproduces the Foundry MCP dot-prefix tool-name bug for Foundry-hosted toolboxes (web-search, ms-learn, github-mcp); westus2 has the fix. The BYO langgraph-toolbox sample passes in CI for exactly this reason — it is already in the use_westus2 list while 02-langgraph-toolbox was not, causing its github-mcp tool to fail at runtime with 'Authorization header is badly formatted' against https://api.githubcopilot.com/mcp. Add samples/python/hosted-agents/langgraph/responses/02-langgraph-toolbox to the use_westus2 case so it deploys against the same fixed project as its BYO parity. * ci(hosted-agents): use GH_PAT secret for github_pat GitHub forbids user-defined secret names that start with GITHUB_, so rename the lookup from secrets.GITHUB_PAT to secrets.GH_PAT. The secrets.GITHUB_TOKEN fallback is unchanged (that one is auto-issued by Actions and is fine to read). * fix(ci): support non-src scaffold paths in hosted agents e2e * fix: normalize nested azd project dir in cloud hosted-agents e2e * ci(hosted-agents): pin azure.ai.agents extension to 0.1.34-preview Newer extension builds omit the Foundry-Features: HostedAgents=V1Preview header on 'azd ai agent invoke -p invocations', which the platform now rejects with HTTP 403 preview_feature_required. 0.1.34-preview still sends the header. * revert(langgraph): drop 02-langgraph-toolbox sample to unblock PR The toolbox sample's E2E job is blocked on platform-side fixes (MCP tool-name dot-prefix bug on ncus, github-mcp PAT routing, and the preview_feature_required header gate on the invocations protocol). Remove the sample directory, the two README rows that listed it, and the westus2 routing entry so the PR can merge with the remaining LangGraph samples. The sample, including all iteration history, is preserved on the kuojianlu/langgraph-toolbox-backup branch and will be reintroduced in a separate PR once the platform side stabilizes. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 3488110 commit ef510c4

59 files changed

Lines changed: 2525 additions & 5 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/python/hosted-agents/README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ Hosted agents run any code you can put in a container. These samples cover three
8686
| | **Agent Framework** | **LangGraph** | **Bring Your Own** |
8787
| ----------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
8888
| **Best for** | Starting fresh on Foundry — also supports AutoGen and Semantic Kernel | Already using LangChain / LangGraph | Already built with CrewAI or your own stack |
89-
| **SDK** | `agent-framework-foundry-hosting` (includes core, openai, foundry, orchestrations) | `azure-ai-agentserver-responses` / `azure-ai-agentserver-invocations` | `azure-ai-agentserver-responses` / `azure-ai-agentserver-invocations`, or `azure-ai-agentserver-core` for fully custom HTTP |
90-
| **Foundry integration** | Native — sessions, tools, memory, streaming all built in | Adapter — sessions and tools wired through LangGraph adapter | Core adapter hosts the web server and exposes `/invocations` and `/responses` endpoints; you supply the agent logic |
89+
| **SDK** | `agent-framework-foundry-hosting` (includes core, openai, foundry, orchestrations) | `langchain-azure-ai[hosting]` (`ResponsesHostServer` / `InvocationsHostServer`) | `azure-ai-agentserver-responses` / `azure-ai-agentserver-invocations`, or `azure-ai-agentserver-core` for fully custom HTTP |
90+
| **Foundry integration** | Native — sessions, tools, memory, streaming all built in | Native via `langchain_azure_ai.agents.hosting` — sessions, streaming, and tool-call surfacing built in for LangGraph agents (`create_agent`) and custom `StateGraph`s | Core adapter hosts the web server and exposes `/invocations` and `/responses` endpoints; you supply the agent logic |
9191
| **Protocols** | Responses and Invocations | Responses and Invocations | Responses and Invocations |
9292
| **Language support** | Python and C# | Python only | Any language (Python and C# samples provided) |
93-
| **Start here** | [Basic Agent →](agent-framework/responses/01-basic/) | [LangGraph Chat →](bring-your-own/responses/langgraph-chat/) | [Hello World →](bring-your-own/responses/hello-world/) |
93+
| **Start here** | [Basic Agent →](agent-framework/responses/01-basic/) | [LangGraph Chat →](langgraph/responses/01-langgraph-chat/) | [Hello World →](bring-your-own/responses/hello-world/) |
9494

95-
> **Which should I choose?** If you're building a new agent — or already using AutoGen or Semantic Kernel — start with **Agent Framework**. It has the tightest Foundry integration, supports those orchestrators natively, and has the most samples to learn from. If you already have LangGraph code, use the **LangGraph** adapter to bring it to Foundry. If you have an existing agent in another framework (e.g., CrewAI), **Bring Your Own** shows how to containerize and deploy it unchanged.
95+
> **Which should I choose?** If you're building a new agent — or already using AutoGen or Semantic Kernel — start with **Agent Framework**. It has the tightest Foundry integration, supports those orchestrators natively, and has the most samples to learn from. If you already have LangGraph code, use the **LangGraph** hosting integration (`langchain_azure_ai.agents.hosting`) to bring it to Foundry. If you have an existing agent in another framework (e.g., CrewAI), **Bring Your Own** shows how to containerize and deploy it unchanged.
9696
9797
---
9898

@@ -135,7 +135,26 @@ Full control over the HTTP request/response cycle. You define the payload schema
135135

136136
## LangGraph samples
137137

138-
LangGraph samples are included in the **Bring Your Own** section below — see [`bring-your-own/responses/langgraph-chat/`](bring-your-own/responses/langgraph-chat/) and [`bring-your-own/invocations/langgraph-chat/`](bring-your-own/invocations/langgraph-chat/).
138+
Bring your existing [LangGraph](https://langchain-ai.github.io/langgraph/) graphs to Foundry. These samples use [`langchain_azure_ai.agents.hosting`](https://github.com/langchain-ai/langchain-azure/tree/main/libs/azure-ai/langchain_azure_ai/agents/hosting) (`ResponsesHostServer` / `InvocationsHostServer`) to expose LangGraph agents (`create_agent`) and custom `StateGraph`s over the hosted agent protocols, with native Foundry session, streaming, and tool wiring.
139+
140+
See [`langgraph/README.md`](langgraph/) for the full list and the local-run guide.
141+
142+
### Responses protocol
143+
144+
| Sample | What it shows |
145+
| ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
146+
| **[Chat](langgraph/responses/01-langgraph-chat/)** | Minimal LangGraph agent with two local tools (`get_current_time`, `calculator`); multi-turn via `previous_response_id`. |
147+
| **[MCP](langgraph/responses/04-mcp/)** | LangGraph agent that loads tools from a remote MCP server (default: GitHub Copilot MCP) via `langchain_mcp_adapters`. |
148+
| **[Workflows](langgraph/responses/05-workflows/)** | Custom `StateGraph` chaining three specialized LLM nodes — slogan writer, legal reviewer, formatter — each seeing only the prior agent's output. |
149+
| **[Files](langgraph/responses/06-files/)** | LangGraph agent with local filesystem tools and a Foundry-Toolbox `code_interpreter` for session-uploaded files. |
150+
| **[Human-in-the-Loop](langgraph/responses/07-human-in-the-loop/)** | `StateGraph` that drafts a proposal and pauses for approval via `langgraph.types.interrupt`, serialized as `mcp_approval_request` + `function_call`. |
151+
| **[Observability](langgraph/responses/08-observability/)** | GenAI OpenTelemetry tracing enabled with `enable_auto_tracing()` — spans, metrics, and logs flow to Application Insights. |
152+
153+
### Invocations protocol
154+
155+
| Sample | What it shows |
156+
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
157+
| **[Chat](langgraph/invocations/01-langgraph-chat/)** | Minimal LangGraph agent with local tools; session state via `agent_session_id` (URL param / `x-agent-session-id` header) backed by a LangGraph checkpointer. |
139158

140159
---
141160

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# LangGraph Samples
2+
3+
This directory contains samples that demonstrate how to use [LangGraph](https://langchain-ai.github.io/langgraph/) together with [`langchain_azure_ai.agents.hosting`](https://github.com/langchain-ai/langchain-azure/tree/main/libs/azure-ai/langchain_azure_ai/agents/hosting) to host agents on Foundry with different capabilities and configurations. Each sample includes a README with sample queries and any sample-specific notes.
4+
5+
## Samples
6+
7+
### Responses API
8+
9+
| # | Sample | Description |
10+
| --- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11+
| 1 | [Chat](responses/01-langgraph-chat/) | A minimal LangGraph agent with two local tools (`get_current_time`, `calculator`), demonstrating multi-turn conversation via `previous_response_id`. |
12+
| 4 | [MCP](responses/04-mcp/) | A LangGraph agent that loads tools from a remote MCP server (default: GitHub Copilot MCP) via `langchain_mcp_adapters.client.MultiServerMCPClient`. |
13+
| 5 | [Workflows](responses/05-workflows/) | A custom `StateGraph` chaining three specialized LLM nodes — slogan writer, legal reviewer, formatter — each seeing only the previous agent's output. |
14+
| 6 | [Files](responses/06-files/) | A LangGraph agent with local filesystem tools and a Foundry-Toolbox `code_interpreter`, demonstrating session-uploaded file handling. |
15+
| 7 | [Human-in-the-Loop](responses/07-human-in-the-loop/) | A LangGraph `StateGraph` that drafts a proposal and pauses for human review via `langgraph.types.interrupt`, serialized as `mcp_approval_request` + `function_call` output items. |
16+
| 8 | [Observability](responses/08-observability/) | A LangGraph agent with GenAI OpenTelemetry tracing enabled via `enable_auto_tracing()`, emitting spans, metrics, and logs to Application Insights. |
17+
18+
### Invocations API
19+
20+
| # | Sample | Description |
21+
| --- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| 1 | [Chat](invocations/01-langgraph-chat/) | A minimal LangGraph agent with two local tools, demonstrating session state via `agent_session_id` (URL param / `x-agent-session-id` response header) backed by a LangGraph checkpointer. |
23+
24+
## Running the Agent Host Locally
25+
26+
### Using `azd`
27+
28+
#### Prerequisites
29+
30+
1. **Azure Developer CLI (`azd`)**
31+
- [Install azd](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd) and the AI agent extension: `azd ext install azure.ai.agents`
32+
- Authenticated: `azd auth login`
33+
34+
2. **Azure Subscription**
35+
36+
#### Create a new project
37+
38+
**No cloning required**. Create a new folder, point azd at the manifest on GitHub.
39+
40+
```bash
41+
mkdir hosted-langgraph-agent && cd hosted-langgraph-agent
42+
43+
# Initialize from the manifest (replace with the sample you want to try)
44+
azd ai agent init -m https://github.com/microsoft-foundry/foundry-samples/blob/main/samples/python/hosted-agents/langgraph/responses/01-langgraph-chat/agent.manifest.yaml
45+
```
46+
47+
Follow the instructions from `azd ai agent init` to complete the agent initialization. If you don't have an existing Foundry project and a model deployment, `azd ai agent init` will guide you through creating them.
48+
49+
#### Provision Azure Resources
50+
51+
> This step is only needed if you don't have an existing Foundry project and model deployment.
52+
53+
Run the following command to provision the necessary Azure resources:
54+
55+
```bash
56+
azd provision
57+
```
58+
59+
This will create the following Azure resources:
60+
61+
- A new resource group named `rg-[project_name]-dev`. In this guide, `[project_name]` will be `hosted-langgraph-agent`.
62+
- Within the resource group, among other resources, the most important ones are:
63+
- A new Foundry instance
64+
- A new Foundry project, within which a new model deployment will be created
65+
- An Application Insights instance
66+
- A container registry, which will be used to store the container images for the hosted agent
67+
68+
#### Set Environment Variables
69+
70+
```bash
71+
export FOUNDRY_PROJECT_ENDPOINT="https://<account>.services.ai.azure.com/api/projects/<project>"
72+
export AZURE_AI_MODEL_DEPLOYMENT_NAME="<your-model-deployment-name>"
73+
# And any other environment variables required by the sample
74+
```
75+
76+
Or in PowerShell:
77+
78+
```powershell
79+
$env:FOUNDRY_PROJECT_ENDPOINT="https://<account>.services.ai.azure.com/api/projects/<project>"
80+
$env:AZURE_AI_MODEL_DEPLOYMENT_NAME="<your-model-deployment-name>"
81+
# And any other environment variables required by the sample
82+
```
83+
84+
> Note: The environment variables set above are only for the current session. You will need to set them again if you open a new terminal session. If you want to set the environment variables permanently in the azd environment, you can use `azd env set <name> <value>`.
85+
86+
#### Running the Agent Host
87+
88+
```bash
89+
azd ai agent run
90+
```
91+
92+
Right now, the agent host should be running on `http://localhost:8088`
93+
94+
#### Invoking the Agent
95+
96+
Open another terminal, **navigate to the project directory**, and run the following command to invoke the agent:
97+
98+
```bash
99+
azd ai agent invoke --local "Hello!"
100+
```
101+
102+
Or in another terminal, without navigating to the project directory, run the following command to invoke the agent:
103+
104+
```bash
105+
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" -d '{"input": "Hello!"}'
106+
```
107+
108+
Or in PowerShell:
109+
110+
```powershell
111+
(Invoke-WebRequest -Uri http://localhost:8088/responses -Method POST -ContentType "application/json" -Body '{"input": "Hello!"}').Content
112+
```
113+
114+
> **Invocations protocol note:** The `curl` examples above target the Responses endpoint (`/responses`). For Invocations samples, the endpoint is `/invocations` and the request body uses `"message"` instead of `"input"`. Session continuity uses the `agent_session_id` URL parameter and the `x-agent-session-id` response header. See [`invocations/01-langgraph-chat/`](invocations/01-langgraph-chat/) for full examples.
115+
116+
### Using `python`
117+
118+
#### Prerequisites
119+
120+
1. An existing Foundry project
121+
2. A deployed model in your Foundry project
122+
3. Azure CLI installed and authenticated
123+
4. Python 3.10 or later
124+
125+
#### Running the Agent Host with Python
126+
127+
Clone the repository containing the sample code:
128+
129+
```bash
130+
git clone https://github.com/microsoft-foundry/foundry-samples.git
131+
cd foundry-samples/samples/python/hosted-agents/langgraph
132+
```
133+
134+
#### Environment setup
135+
136+
1. Navigate to the sample directory you want to explore. Create a virtual environment:
137+
138+
```bash
139+
python -m venv .venv
140+
141+
# Windows
142+
.venv\Scripts\Activate
143+
144+
# macOS/Linux
145+
source .venv/bin/activate
146+
```
147+
148+
2. Install dependencies:
149+
150+
```bash
151+
pip install -r requirements.txt
152+
```
153+
154+
3. Create a `.env` file with your Foundry configuration following the `.env.example` file in the sample.
155+
156+
4. Make sure you are logged in with the Azure CLI:
157+
158+
```bash
159+
az login
160+
```
161+
162+
#### Running the Agent Host
163+
164+
```bash
165+
python main.py
166+
```
167+
168+
Right now, the agent host should be running on `http://localhost:8088`
169+
170+
#### Invoking the Agent
171+
172+
On another terminal, run the following command to invoke the agent:
173+
174+
```bash
175+
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" -d '{"input": "Hello!"}'
176+
```
177+
178+
Or in PowerShell:
179+
180+
```powershell
181+
(Invoke-WebRequest -Uri http://localhost:8088/responses -Method POST -ContentType "application/json" -Body '{"input": "Hello!"}').Content
182+
```
183+
184+
> **Invocations protocol note:** See the [Invocations protocol note](#invoking-the-agent) above for the endpoint, body shape, and session-id mechanics used by Invocations samples.
185+
186+
## Deploying the Agent to Foundry
187+
188+
Once you've tested locally, deploy to Microsoft Foundry.
189+
190+
### With an Existing Foundry Project
191+
192+
If you already have a Foundry project and the necessary Azure resources provisioned, you can skip the setup steps and proceed directly to deploying the agent.
193+
194+
After running `azd ai agent init -m <agent.manifest.yaml>` and following the prompts to configure your agent, you will have a project ready for deployment.
195+
196+
### Setting Up a New Foundry Project
197+
198+
Follow the steps in [Using `azd`](#using-azd) to set up the project and provision the necessary Azure resources for your Foundry deployment.
199+
200+
### Deploying the Agent
201+
202+
Once the project is setup and resources are provisioned, you can deploy the agent to Foundry by running:
203+
204+
```bash
205+
azd deploy
206+
```
207+
208+
> The Foundry hosting infrastructure will inject the following environment variables into your agent at runtime:
209+
>
210+
> - `FOUNDRY_PROJECT_ENDPOINT`: The endpoint URL for the Foundry project where the agent is deployed.
211+
> - `AZURE_AI_MODEL_DEPLOYMENT_NAME`: The name of the model deployment in your Foundry project. This is configured during the agent initialization process with `azd ai agent init`.
212+
> - `APPLICATIONINSIGHTS_CONNECTION_STRING`: The connection string for Application Insights to enable telemetry for your agent.
213+
214+
This will package your agent and deploy it to the Foundry environment, making it accessible through the Foundry project endpoint. Once it's deployed, you can also access the agent through the Foundry UI.
215+
216+
For the full deployment guide, see the [official deployment guide](https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/deploy-hosted-agent).
217+
218+
Once deployed, learn more about how to manage deployed agents in the [official management guide](https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/manage-hosted-agent).
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
**/__pycache__/
2+
**/*.py[cod]
3+
**/*.egg-info/
4+
.eggs/
5+
6+
# Virtual environments
7+
.venv/
8+
venv/
9+
env/
10+
11+
# IDE settings
12+
.vscode/
13+
.idea/
14+
15+
# Version control
16+
.git/
17+
.gitignore
18+
19+
# Docker files
20+
.dockerignore
21+
22+
# Docs
23+
README.md
24+
25+
# Local environment (never bake credentials into the image)
26+
.env
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Foundry project endpoint — auto-injected in hosted containers.
2+
# Only set manually if running without `azd ai agent run`.
3+
# FOUNDRY_PROJECT_ENDPOINT=https://<account>.services.ai.azure.com/api/projects/<project>
4+
5+
# Model deployment name — must match a deployment in your Foundry project.
6+
AZURE_AI_MODEL_DEPLOYMENT_NAME=
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.12-slim
2+
WORKDIR /app
3+
COPY . user_agent/
4+
WORKDIR /app/user_agent
5+
RUN pip install --upgrade pip && if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
6+
EXPOSE 8088
7+
CMD ["python", "main.py"]

0 commit comments

Comments
 (0)