OpenGameAgent: A C# Runtime for AI NPCs That Keeps the Game in Charge
Open-source C# agent runtime for AI-native games, autonomous NPCs, and interactive worlds. Structured context, tools, memory, multi-NPC scheduling, and durable game actions.
At a glance
- What is it?
- OpenGameAgent is an open-source C# agent runtime for AI-driven NPCs and in-game agents. It runs ReAct tool loops, supports durable plans and multi-NPC scheduling, and keeps the game authoritative over all state changes.
- Who is it for?
- Adopt OpenGameAgent if you are building a game in C# with Godot, Unity, or a .NET server and need NPCs that reason and act beyond dialogue, with the game retaining final authority. Skip it if you want a plug-and-play dialogue system or expect a bundled model; you must wire your own model API and define all tools.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 4 days ago.
- What is it written in?
- Mainly C#, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 11, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What OpenGameAgent Solves and Who It Is For
OpenGameAgent addresses a specific gap in game development: turning a language model into an actor that can do things, not just talk. A typical dialogue-only NPC reads the latest chat line and produces the next one. That works for simple conversations but fails when a character needs to reason about world state, call game functions, or pursue a goal across many turns. OpenGameAgent replaces that with a bounded ReAct loop where the model can emit tool calls, the runtime executes them, and the game validates every mutation. The target audience is C# game developers using Godot, Unity, or a .NET server who want autonomous NPCs, simulation agents, or interactive world systems. It is explicitly not an AI coding agent and not a game generator. The README is clear about that boundary, so do not come here expecting a content creation tool.
The Kernel and the ReAct Loop: How It Actually Works
The design centers on a compact kernel that runs the model/tool loop. Every input enters the same Agent loop. If the model returns an assistant message, the turn ends immediately. If it returns tool calls, the runtime executes the authorized tools, appends their structured results, refreshes game context, and continues. There is no complexity classifier and no separate Quick/Agent/Plan engine. That is a deliberate simplification. The documentation stresses that the kernel boundary is intentionally small and meant to stabilize early. New capabilities belong in extensions, tools, policies, or game-owned services, not in the loop itself. The loop is bounded, which means the runtime does not let the model run forever. The game remains authoritative over every state change because tools are game-owned and the model never directly mutates state. This separation is the core architectural bet.
Structured Context, Memory, and Durable Plans
Inputs to the agent are bounded JSON plus optional durable image observations. That JSON can represent dialogue, combat state, simulation ticks, UI events, sensor data, or screenshots. Natural language is optional. This is a key difference from chat-based agents: the context is structured and game-owned, not a wall-clock chat history. The runtime can reason against game time, timelines, save/session identity, actor identity, and scoped memory. For complex tasks, the optional runtime adds persistent goals and ordered plans that survive later inputs. Plans can wait for game events, preserve completed steps, and replace unfinished work when new evidence invalidates the original approach. That is a durable planning model, not just a one-shot decomposition. The README gives an example of a plan adapting to new evidence, though it does not detail the exact data structures. The memory project supports BGE-M3 INT8 embeddings via an optional ONNX project, but model weights stay game-owned.
Installation and Integration Paths
The README offers several installation routes. For Unity 6, you can install the complete 0.3.0-alpha.4 package directly from an immutable GitHub UPM tag: https://github.com/EricSun0218/OpenGameAgent.git#upm/0.3.0-alpha.4. The same release is available via OpenUPM with the command openupm add [email protected]. For C# and Godot development, the current source line requires a pinned source checkout and project references. The README shows an XML snippet with ProjectReference elements for OpenGameAgent.csproj, OpenGameAgent.Memory.csproj, and optional projects like OpenGameAgent.Memory.Onnx.csproj for in-process BGE-M3 INT8 embeddings. The paths must be adjusted relative to your game project. The release pipeline binds every artifact to one source commit and generates RELEASE_MANIFEST.json plus SHA256SUMS.txt for verification. That is a concrete integrity measure, though the README does not show the full manifest format.
Engine Support and Runtime Protocol
OpenGameAgent runs inside Godot or Unity, behind a native Unreal Engine client, or in a .NET game server or sidecar. That covers most serious game engines. The runtime protocol uses versioned communication. The current version is Runtime Protocol v1, which uses capability negotiation for additive features. Any change to required fields, enum meaning, cursor semantics, or lifecycle ordering requires a new protocol version. That is a strong compatibility promise for a pre-1.0 project. The optional game runtime adds sessions, actors, game timelines, memory, plans, multi-NPC scheduling, engine-thread handoff, and durable action receipts. The multi-NPC scheduling serializes each actor while allowing bounded concurrency across many NPCs. That is important for games with many agents, because it prevents one actor's tool loop from blocking another entirely. The README does not specify the concurrency limits, so you would need to test that yourself.
Limitations and Cases Where It Is the Wrong Tool
OpenGameAgent is not a dialogue system. If your game only needs scripted conversations, this runtime adds unnecessary complexity. It also does not bundle a model. You must supply your own cloud or local API endpoint. That means you handle model latency, cost, and failure modes. The README warns that public APIs can change before 1.0, and the current source is a pre-release at 0.3.0-alpha.4. For shipped games, you must pin an immutable tag or source commit. That is a real maintenance burden. Another limitation is the learning curve: you must define game-owned tools for every action the NPC can take. The README lists move, inspect, trade, build, schedule, recruit, and investigate as examples, but each requires implementation. The durable planning extension is optional and only exposed when the host grants persistent-planning capability. If you do not need long-term goals, you may not need that extension, but you still pay for the kernel.
A Real Alternative: Plain Tool Calling in a Game Loop
The most direct alternative is to skip a dedicated agent runtime and implement tool calling yourself. Many game developers already have a game loop that processes player actions. You could send the current game state as JSON to a model API, receive tool calls, and execute them in your own code. That approach gives you full control over the loop, and it works in any engine and language. The difference is that OpenGameAgent provides a tested, bounded loop with structured context refresh, tool result handling, and durable planning. It also offers multi-NPC scheduling and action receipts, which are hard to get right on your own. The trade-off is that a hand-rolled loop is simpler to debug and has no dependency on an alpha library. But you lose the runtime's guarantees about serialization, retries, and plan adaptation. The README's comparison table highlights that a custom loop often repeats a write after a timeout, while OpenGameAgent journals state-changing intents and reconciles authoritative receipts before retrying. That is a concrete advantage if your NPCs perform state-changing actions.
Maintenance, Licensing, and Upgrade Costs
The project is licensed under MIT, which is permissive for commercial games. The README does not detail the license implications beyond the license file, so consult the LICENSE file for specifics. Maintenance cost is tied to the alpha status. The public APIs can change before 1.0, so every upgrade may require code changes. The release pipeline helps by binding artifacts to commits and generating checksums, but you still need to track new versions. The runtime protocol v1 is designed for additive changes, which reduces the risk of breaking changes within that version. However, the README does not state how often releases happen or how long the alpha phase will last. The last push was 2026-08-15, and the latest release is 0.3.0-alpha.2, though the README mentions 0.3.0-alpha.4 as the current source. That discrepancy suggests the source is ahead of the published release, so you may need to build from source to get the latest features. Plan for that extra step.
Editorial conclusion
Adopt OpenGameAgent if you are building a game in C# with Godot, Unity, or a .NET server and need NPCs that reason and act beyond dialogue, with the game retaining final authority. Skip it if you want a plug-and-play dialogue system or expect a bundled model; you must wire your own model API and define all tools. Before committing, verify the current alpha API stability, pin an immutable tag or commit for shipped games, and check the runtime protocol version for compatibility with your engine. The project is pre-1.0, so plan for API changes and prefer the UPM package for Unity 6.
Frequently asked questions
How do I run the OpenGameAgent local example?
Use Node.js 24.15.0, also recorded in .nvmrc, and npm 11.12.1, then clone, run npm ci, npm run build and npm run example:local. The example registers one character, submits a game input and prints its reply using a deterministic model fixture and an in-memory event store, so it needs no API key or network access.
Is OpenGameAgent written in C# or TypeScript?
The current source tree is TypeScript, and the README says so. The project records C# as its primary language, but the versioned packages and releases from the earlier C# implementation remain in Git history and on the Releases page without describing the TypeScript tree.
How many agent loops does OpenGameAgent run?
One. The runtime hosts a single message-or-tool agent loop while the game stays responsible for rules, permissions, authoritative state and world writes, and packages such as realtime, extensions, delegation and observations are described specifically as not introducing another loop.
Can I install the OpenGameAgent packages from npm?
Not from this tree. The TypeScript workspaces ship as source and their private package flag prevents accidental npm publication, which the README says does not limit the MIT licence. Integrating means cloning and building, and pinning a commit.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/ericsun0218-opengameagent)