Comments and mypy

This commit is contained in:
Tao Chen
2026-04-20 18:11:32 -07:00
Unverified
parent 8b77baf4a2
commit e24d72be75
18 changed files with 41 additions and 32 deletions
@@ -45,7 +45,7 @@ Run the container, passing in the required environment variables:
```bash
docker run -p 8088:8088 \
-e FOUNDRY_PROJECT_ENDPOINT=<your-endpoint> \
-e FOUNDRY_MODEL=<your-model> \
-e MODEL_DEPLOYMENT_NAME=<your-model> \
hosted-agent-sample
```
@@ -1,2 +1,2 @@
FOUNDRY_PROJECT_ENDPOINT= "..."
FOUNDRY_PROJECT_ENDPOINT="..."
MODEL_DEPLOYMENT_NAME="..."
@@ -1,2 +1,2 @@
FOUNDRY_PROJECT_ENDPOINT= "..."
FOUNDRY_PROJECT_ENDPOINT="..."
MODEL_DEPLOYMENT_NAME="..."
@@ -1,5 +1,7 @@
# Basic example of hosting an agent with the `invocations` API
This is the same as the [01_basic](../01_basic/README.md) example, but demonstrates the "break glass" scenario where you can create your own `invoke_handler` to handle specific types of invocations. This is useful when you want to override the default behavior for certain requests or add custom processing logic.
## Running the server locally
### Environment setup
@@ -16,7 +16,7 @@ python main.py
## Interacting with the agent
Send a POST request to the server with a JSON body containing a "message" field to interact with the agent. For example:
Send a POST request to the server with a JSON body containing a "input" field to interact with the agent. For example:
```bash
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" -d '{"input": "Hi"}'
@@ -2,7 +2,7 @@ kind: hosted
name: agent-framework-agent-basic
protocols:
- protocol: responses
version: v0.1.0
version: 1.0.0
resources:
cpu: "0.25"
memory: 0.5Gi
@@ -1,6 +1,6 @@
# Basic example of hosting an agent with the `responses` API and local tools
This agent is equipped with with a function tool and a local shell tool.
This agent is equipped with a function tool and a local shell tool.
> We recommend deploying this sample on a local container or to Foundry Hosting because the agent has access to a local shell tool, which can run arbitrary commands on the machine.
@@ -18,7 +18,7 @@ python main.py
## Interacting with the agent
Send a POST request to the server with a JSON body containing a "message" field to interact with the agent. For example:
Send a POST request to the server with a JSON body containing a "input" field to interact with the agent. For example:
```bash
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" -d '{"input": "What is the weather in Seattle?"}'
@@ -2,7 +2,7 @@ kind: hosted
name: agent-framework-agent-with-local-tools
protocols:
- protocol: responses
version: v0.1.0
version: 1.0.0
resources:
cpu: "0.25"
memory: 0.5Gi
@@ -18,7 +18,7 @@ python main.py
## Interacting with the agent
Send a POST request to the server with a JSON body containing a "message" field to interact with the agent. For example:
Send a POST request to the server with a JSON body containing a "input" field to interact with the agent. For example:
```bash
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" -d '{"input": "List all the repositories I own on GitHub."}'
@@ -19,8 +19,8 @@ template:
value: "{{MODEL_DEPLOYMENT_NAME}}"
- name: GITHUB_PAT
value: ${GITHUB_PAT}
- name: FOUNDRY_AGENT_TOOLBOX_NAME
value: ${FOUNDRY_AGENT_TOOLBOX_NAME}
- name: TOOLBOX_NAME
value: ${TOOLBOX_NAME}
resources:
- kind: model
id: gpt-4.1-mini
@@ -2,7 +2,7 @@ kind: hosted
name: agent-framework-agent-with-remote-mcp-tools
protocols:
- protocol: responses
version: v0.1.0
version: 1.0.0
resources:
cpu: "0.25"
memory: 0.5Gi
@@ -16,7 +16,7 @@ python main.py
## Interacting with the agent
Send a POST request to the server with a JSON body containing a "message" field to interact with the agent. For example:
Send a POST request to the server with a JSON body containing a "input" field to interact with the agent. For example:
```bash
curl -X POST http://localhost:8088/responses -H "Content-Type: application/json" -d '{"input": "Create a slogan for a new electric SUV that is affordable and fun to drive."}'
@@ -2,7 +2,7 @@ kind: hosted
name: agent-framework-workflows
protocols:
- protocol: responses
version: v0.1.0
version: 1.0.0
resources:
cpu: "0.25"
memory: 0.5Gi
@@ -6,6 +6,6 @@ This folder contains a list of samples that show how to host agents using the `r
| --- | --- |
| [01_basic](./01_basic) | A basic example of hosting an agent with the `responses` API and carrying on a multi-turn conversation. |
| [02_local_tools](./02_local_tools) | An example of hosting an agent with the `responses` API and local tools including a function tool and a local shell tool. |
| [03_remote_mcp](./03_remote_mcp) | An example of hosting an agent with the `responses` API and remote MCPs, including a GitHub MCP server and a Foundry Toolboox. |
| [03_remote_mcp](./03_remote_mcp) | An example of hosting an agent with the `responses` API and remote MCPs, including a GitHub MCP server and a Foundry Toolbox. |
| [04_workflows](./04_workflows) | An example of hosting a workflow with the `responses` API. |
| [using_deployed_agent.py](./using_deployed_agent.py) | An example of how to use the deployed agent in Agent Framework. |
@@ -32,7 +32,7 @@ async def main() -> None:
await print_streaming_response(streaming_response)
# Second turn
query = "You name is Javis. What can you do?"
query = "Your name is Javis. What can you do?"
print(f"\nUser: {query}")
print("Agent: ", end="", flush=True)
streaming_response = agent.run(query, session=session, stream=True)