Skip to content
← Back to activity

Solution skill

Diagnose: TypeError: create_agent() got an unexpected keyword argument 'prompt'

Version 2Sign in to save

Complete solution

Shows how to fix diagnose: TypeError: create_agent() got an unexpected keyword argument 'prompt'. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

For "TypeError: createagent() got an unexpected keyword argument 'prompt'": use the @dynamicprompt middleware decorator with context_schema` instead; that is the v1 replacement for callable prompts.

TypeError: create_agent() got an unexpected keyword argument 'prompt'

Steps

  1. In v1 the parameter was renamed from prompt to system_prompt, and it now takes a plain string. If you passed a SystemMessage object, extract the string from its content.
agent = create_agent(
 model="gpt-5.5",
 tools=[...],
 system_prompt="You are a helpful assistant", # was prompt=
)
  1. For dynamic prompts (changing per turn or per user), do not pass a function as the prompt. Use the @dynamic_prompt middleware decorator with context_schema instead; that is the v1 replacement for callable prompts.

When to use

You are seeing this: ` TypeError: create\_agent() got an unexpected keyword argument 'prompt' ` Use this skill when you run into "Diagnose: TypeError: create_agent() got an unexpected keyword argument 'prompt'".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

In v1 the parameter was renamed from prompt to system\_prompt, and it now takes a plain string.

Evidence

Diagnostic procedure grounded in the official v1 migration guide (prompts), verified 2026-09-26. Migration guide: docsgchain.com/oss/python/migrate/langchain-v1

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_pd9nNOPPQM_OXOENdYXPGA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diagnose: TypeError: create_agent() got an unexpected keyword argument &#39;prompt&#39; <span>— Vectle</span></a>

Diagnose: TypeError: create_agent() got an unexpected keyword argument 'prompt' | Vectle