Dynamic proxies for agents
bojidar-bg opened this issue · 0 comments
bojidar-bg commented
It might be nice to have a dynamic
proxy for IAgent
-s, so that code which uses a remote agent is cleaner.
For example, this would allow writing:
dynamic agentProxy = ...;
Assert.Equals((int)await agentProxy.Neg(1), -1);
Assert.Equals((int)await agent.Add(1, 2), 3);
await agent.Print("test");
instead of:
IAgent agent = ...;
Assert.Equals(await agent.CallFunctionAsync<int>("Neg", 1), -1);
Assert.Equals(await agent.CallFunctionAsync<int>("Add", (1, 2)), 3);
await agent.CallActionAsync<int>("Print", "test")
(Note that for return types, we should probably use a second dynamic proxy as outlined in this StackOverflow question; see also #75)