Agency
Remote Dynamic!
Install / Use
/learn @UlyssesWu/AgencyREADME
Agency
Nobody outruns the Agency. - Benjamin Travis, Division chief of ICA
Agency is a .NET lib for Remote Dynamic.
It's achieved by Trinity Force: Dynamitey · Serialize.Linq · ExpressionTree
Agent and Handler works in unity. - Diana Burnwood, ICA Handler
Agency works on .NET and mono(Unity). .NET Core is not supported currently because it has neither .NET Remoting nor WCF Server support.
Remote Dynamic? WTF?
Remote Dynamic means to share objects between processes (usually using .NET Remoting) without the type to be known (using dynamic instead). It will be useful when the type is complex or changes frequently.
Demo
Server:
class Agent47
{
public string Weapon { get; set; } = "Fiber Wire";
public void PointShooting(int enemy)
{
Console.WriteLine($"Target eliminated: {enemy}");
}
}
static void Main(string[] args)
{
var agent = new Agent47();
Agency.RegisterAgent("47", agent, new IpcHandler());
Console.ReadLine();
//Run Client here
Console.WriteLine($"Current Weapon: {agent.Weapon}"); //weapon changed to `Silverballer`
Console.ReadLine();
}
Client:
static void Main(string[] args)
{
dynamic agent;
try
{
agent = Agency.SpawnAgent("47", new IpcHandler());
}
catch (Exception e)
{
Console.WriteLine(e);
return;
}
Console.WriteLine($"Current Weapon: {agent.Weapon}"); //get
var weapon = "Silverballer";
agent.Weapon = weapon; //set
for (int i = 0; i < 5; i++)
{
agent.PointShooting(i); //Called on server
}
Console.ReadLine();
}
Here is another demo to show how you can share an object between an Unity(mono) program and a .NET(CLR) program, to implement a chat system with comfortable syntax.

Handler
Handler implements the communication way between processes.
Currently Agency has implemented IpcHandler(faster but only for local CLR & Windows) and TcpHandler (slower but mono compatible) which uses .NET Remoting IPC. You can implement your handler as well.
Events
You can subscribe a server object's event using a client method. When event is triggered on server, the method executes on client. (The subscription can be slow!)
Even more, you can also subscribe a server object's event using Expression<T> and it will be compiled and executed on server!
by Ulysses (wdwxy12345@gmail.com)
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
