logoalt Hacker News

angrysaki • today at 1:28 AM • 1 reply • view on HN

I'm just starting to get a handle on how to use agents, can you give a short description of how you get your agents to use csharprepl


Replies

CharlieDigital • today at 1:55 AM

I have more detail written up here: https://chrlschn.dev/blog/2026/08/the-unexpected-ai-stack-cs...

But the gist of it is that I wire it up through Aspire (don't need to, but makes it nice) to set the environment variable on my main app host. Then the agent can run `csharprepl` commands directly via CLI and read/mutate the running application state directly via the service provider (DI container)

I have a small set of utility functions to access the DI container with common patterns like creating a scope for scoped services: https://github.com/zeeq-ai/zeeq-app/blob/main/src/backend/Ze... (optional, but useful)

And a skill: https://github.com/zeeq-ai/zeeq-app/blob/main/.agents/skills... (also optional, but cuts down on agents relearning the #wrap and #replace behavior)

I recommend you "train" the skill like I do in my the blog post. Basically ask the agent to get an instance of an object from DI like a repository class or your DbContext and have it perform some operations. Have it wrap a function and add logging. Have it replace a function. Then once it learns how to do this, have it write the skill bespoke to your project.

I strongly recommend that you try it "by hand" one time via blog of CSharpRepl author: https://fuqua.io/blog/2026/06/injecting-a-csharp-repl-into-a... If you try it manually one time, it clicks what the agent is doing and why it is so powerful (because the agent accesses and modifies the running application state without a compile).

➕ show 1 reply