{"record":{"id":"e1a875adc39d50ab","repo":"langchain-ai/deepagents","slug":"unsupported-ptc-config-type-use-a-list-of-tool","errorCode":null,"errorMessage":"Unsupported `ptc` config type. Use a list of tool names, list of BaseTool instances, or disable PTC.","messagePattern":"Unsupported `ptc` config type\\. Use a list of tool names, list of BaseTool instances, or disable PTC\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/partners/quickjs/langchain_quickjs/_ptc.py","lineNumber":116,"sourceCode":"        selected = [\n            *explicit_tools,\n            *[t for t in tools if t.name != self_tool_name and t.name in allow_names],\n        ]\n        deduped: list[BaseTool] = []\n        seen_names: set[str] = set()\n        for tool in selected:\n            if tool.name in seen_names:\n                continue\n            seen_names.add(tool.name)\n            deduped.append(tool)\n        selected = deduped\n        _raise_on_invalid_ptc_tools(selected)\n        return selected\n    msg = (\n        \"Unsupported `ptc` config type. \"\n        \"Use a list of tool names, list of BaseTool instances, or disable PTC.\"\n    )\n    raise TypeError(msg)\n\n\ndef to_camel_case(name: str) -> str:\n    \"\"\"Convert `snake_case` / `kebab-case` → `camelCase`.\"\"\"\n    return _prompt.to_camel_case(name)\n\n\ndef is_valid_js_identifier(name: str) -> bool:\n    \"\"\"Return whether `name` is a valid JavaScript identifier.\"\"\"\n    return _prompt.is_valid_js_identifier(name)\n\n\ndef is_valid_ptc_tool_name(name: str) -> bool:\n    \"\"\"Return whether a tool can be exposed as `tools.<camelCaseName>`.\"\"\"\n    return _prompt.is_valid_ptc_tool_name(name)\n\n\ndef _raise_on_invalid_ptc_tools(tools: Sequence[BaseTool]) -> None:","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/partners/quickjs/langchain_quickjs/_ptc.py#L98-L134","documentation":"The `ptc` option accepts only `True`/`False`, a list of tool names, or a list of BaseTool instances (and list forms handled above); any other config type is rejected with TypeError so misconfiguration fails loudly instead of silently disabling PTC.","triggerScenarios":"Passing e.g. `ptc=\"websearch\"`, `ptc={\"include\": [...]}`, `ptc=None`, or a set to the agent's `ptc` parameter, reaching `filter_tools_for_ptc`'s fallthrough.","commonSituations":"Passing a single tool name string instead of a one-element list; dict-style include/exclude configs modeled after other frameworks; YAML/JSON values deserialized to unexpected types.","solutions":["Wrap a single tool name in a list: `ptc=[\"websearch\"]`","Use `ptc=True` / `ptc=False` to enable/disable all tools","Remove dict wrappers and supply a plain list of names or BaseTool instances"],"exampleFix":"# before\nptc=\"websearch\"\n# after\nptc=[\"websearch\"]","handlingStrategy":"type-guard","validationCode":"if not (isinstance(ptc, bool) or (isinstance(ptc, list) and all(isinstance(x, (str, BaseTool)) for x in ptc))):\n    raise TypeError(f\"invalid ptc config: {type(ptc).__name__}\")","typeGuard":"def is_valid_ptc_config(ptc: object) -> TypeGuard[Union[bool, list]]:\n    if isinstance(ptc, bool):\n        return True\n    return isinstance(ptc, list) and all(isinstance(x, (str, BaseTool)) for x in ptc)","tryCatchPattern":"try:\n    agent = QuickjsAgent(ptc=ptc_config)\nexcept TypeError as e:\n    if \"Unsupported `ptc`\" in str(e):\n        if isinstance(ptc_config, str):\n            ptc_config = [ptc_config]\n        agent = QuickjsAgent(ptc=ptc_config)\n    else:\n        raise","preventionTips":["Wrap single tool names in a list before passing","Parse dict-style configs into the supported list form yourself","Validate ptc config shape at config-load time with a schema"],"tags":["ptc","type-error","config","validation"],"backgroundTag":"invalid-argument-type","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}