# Troubleshoot Microsoft Foundry agents on Diagrid

Each entry on this page is an error that came up while the [quickstart](https://docs.diagrid.io/integrations/microsoft-foundry/getting-started) and the [hosted agents guide](https://docs.diagrid.io/integrations/microsoft-foundry/hosted-agents) were tested, with its cause and its fix.

To see why a run failed, print the workflow with the Diagrid CLI. The failed step carries the error message and the stack trace:

```bash
diagrid workflow list --project foundry-quickstart
diagrid workflow get <workflow-id> --id travel-planner --project foundry-quickstart
```

## Set up

### `diagrid project create` reports the maximum number of projects

```text
Your organization <organization> has reached the configured maximum number of projects for its
per-region capacity in region <region>, current 3, max 3.
```

Your plan limits the number of projects per region. Delete a project you no longer need with `diagrid project delete <project>`, or create the agent in an existing project and pass its name to `--project`. See [Plans and support](https://docs.diagrid.io/operate/plans-and-support).

### `uv add` says the requirements are unsatisfiable

```text
Because diagrid[langgraph]==0.5.3 depends on your project and your project depends on
diagrid[langgraph]==0.5.3, we can conclude that your project's requirements are unsatisfiable.
```

The project folder has the same name as a package that Diagrid depends on, such as `langgraph` or `crewai`, so `uv` resolves that dependency to your own project. Create the project under another name, such as `travel-planner`.

### The .NET agent stops at startup with `503 (Service Unavailable)`

```text
Hosting failed to start
System.Net.Http.HttpRequestException: Response status code does not indicate success: 503 (Service Unavailable).
   at Dapr.Metadata.Runtime.DaprMetadataProvider.FetchLockedAsync(CancellationToken cancellationToken)
```

The agent started about a minute after its Diagrid project and ID were created, before the project endpoint served requests for the new ID. Wait a minute and run `diagrid dev run` again.

### The agent logs a `FutureWarning` about legacy Dapr extensions

```text
FutureWarning: Legacy Dapr extension distributions installed alongside core dapr
```

The warning comes from the Dapr packages that `diagrid` 0.5.3 depends on. It doesn't affect the agent, and you can ignore it.

## Model calls

### CrewAI fails with `Incorrect API key provided: None`

```text
litellm.AuthenticationError: AuthenticationError: OpenAIException - Incorrect API key provided: None
```

The agent's `llm` is set to `azure/<model-deployment>`. CrewAI removes the `azure/` prefix from the model name, and the Diagrid runner then sends the request to the public OpenAI endpoint without a key. Set `llm` to the deployment name alone and use the `OPENAI_BASE_URL` and `OPENAI_API_KEY` variables from the quickstart.

### Google ADK fails with `'function' object has no attribute 'name'`

```text
AttributeError: 'function' object has no attribute 'name'
```

The agent's tools are plain Python functions. The Diagrid runner for Google ADK needs each tool wrapped in `FunctionTool`:

```python
tools=[FunctionTool(get_weather), FunctionTool(search_flights)],
```

### Google ADK calls the tools without arguments

The run completes, but the answer asks you for the city or the dates, and the history shows the tool steps with empty arguments:

```text
Invoking `get_weather()` failed as the following mandatory input parameters are not present:
city
```

`google-adk` 2.x describes a tool's parameters in a field that `diagrid` 0.5.3 doesn't read, so the model gets the tools without their parameters. Install the 1.x line of `google-adk`, as the quickstart does:

```bash
uv add "diagrid[adk]==0.5.3" "google-adk==1.39.1"
```

### A hosted agent's model call fails with `PermissionDenied`

```text
The principal `<agent-identity>` lacks the required data action
`Microsoft.CognitiveServices/accounts/OpenAI/deployments/chat/completions/action`
```

Without a role, a hosted agent's identity can only use the Responses API of its Foundry project, not the Chat Completions API that LangChain uses by default. Assign the **Cognitive Services OpenAI User** role to the agent identity, as shown in [Give the agent access to the model](https://docs.diagrid.io/integrations/microsoft-foundry/hosted-agents#6-give-the-agent-access-to-the-model). The role can take a few minutes to take effect. Requests in that window fail the same way.

## Runs

### A step fails with `Activity function named '...' was not registered!`

```text
Activity task #5 failed: Activity function named 'call_llm_activity' was not registered!
```

Another process is connected to Diagrid with the same ID and runs different agent code. Diagrid can give any step of a run to any process connected with that ID, so the step went to a process that doesn't know it. Check for:

- A second terminal that still runs another agent with the same `--id`.
- A Foundry hosted agent that uses the same ID. Its sandbox stays connected until its idle timeout, which is 15 minutes by default, even after you delete the agent.

Stop the other process, or wait for the sandbox to expire. Use one ID for each agent implementation.

### Dapr Agents returns an instance ID and no answer

`POST /agent/run` on a Dapr Agents app starts the run and returns at once. Read the answer from the `status_url` in the response, as shown in [Invoke the agent](https://docs.diagrid.io/integrations/microsoft-foundry/getting-started#7-invoke-the-agent).

## Foundry hosted agents

### Deleting the hosted agent returns `409`

```text
Agent has deletion-blocking sessions, including active or non-expired idle sessions.
```

The agent still has sessions. Add `force=true` to the request to delete the sessions with the agent:

```bash
curl -X DELETE "$BASE_URL/agents/travel-planner?api-version=v1&force=true" \
  -H "Authorization: Bearer $TOKEN"
```

### `diagrid app get` says the ID belongs to an agent

```text
Failed to get App: "travel-planner-hosted" is not an App: it belongs to Agent "travel-planner-hosted"
```

An ID that you created with `diagrid agent create` is read with `diagrid agent get`, which also prints its API token:

```bash
diagrid agent get travel-planner-hosted --project foundry-quickstart
```
