Patterns
Keep agent definitions focused and easy to maintain as your application grows.
Move beyond inline registration when definitions become difficult to review. Keep configuration separate from the application operations an agent can request.
Put a definition in its own file
A small factory is enough; inheriting from Agent is not required.
Register it in Program.cs:
Keep required capability attachments in the factory so callers receive the same definition.
Organize by responsibility
Agent files describe behavior and allowed capabilities. Tools implement application operations. RAG configuration defines indexes and retrieval policies.
A second agent is useful when it has a distinct responsibility or capability boundary. Multiple agents do not automatically collaborate; your application must define invocation and information passing.
Group registration when it grows
An application-owned helper can group related definitions:
Call options.AddSupportAgents(apiKey) inside AddRuniqServer. This is an application organization choice, not a required framework abstraction.
Keep capability boundaries explicit
- Attach only the tools the agent needs.
- Enforce authorization and validation inside application services.
- Keep document ingestion and index setup outside instructions.
- Use stable ids for registered agents.
- Test changed definitions with representative requests.
Avoid duplicate configuration
Keep provider keys in configuration. Reuse a definition factory rather than copying instructions across startup code, endpoints, and tests.
Use Studio testing to inspect behavior and Running agents for the execution API.