Replies: 5 comments 1 reply
-
Thanks @albertpod. This is very exciting, I would like to help out with this. Standardizing the agent creation API will be an immensely valuable contribution! I've begun some very tentative explorations in this direction by investigating how best to hook up an RxInfer model within an RxEnvironments agent/environment dyad. @wouterwln has been invaluable counsel to that end. You can access my repo of these explorations here. TL;DR on my musings is: yes, a standard imperative main loop is probably best for initial implementation and no, I have not managed RxInfer model integration yet. I'll enumerate my thoughts and responses to your specifics as per their level of abstraction. Global ConsiderationsThe most abstract consideration that I would like to raise is where best to implement this agent API. Within RxInfer.jl (proper) or say RxEnvironments.jl? Should this even constitute a totally new package: "RxAgents.jl"; using RxInfer.jl and RxEnvironments.jl as dependencies? Personally, I think that it might be wisest to implement this in a new "RxAgents.jl" package. An "RxAgents.jl" agent could then fairly seamlessly instantiate an RxEnvironments.jl RxEntity. With the subsequent specification of the environment "Entity" and the definition of the interface functions from RxEnvironments, the full dyad would be complete - regardless of the commitment to an imperative/reactive paradigm. Core Agent InterfaceI like this proposed structure. I'm afraid I don't have any other thoughts on this right now. Key Operations
Open Questions:
Final Comments:Regarding the overall structure, I have no enlightening comments. I do wonder how/if specific methods will have to change to deal with reactivity. I think it is best to focus on an imperative implementation first. I can't think of any additional operations that might be nice to include, other than to perhaps optionally record the agent's history of states in addition to its current state. I haven't found/used any alternative approaches though @kobus78 may well have done so in the course of his extensive implementations. Regarding integration with RxEnvironmnments, I am very much in favour of this. I think that the agent API could neatly constitute an RxEntity and it seems to me that the question of multiple agent support could be partitioned off to RxEnvironments. I am very keen to assist with any aspect of this endeavour, going forward. I hope these thoughts are somewhat useful. |
Beta Was this translation helpful? Give feedback.
-
Thanks for bringing this @albertpod! I also mostly agree with @FraserP117, but I would still make some practical changes to the for loop, as it looks quite odd to me. Why the return value of the Of course, I know the answers to these questions, but it would be better if they didn’t arise in the first place. Here’s my proposed revision, which addresses these concerns: agent = Agent()
environment = Environment()
# Main agent loop
for t in 1:n_steps
# Prepare for the next time-step, can do nothing on the first iteration
# and "slide" on the next ones or do whatever it wants essentially
prepare!(agent)
# IMO `plan` should return "something", namely a "plan" or a series of actions
actions = plan!(agent, horizon=10)
# Execute next action (either first, or some other "picking" mechanism)
act!(environment, agent, first(actions))
# Get environment feedback, different agents observe different stuff
observation = observe!(environment, agent)
# Update agent's beliefs about the internal state of the world to be able to `act!` later on
learn!(agent, observation)
end which translates to the following core API:
prepare!(agent::BayesianAgent) -> Nothing
plan!(agent::BayesianAgent, horizon::Int) -> Vector{Action}
act!(environment::Environment, agent::BayesianAgent, action::Action) -> Nothing (or Success/Fail status?)
observe!(environment::Environment, agent::BayesianAgent) -> Observation
learn!(agent::BayesianAgent, observation::Observation) -> Nothing I don't have a strong opinion on whenever to use We also need some feedback from @wouterwln since he designed the API for RxEnvironments.jl and perhaps my proposal does not perfectly align with the API in RxEnvironments.jl. |
Beta Was this translation helpful? Give feedback.
-
I'll try to structure my feedback as well as I can. I like the idea of the API, and I think indeed, as Fraser said, we should incorporate it in a separate package
Now we have to think about some stuff. In my current POMDP implementation, I have the following structure:
(Ignoring backwards messages from the planning stage towards
And most of this is stuff we can hide. Let's discuss what we can hide and what we cannot. The API for
or something similar, at least a direct alias. This will trigger the environment to send an observation back to the agent which can be accessed either explicitly, or we can subscribe to it. In the end we can also do something like this:
And do some smart stuff with receding time horizons and such. RxEnvironments keeps these options open for you and I think we can write boilerplate on top of RxInfer and RxEnvironments which marries these interfaces. Let me know what you guys think. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your work on this and acceptance of feedback. I am in much agreement with prior points, especially Albert's loop logic/ordering (the
I've given a fair amount of feedback on this so, just wanted to really share my thoughts on these other ends while I'm still available. Again, great work, will watch developments. |
Beta Was this translation helpful? Give feedback.
-
I would love to see this standardization effort embrace an even wider scope. As I see it, the
As 'traditional' machine learning seems to grow towards the bayesian approach, I would love to see our thinking also embrace the above so that the API will be generic enough, in both semantics and syntax, to cover all of the above. Indeed there are examples available already that showcase the applicability of RxInfer to the non-sequential areas. I think RxInfer could really become the tool for everyone, especially now that a Python implementation is also planned. Here is an example of what I mean. To consider the next data point in the case of:
To get a fuller picture of my thinking, please have a look at the following 2 posts, in particular the section 'Symbols/Nomenclature/Notation (KUF)' as well as the section 'MODELING' where the implementation happens: https://learnableloop.com/posts/LitterModel_PORT.html Best wishes with your valuable work! |
Beta Was this translation helpful? Give feedback.
-
We're looking to establish standardized APIs for implementing Bayesian (AIF) agents using RxInfer. While there's ongoing research about the implementation details of planning functions, having a clear interface would help developers start building agents with our toolbox.
Current State
Currently, we have scattered examples like the mountain car and drone simulations that demonstrate agent capabilities, but they lack a developer-friendly API structure. The implementations mix concerns and require deep understanding of the internals.
Proposed API Structure
Here's a proposed high-level API structure for discussion:
Core Agent Interface
Key Operations
I propose standardizing these core operations:
Example Usage
Note: The following examples use an imperative loop structure for clarity. Our end goal is to provide a fully reactive implementation. These examples serve as a conceptual starting point to illustrate the core operations.
Open Questions
Configuration Options: What configuration options should be available?
Multi-Agent Support: How should we extend this API for multi-agent scenarios?
Request for Comments
We'd love to hear your thoughts on:
RxEnvironments.jl
Please share your experiences and suggestions below!
Note: This is an initial proposal to start the discussion. All interfaces are subject to change based on community feedback and practical implementation experience.
Beta Was this translation helpful? Give feedback.
All reactions