Skip to content

Commit

Permalink
Copybara import of the project:
Browse files Browse the repository at this point in the history
--
25d07e3 by Emmanuel Ferdman <emmanuelferdman@gmail.com>:

update agent scripts

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
COPYBARA_INTEGRATE_REVIEW=#100 from emmanuel-ferdman:main 25d07e3
PiperOrigin-RevId: 698012808
Change-Id: I3691fe51876a88f57a06c0791f1f71f4e110bc11
  • Loading branch information
emmanuel-ferdman authored and copybara-github committed Nov 19, 2024
1 parent 9dd73cc commit b4b380b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/tutorials/agent_components_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,15 @@
"\n",
"**WARNING**: Accessing other components internals is dangerous!\n",
"\n",
"A component can use the above methods to get another component and call any of its methods. This is very powerful, but dangerous. Recall that we have no guarantees over which order components are getting processed. For instance, what would happen if a component is adding memories in `pre_act` when other components are reading the memory. The component could be in an inconsistent state! Fortunately the [`MemoryComponent`](https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/v2/memory_component.py) deals with this by buffering the added memories, only committing them during the `UPDATE` phase. If you try to access the memory during this phase, it will raise an error.\n",
"A component can use the above methods to get another component and call any of its methods. This is very powerful, but dangerous. Recall that we have no guarantees over which order components are getting processed. For instance, what would happen if a component is adding memories in `pre_act` when other components are reading the memory. The component could be in an inconsistent state! Fortunately the [`MemoryComponent`](https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/memory_component.py) deals with this by buffering the added memories, only committing them during the `UPDATE` phase. If you try to access the memory during this phase, it will raise an error.\n",
"\n",
"# An agent with relevant memories\n",
"\n",
"The problem with our agent above is that critical information is being lost! :(\n",
"\n",
"To fix this, we need a component that takes recent observations (memories), and then searches the memory bank for relevant memories. This creates a dependency of one component's state into another component. But above we just talked about how this is dangerous, so how do we fix it?\n",
"\n",
"When a component's `pre_act` does not take into account the `action_spec` for producing its context, we can derive the component from the [`ActionSpecIgnored`](https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/v2/action_spec_ignored.py) base class. Then, instead of overriding `pre_act` we override `_make_pre_act_value()` (that doesn't take an `action_spec`) and the base class makes sure everything is handled correctly with concurrency.\n",
"When a component's `pre_act` does not take into account the `action_spec` for producing its context, we can derive the component from the [`ActionSpecIgnored`](https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/action_spec_ignored.py) base class. Then, instead of overriding `pre_act` we override `_make_pre_act_value()` (that doesn't take an `action_spec`) and the base class makes sure everything is handled correctly with concurrency.\n",
"\n",
"It is that simple! :)"
]
Expand Down

0 comments on commit b4b380b

Please sign in to comment.