KatInterview

Design a Permission-Gated Agentic Research Assistant

System DesignModel answer
MediumModel answerSystem Designagentic-systemsRBACLLM

Last updated

Architect an LLM-powered agent for internal analysts that enforces row-level access control, supports durable multi-step workflows, and gates consequential actions behind human approval.

Scenario

Your team is building an AI research assistant for analysts at a regulated financial firm. Analysts type natural language questions like "How do my fixed-income positions compare to the benchmark on a risk-adjusted basis?" The agent interprets the request, selects the right tools, fetches data, and returns a synthesized answer.

Unlike a simple chatbot, the agent can also trigger downstream actions such as requesting a portfolio rebalance. This creates two distinct classes of behavior that must be handled very differently.

What You Need to Design

1. Authorization boundaries The system serves analysts with different roles, desk assignments, and information-barrier restrictions. The LLM must never be the component that decides what a user is allowed to see. Describe how entitlement checks are enforced outside the model, and how you prevent personally identifiable information (client names, account numbers) from appearing in model context.

2. Orchestration Explain how the agent manages tool discovery (which tools are available to a given user), multi-step planning, parallel execution, and loop termination. The system must survive process crashes mid-workflow without re-issuing external API calls.

3. Consequential actions Draw a clear boundary between read-only queries (market data lookups, performance calculations) and actions with real-world effect (submitting a rebalance to an order management system). Define the full lifecycle of a consequential action from the moment the model proposes it to the moment it executes.

4. Audit logging Every step must be logged for regulatory review. Describe the data model for these logs, covering what fields are captured, how immutability is enforced, and how long records must be retained.

Constraints

  • 500 analysts, roughly 5,000 requests per day, with a sharp spike at market open
  • Read-only queries must complete in under 5 seconds end-to-end
  • A crashed or restarted process must be able to resume from its last completed step
  • Consequential actions above a certain notional threshold require a second approver

Deliverables

Provide a high-level architecture diagram or description, then address each of the four areas above. Discuss trade-offs and failure modes rather than just the happy path.

Hints

Hint 1

Start by sizing the problem. 5,000 requests/day sounds large, but convert it to peak QPS first — the numbers change your architectural choices significantly.

Hint 2

The hardest constraint is not latency or throughput; it is that the model must never be trusted as a security decision-maker. Work out where authorization checks live and who holds credentials before designing the data flow.

Hint 3

Think about what 'durable' means for an LLM workflow. If the orchestrator crashes after a tool call returns but before the result is saved, what happens on replay? How do you prevent a rebalance proposal from being re-submitted to the OMS?