N8n Agent Builder fails with invalid `get_environment` schema using a custom OpenAI-compatible API

Hello n8n community,

I’m building an AI assistant for my website using n8n Cloud’s Agent Builder, and I’m encountering a schema validation error when testing the agent with a custom OpenAI-compatible API provider (NetArz).

Error message:

Invalid schema for function 'get_environment': [] is not of type 'object'.

My setup:

  • Platform: n8n Cloud

  • Agent: A new test agent with no user-added tools, sub-agents, or skills

  • Model: gpt-5.6-terra

  • Credential: An OpenAI-compatible credential configured for NetArz

  • Test prompt: A simple Persian greeting

  • Agent instructions: Reply in Persian with a fixed greeting. No external actions are required.

What I’ve tried:

  1. Created a new, isolated test agent.

  2. Removed the WordPress and WooCommerce tools from my original agent temporarily.

  3. Confirmed that the test agent uses the intended model and credential.

  4. Repeated the test with the isolated agent, but the same error persists.

The credential connection test reports success, but the agent preview still fails with the schema validation error above.

My questions:

  1. Is get_environment an internal function automatically added by n8n’s Agent Builder?

  2. Why might its schema be rejected when using a custom OpenAI-compatible endpoint?

  3. Is there a supported way to disable this function or correct its schema?

  4. Does this setup require a particular API compatibility mode or model configuration?

I would appreciate any suggestions for diagnosing this issue. I want to resolve it without changing or disrupting my existing WordPress and WooCommerce integrations.

Thank you!

Hey @katilon ,
The get_environment is an internal tool n8n adds even to an agent with no user tools. Its input is an empty object schema. Agent Builder doesn’t expose a toggle or schema editor for it, and the credential test only checks /models, not function calling.

Current Agent Builder probes the Responses API first for custom OpenAI endpoints; a schema rejection doesn’t trigger the missing-route fallback to Chat Completions. NetArz advertises tool support for your model, but the actual forwarded schema needs checking. Ask NetArz to compare the received and forwarded get_environment definition, particularly whether an empty object like properties: {} becomes []. That’s a possibility, not a confirmed cause. You can leave WordPress and WooCommerce untouched. Can you share the full error response and your n8n version?

n8n’s tool definition

Hey @katilon, yeah, get_environment is an internal Agent Builder tool, so you can hit this with zero custom tools. One isolation check that often clarifies it: run the same empty agent against OpenAI’s official endpoint, then against NetArz with the same prompt. If only NetArz fails, the empty-object schema is probably rewritten on their side (properties: {} turning into ). If both fail, it’s more likely on n8n’s side. Worth pasting the full JSON error body (redact keys). I’m not on NetArz, so treat the rewrite guess as a hypothesis.

Hello @katilon. One thing I’d check before changing anything else: does the full error identify which field contains []? That would help narrow down what’s being rejected.

As mentioned above, get_environment is built into Agent Builder, so it can appear even with no tools added. The error alone doesn’t tell us whether n8n sent an invalid schema or NetArz changed it along the way.

Could you share your n8n version and the full error body, with secrets removed? If NetArz can check the tool definition they received, that would be useful too. Your isolated test agent should be enough for this—no need to remove anything else from your WordPress/WooCommerce setup.

@katilon One more isolation path that often helps when Agent Builder + a custom OpenAI-compatible provider disagree on tool schemas:

Rebuild the same empty agent as a normal workflow using the classic AI Agent node + an OpenAI-compatible Chat Model credential pointed at NetArz (same model id if possible). If that path works while Agent Builder fails, the problem is more likely in how Agent Builder probes the Responses API / ships get_environment, not in your WordPress/WooCommerce setup.

Others already covered that get_environment is internal and that an empty object schema can get rewritten on the provider side. To pin it down, could you paste (redacted) the full error JSON body and which n8n Cloud version you’re on? If NetArz can show the tool definition they actually received for get_environment, that would settle whether properties: {} became [].

One refinement to this comparison: the current AI Agent node requires at least one tool, so use Basic LLM Chain for a baseline without tools.

  1. Connect Chat Trigger to Basic LLM Chain, with an OpenAI Chat Model configured for NetArz. Keep the same model and greeting; turn Use Responses API off to test Chat Completions.

  2. Test tool calling separately with AI Agent plus Calculator. Ask it to use Calculator and confirm a tool execution occurred.

  3. Ask NetArz to compare the received and forwarded get_environment schema. Include your n8n version and full redacted error.

A working chain confirms basic chat only. A working Agent workflow still doesn’t establish Agent Builder compatibility because its tools and API path may differ. Treat an empty object becoming an array as a hypothesis until the payload identifies the field. These isolated checks don’t require changing WordPress or WooCommerce.