Code Monkey home page Code Monkey logo

agents's People

Contributors

devoncarew avatar gaaclarke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

agents's Issues

Question: async computation in the agent

Hi!

I'm trying to use isolate_agents but it's unclear to me how to deal with asynchronous computation in the isolate.

For example, how would you rewrite this function in the Romeo & Juliet example if you couldn't use *Sync variants of file functions?

  agent.update((state) {
    File file = File('${state.documentsDir!.path}/$index.rot');
    if (file.existsSync()) {
      String encoded = file.readAsStringSync();
      return _DecoderState(state.documentsDir, _rot13Decode(encoded));
    } else {
      return _DecoderState(state.documentsDir, null);
    }
  });

Or, for a simplified example, how can I do something like the following?

agent.update((result) async => result += await Future.delayed(Duration(seconds: 1), () => 42));

Questions about Isolate Groups and "move" operator

(Context: I've learned a bit about parallelism in general and in Dart but don't have much hands-on experience)

isolate_agents looks like an awesome implementation of the Actor pattern! Thanks for implementing and sharing it, especially the nice write up and example use-cases in your Medium post and this repo.

I had a few thoughts / questions:

  • You mentioned that controlling the lifecycle of isolates is a benefit of isolate_agents compared to Flutter's .compute(). How do Agents relate to isolate groups? I remember hearing exciting stuff ~18 months ago about how much isolate groups would reduce the cost of spinning up new isolates. With Agents, would you create a pool of long-running agents and send work to them?

    • I don't even know enough about this to know what I'm asking, but it seems like there could be some interesting interactions between agents and isolate groups.
  • Another performance consideration you mentioned is the need for a "move" operator to allow constant time communication between isolates. Again I'm not familiar with how this all works, but I thought you might be interested in this Rust crate that generates FFI bindings and allows "zero copy returns over the FFI boundary". It would be awesome to use Dart everywhere (with agents?) instead of Rust for high-performance parallelism. Just thought I'd share in case that approach is of interest. (I love how you took inspiration from Clojure for isolate_agents)

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.