You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migration guide: Update automatic unique_id assignment with clearer examples (#2419)
Improve the automatic unique_id assignment section in the migration guide with clearer before/after examples. Show both positional and keyword argument cases for agent initialization and super() calls. Add important notes about deprecation warnings and custom ID storage.
2.`Model.next_id()` is deprecated and will always return 0. Remove any calls to this method.
83
-
3.`unique_id` is now unique relative to a Model instance and starts from 1.
84
-
4. If you previously used custom `unique_id` values, you'll need to store that information in a separate attribute.
85
-
5. Deprecation warning: Initializing an agent with two arguments (`unique_id` and `model`) will raise a warning. The `unique_id` argument will be ignored.
85
+
86
+
2. Remove `unique_id` from Agent super() call:
87
+
```python
88
+
# Old
89
+
classMyAgent(Agent):
90
+
def__init__(self, unique_id, model, ...):
91
+
super().__init__(unique_id, model)
92
+
93
+
# New
94
+
classMyAgent(Agent):
95
+
def__init__(self, model, ...):
96
+
super().__init__(model)
97
+
```
98
+
99
+
3. Important notes:
100
+
-`unique_id` is now automatically assigned relative to a Model instance and starts from 1
101
+
-`Model.next_id()` is removed
102
+
- If you previously used custom `unique_id` values, store that information in a separate attribute
0 commit comments