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
Thinking about the implementation, I think this would be a pretty big change for module authors. I guess that rather than calling their code directly, they would do something like:
dag.Self?
Or maybe a special extra argument (self, this) -- but this will feel "alien" to the native language
Or through some sorcery in codegen (language specific) to inject some kind of wrappers?
Also, there's the question of state. If the user sets a variable in their own struct/object, is it going to be available to the invoked function?
One idea I really liked is that we could integrate this through the module dependencies - you can install the module as a dependency as itself. So you could do dagger install ..
One reason this is neat, is because then you can name your module of yourself as you like - Self, or This, or even FullNameOfModule. We could pick a semi-reasonable default, but then users can edit their dagger.json config.
R.e. state - I think without a huge rework of the call mechanism, it'll have entirely different state, since it'll be in a different ExecOp. I think that's what we want - it should just be like any other call.
This is super impactful for building agents! Primarily because we want to be able to pass types from our current module to dag.Env.
Talking with @TomChv live, it sounded like there could be some complexity with syncing module state between the current module and handling it somehow through dag.Self, however, I do think a simpler implementation where we just get the current module's types generated in the API would be enough to unlock a ton of potential.
The llm/env aspect (so basically "just" to have the types) is one thing we can start with. It will not allow to have a kind of dag.Self but it will unblock some of the current limitations.
One first thing for that is to decouple the type registration on runtime modules. This is especially true for Go/Java SDK as they generate code for that, so it can be extracted in a different execution path. For python/typescript (I have to check on others) as it's currently done at runtime, it might be different. But maybe that could be a good thing to align all of them.
So we can start by adding a new "capability" to the module runtime, with something like a TypeDefs addition to the interface and handle that in a smooth and backward compatible way.
Then two main questions remain, one regarding the state, one regarding the types. The type returned by the codegen will not be the same as the local type. So it requires a kind of reconciliation between them. Maybe by using interfaces? Interfaces as in the languages, not dagger interfaces. But in a second time, after the types to be available at the codegen/introspection level first.
Activity
aluzzardi commentedon Jul 24, 2024
Thinking about the implementation, I think this would be a pretty big change for module authors. I guess that rather than calling their code directly, they would do something like:
dag.Self?self,this) -- but this will feel "alien" to the native languageAlso, there's the question of state. If the user sets a variable in their own struct/object, is it going to be available to the invoked function?
jedevc commentedon Jul 29, 2024
I'm quite interested in this as well 🎉
One idea I really liked is that we could integrate this through the module dependencies - you can install the module as a dependency as itself. So you could do
dagger install ..One reason this is neat, is because then you can name your module of yourself as you like -
Self, orThis, or evenFullNameOfModule. We could pick a semi-reasonable default, but then users can edit theirdagger.jsonconfig.R.e. state - I think without a huge rework of the call mechanism, it'll have entirely different state, since it'll be in a different
ExecOp. I think that's what we want - it should just be like any other call.kpenfound commentedon Apr 10, 2025
This is super impactful for building agents! Primarily because we want to be able to pass types from our current module to
dag.Env.Talking with @TomChv live, it sounded like there could be some complexity with syncing module state between the current module and handling it somehow through
dag.Self, however, I do think a simpler implementation where we just get the current module's types generated in the API would be enough to unlock a ton of potential.eunomie commentedon May 2, 2025
The llm/env aspect (so basically "just" to have the types) is one thing we can start with. It will not allow to have a kind of
dag.Selfbut it will unblock some of the current limitations.One first thing for that is to decouple the type registration on runtime modules. This is especially true for Go/Java SDK as they generate code for that, so it can be extracted in a different execution path. For python/typescript (I have to check on others) as it's currently done at runtime, it might be different. But maybe that could be a good thing to align all of them.
So we can start by adding a new "capability" to the module runtime, with something like a
TypeDefsaddition to the interface and handle that in a smooth and backward compatible way.Then two main questions remain, one regarding the state, one regarding the types. The type returned by the codegen will not be the same as the local type. So it requires a kind of reconciliation between them. Maybe by using interfaces? Interfaces as in the languages, not dagger interfaces. But in a second time, after the types to be available at the codegen/introspection level first.