Hugging Face Agents Course Quiz — Inference API Connection Error

Hello Hugging Face team,

I’m currently taking the Agents Course, Unit 2 — smolagents, and I’m working on the “Create a Basic Code Agent with Web Search Capability” challenge.

When I submit my solution, the quiz gives me this warning:

Error generating feedback: MaxRetryError('HTTPSConnectionPool(host=\'api-inference.huggingface.co\', port=443): Max retries exceeded with url: /models/Qwen/Qwen2.5-Coder-32B-Instruct (Caused by NameResolutionError: Failed to resolve \'api-inference.huggingface.co\' ([Errno -5] No address associated with hostname))')

The error appears to indicate that the quiz environment cannot resolve or connect to api-inference.huggingface.co.

My code is:

from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel

agent = CodeAgent(
    tools=[DuckDuckGoSearchTool()],
    model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
)

Could you please check whether the inference endpoint or the quiz feedback service is currently experiencing a DNS/network issue?

Thank you!

This looks more like a DNS/network issue in the course quiz environment than an issue with your code. Your HfApiModel usage is valid, and Qwen/Qwen2.5-Coder-32B-Instruct is also the documented default model.

The key part is NameResolutionError for api-inference.huggingface.co, which means the environment cannot resolve the API hostname. I’d report this to the course/Hugging Face team and retry later.

Also, newer versions of smolagents support selecting an Inference Provider explicitly, so this may be worth checking if the course environment has been updated.

I think this is related to a known issue that’s been lingering for a while:


The warning looks much more like a failure in the quiz’s own feedback grader than a failure in your CodeAgent.

The current quiz Space still creates its own InferenceClient, sends your submitted code to Qwen/Qwen2.5-Coder-32B-Instruct, and catches failures from that separate inference call as:

Error generating feedback: ...

You can see that path directly in the current quiz app.py.

So I would not keep changing your exercise code just to make this particular warning disappear.

If your main goal is to continue the course, the simplest option is probably to skip this Final Quiz for now and continue to the next section. The course explicitly describes this quiz as ungraded and uncertified; it is meant as a learning/self-check exercise rather than a certification gate.

If you want to check your answer anyway, I would use the question’s assessment criteria/reference solution as the useful signal rather than treating this connection error as evidence that your answer is wrong.

Why this looks like a long-running grader-side issue

There is a fairly long public history around this same quiz.

2025: the same grader was already failing on the inference call

In Space Discussion #19, reports started in July 2025 with errors against:

https://huggingface.co/static-proxy/api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct

At that point the visible failure was HTTP 404. More users reported the same quiz failure over the following months.

February 2026: an explicit migration problem was identified

There is also an existing PR #23 that proposes a minimal migration toward Inference Providers:

client = InferenceClient(
    model=HF_API_URL,
    provider="auto",
    token=HF_TOKEN,
)

together with an update of huggingface_hub.

That PR is still open and currently shown as Ready to merge.

The important part here is not that this exact patch is necessarily still the final fix in September 2026, but that the quiz’s inference routing problem was already identified months ago.

April 2026: the old endpoint was explicitly returning 410

Space Discussion #26 shows the grader failing with:

410 Client Error: Gone
...
https://huggingface.co/static-proxy/api-inference.huggingface.co is no longer supported.
Please use https://huggingface.co/static-proxy/router.huggingface.co instead.

That makes the legacy-path problem particularly clear for that failure mode.

July 2026: almost the same error as yours

More recently, agents-course issue #709, opened July 16, reports essentially the same quiz, model and hostname with:

NameResolutionError:
Failed to resolve 'api-inference.huggingface.co'

That issue is still open.

So I would not treat the current report as an isolated problem with your local code.

At the same time, I would not assume that the old 404, later 410, and current DNS error all have exactly the same low-level root cause. They are different failure modes.

What they do have in common is that the quiz grader has repeatedly been reaching the old inference path.

Where the failure actually occurs

It may help to separate two paths that look related in the UI but are technically different:

your exercise code / smolagents code
                 |
                 | submitted to the quiz
                 v
             quiz Space
                 |
                 +----> formats/stores your answer
                 |
                 +----> separate grader InferenceClient
                              |
                              v
                    Qwen/Qwen2.5-Coder-32B-Instruct
                              |
                              v
                       generated feedback

The current app.py still contains this separate grader client:

client = InferenceClient(model=HF_API_URL, token=HF_TOKEN)

and later:

response = client.text_generation(
    prompt=prompt,
    grammar={
        "type": "json_object",
        "value": CodeFeedback.model_json_schema(),
    },
)

The exception handler is what produces the warning:

except Exception as e:
    gr.Warning(f"Error generating feedback: {str(e)}")

So the warning you pasted is coming from the feedback-generation request after submission, not directly from execution of your agent code.

The Space itself also warns that the LLM feedback is not authoritative and suggests comparing your work against the assessment criteria if you doubt the feedback.

That is why I would keep the two questions separate:

  1. Does your exercise solution meet the criteria?
  2. Can the quiz’s external LLM grader currently generate feedback?

The error you posted is strong evidence about #2, but not about #1.

What seems to be the current migration direction

The current Hugging Face inference stack is centered around Inference Providers and router.huggingface.co, rather than relying on the old api-inference.huggingface.co path.

The current Inference Providers Hub API can expose, per model/provider, things such as:

  • whether a provider is currently live,
  • which task it serves,
  • context length,
  • pricing,
  • tool support,
  • structured-output support.

That matters because a migration is not quite as simple as replacing one hostname with another: the model, provider, task and requested features still need to be compatible.

I also did a small external smoke test on September 10, 2026 to check whether there is at least a viable current path for the kind of structured feedback this grader needs.

From that environment:

api-inference.huggingface.co
    -> DNS resolution failed

router.huggingface.co
    -> resolved normally

Qwen/Qwen2.5-Coder-32B-Instruct
    -> available through the current router

provider="auto"
    + chat_completion
    + the same kind of Pydantic/JSON Schema output
    -> PASS

explicit nscale provider
    + the same schema
    -> PASS

returned JSON validated again with the Pydantic schema
    -> PASS

Hugging Face’s current Structured Outputs guide documents this kind of chat_completion(..., response_format=json_schema) workflow directly.

So there appears to be a currently working router/provider-based route for the same model and the same general structured-feedback requirement.

I would still be careful about turning that into “replace these two lines and it is guaranteed fixed.”

The official Space has its own:

  • HF_TOKEN,
  • provider permissions/preferences,
  • billing/credits context,
  • dependency versions,
  • runtime environment.

Those are not visible from an external test.

Also, chat_completion + JSON Schema is one current path that I could verify; I would not claim it is the only valid implementation. The more durable requirement is probably:

move the grader away from the obsolete inference path, then test the actual model/provider/structured-output combination end to end.

The existing PR #23 looks like a useful starting point for that migration, but because it was opened months ago I would re-test it against the current provider setup rather than assuming the original minimal patch is still sufficient unchanged.

A practical decision tree

For someone taking the course:

I mainly want to continue learning
    |
    +--> Skip this ungraded quiz for now
         and continue to the next section.

I mainly want to know whether my answer is reasonable
    |
    +--> Compare it with the assessment criteria/reference solution.
         Do not treat the grader connection error as evidence
         that your solution is incorrect.

I specifically want to debug the quiz infrastructure
    |
    +--> api-inference... + HTTP 404/410
    |       |
    |       +--> Check migration away from the legacy inference path.
    |
    +--> api-inference... + NameResolutionError
    |       |
    |       +--> The old hostname/path is still being reached.
    |            The exact low-level DNS cause is a separate question.
    |
    +--> current router/provider path also fails
            |
            +--> Check, in roughly this order:
                 - current provider availability
                 - token/provider permission
                 - model/task compatibility
                 - structured-output support
                 - account/Space billing or credits

For the original question, I think the first branch is the useful default. There is little value in blocking your progress through the course on an ungraded feedback service that already has a public history of related failures.

So, in short: this warning does not look like evidence that your submitted CodeAgent solution is wrong. It looks closely related to the quiz grader’s long-running inference-routing problem.

I would continue with the course for now, and treat fixing the grader as a separate Space/maintainer-side issue. The existing Space discussion, migration PR, and Agents Course issue #709 are probably the most useful places for future readers to follow its status.