Commit 50ac799
fix: Ensure agent names are valid Python identifiers for AutoGen v0.4
AutoGen v0.4 requires agent names to be valid Python identifiers,
but role names like ''Narrative Designer'' contain spaces which are invalid.
- Added sanitize_agent_name_for_autogen_v4() function to convert any
string to a valid Python identifier
- Applied sanitization only in AutoGen v0.4 code path for backward compatibility
- AutoGen v0.2 and other frameworks remain unchanged
- Handles spaces, special characters, Python keywords, and edge cases
Resolves issue where ''Narrative Designer'' role causes error:
''The agent name must be a valid Python identifier''
Co-authored-by: Mervin Praison <[email protected]>1 parent 93e2c0c commit 50ac799
1 file changed
+38
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
85 | 121 | | |
86 | 122 | | |
87 | 123 | | |
| |||
471 | 507 | | |
472 | 508 | | |
473 | 509 | | |
| 510 | + | |
474 | 511 | | |
| 512 | + | |
475 | 513 | | |
476 | 514 | | |
477 | 515 | | |
| |||
0 commit comments