Kim Maida and Mason Egger: Secure Agent Access and Durable Execution

An expense-approval workshop combines per-call OAuth token exchange with Temporal workflows that recover after a worker fails.

KMKim MaidaIntervenant · KeycardMEMason EggerIntervenant · Temporal
Chaîne
AI Engineer
Publié
5 nov. 2026
Vidéo
52:36
Lecture
7 min
Diapositives
4
Original
anglais
Ouvrir sur YouTube
En faisant défiler, la vidéo se réduit en bas à droite et continue. Les sous-titres suivent votre langue de lecture.
Langue de lectureDisponible en 2 langues
Cet article n’est pas encore disponible en français ; il s’affiche dans l’original en anglais.
RÉSUMÉ

En 30 secondes

Keycard’s Kim Maida demonstrates how agent and user identities can travel through scoped token exchanges and audit records. Temporal’s Mason Egger then shows an expense-settlement workflow recovering from a killed worker while keeping the demo’s credentials out of the event history.

  1. 1Shared keys obscure identityAn agent using a broad API key may have all its permissions without identifying either the user or itself.
  2. 2A token for each hopThe agent exchanges its subject token for scoped access to the MCP server; the server exchanges again for the ledger API.
  3. 3Auditable expense approvalsThe demonstration records who filed and approved an expense and enforces distinct approval limits.
  4. 4Recovering a killed workerTemporal replays workflow history and continues after restart without repeating completed work in the demonstration.
  5. 5Keep credentials out of historyA just-in-time interceptor keeps the demo credentials out of the recorded workflow events.

À retenir

  1. Shared API keys can obscure who acted and grant an agent broader permissions than a particular call needs.
  2. Token exchange can bind an agent and delegated user to short-lived, resource-scoped credentials across multiple hops.
  3. Identity makes approval limits, separation of duties and meaningful audit records possible.
  4. A durable workflow can recover completed work after a worker fails rather than restarting the entire process.
  5. Credentials and other sensitive payloads require deliberate handling in workflow histories.
TEXTE INTÉGRAL

Lire le texte remanié, chapitre par chapitre

Transcription seule
01

The risk of shared API keys

Maida explains the missing identity and excessive permissions created by broad keys.

Kim Maida of Keycard and Mason Egger of Temporal introduce a workshop on building agents that can access resources securely and continue working through failures. Maida begins with identity and authorization; Egger later demonstrates durable execution.

Maida says a common pattern is to give an agent an API key. That credential may not identify the user or the agent, and the agent inherits all permissions attached to the key. Adding a human approval step everywhere is not a complete answer: humans make mistakes and many agents need to run autonomously.

02

Delegated identity and token exchange

A user grants scoped access, and the agent exchanges tokens for an MCP server and downstream ledger API.

Keycard's approach uses OAuth token exchange. First, an authorization server verifies the user, who consents to delegate a subset of their permissions. The resulting token identifies the user and the level of access granted. That initial consent narrows what the agent can do on the user's behalf.

The workshop uses an Expense Desk application containing a LangChain agent. Its MCP client sends proposed tool calls to an expense MCP server, which connects to a ledger API and database. The runtime sends a prompt to the model, dispatches its proposed calls, returns results to the model, and repeats until the agent answers.

The user's token becomes the subject token: it identifies the person for whom the agent acts. The Expense Desk app is an OAuth client capable of requesting an exchange, while the MCP server can request a further exchange for the ledger API. Equivalent clients could be a gateway or a wrapper around a coding agent.

When the agent proposes a tool call, the application authenticates to Keycard's security token service using client credentials or a workload identity. It presents the subject token and asks for access to the MCP server for the particular call. The request combines the agent's identity, the user's identity and the access the user delegated.

The service evaluates the request against policy: who is requesting access, for whom, to which resource and for what purpose. If the chain and requested access satisfy policy, it issues a short-lived token for the MCP server. Maida says the token normally expires in minutes and should not be stored.

Issuing a token for an MCP tool
DIAPOSITIVE 1 / 4Issuing a token for an MCP toolThe agent obtains access to the MCP server through a policy-checked token exchange.

The MCP server validates the token, authorizes the tool call and requests a second exchange for the ledger API. Keycard applies policy again and issues a token scoped to the downstream resource and call. The server uses that credential to invoke the API and discards it after the call; the result travels back up the agent loop.

03

Configuring an expense agent

The workshop moves from shared keys to agent identity, registered dependencies and per-call token requests.

The speakers use a shared workshop environment to demonstrate an expense-approval agent. Initially there is no login and users access a shared MCP server with API keys. The expense desk lets participants submit and approve expenses, but its activity log cannot reliably attribute those actions to a person or a distinct agent.

Maida submits a $75 snack expense and approves another expense. The activity records show access through an API key rather than a meaningful identity for the submitter or approver. A text statement that someone performed an action would not by itself establish who actually authorized it.

The next step is to give the agent an identity. In Keycard, applications are registrations that can request tokens, and resources are recipients of tokens; the same component may be registered as both. Maida registers the Expense Desk agent application and separately registers the agent as a resource that can receive the sign-in token.

Maida associates the resource with the application so the application can exchange sign-in tokens addressed to it. She then declares the agent's dependencies: the agent resource, the preconfigured expense MCP server, an LLM API credential held in Keycard's vault, and a user-info endpoint.

The demonstration gives the agent a client ID and secret and places them in the local sandbox configuration. Maida explicitly distinguishes this workshop shortcut from production: a workload identity or a mechanism that injects credentials dynamically can avoid keeping a secret on disk.

With the registrations in place, the application code must actually request exchanged tokens. Maida opens a workshop checkpoint whose MCP tool set uses the Keycard SDK to request a token for each tool call, with access narrowed to the call being made.

The minting function handles the case where there is no signed-in user: the agent authenticates with a client-credentials grant and acts as itself. After switching to the new checkpoint and restarting services, Maida asks the application which identity is in use and what approval limit it has.

The demo identifies the Expense Desk agent and reports its $50 approval limit. Maida asks it to file a $75 expense, mentioning that it is on her behalf. Because no human has signed in, the activity record attributes the filing to the agent; the words in the prompt do not prove a user's identity.

In the audit log, Maida finds the credential issued to the agent for the MCP resource using client credentials. She then examines the second exchange: the MCP server requests access to the ledger API on the agent's behalf. The delegation chain records both the requesting application and the downstream resource.

04

Human delegation and audit trails

User sign-in preserves both human and agent identities. Expense limits and logs show which actor did what.

An agent can act as itself or act on a human's behalf without impersonating that human. Maida adds user sign-in so that an action can be attributed to a specific agent acting for a specific user with that user's delegated permissions.

After signing in, the application recognizes Maida's human identity and reports her $100 approval limit. Historical records created with API keys remain attributed to those keys; adding identity does not retroactively reconstruct who acted. The agent can still act under its own identity when appropriate.

Maida submits a $30 office-supplies expense. The activity shows that the human filed it and the agent approved it under its own authority, because the amount falls below the demo's $50 threshold. The record distinguishes the two actors and includes the reason for approval.

A $75 expense exceeds the agent's autonomous approval limit, so it stays pending for human review. When Maida asks to approve her own expense, the demo refuses and requires another reviewer. The distinction is possible because the application knows the identities involved; it then records a rejection of someone else's expense under her identity.

The Keycard audit view shows the first hop: the agent application requests an MCP credential while acting for the signed-in user. On the second hop, the MCP server requests a ledger credential on that user's behalf. Maida explains that the same session identifier can be used to follow the sequence across both exchanges.

05

Durable agent execution with Temporal

Egger describes workflows and activities and demonstrates recovery after killing a worker.

Egger takes over to address a different part of the architecture: how to keep agents running reliably through failures. He describes Temporal as a durable execution framework that maintains execution state and can reconstruct it after failure, with retries and other failure-handling mechanisms for distributed calls.

An agent loop repeatedly calls models and external tools, so it faces ordinary distributed-systems problems as well as model-specific ones. In Egger's example, the parent agent process is a Temporal workflow and individual tool or service calls are activities. An activity can fail and be retried according to the workflow's policy.

The settlement workflow invokes activities such as debiting the ledger and marking an expense settled, with a timer to simulate a wait. The code uses a Keycard-provided interceptor around an activity: it obtains the identity and permission needed when that activity executes, allowing identities and scopes to be separated for workers.

Keycard interceptor for a Temporal activity
DIAPOSITIVE 2 / 4Keycard interceptor for a Temporal activityThe interceptor obtains a fresh credential when a protected activity executes.

Temporal uses a worker-service model. The service tracks workflow execution and state, while workers execute the actual code. Egger starts a worker and invokes a settlement; the worker logs the activity and token issuance while the Temporal interface shows the running workflow.

He kills the worker in the middle of the settlement. The running process disappears, but the execution history records the completed debit and its result. After a timeout, he restarts the worker. Temporal reconstructs the workflow from its history and continues from that point, without repeating the completed activities or LLM calls in this demonstration.

Settlement activity in Temporal history
DIAPOSITIVE 3 / 4Settlement activity in Temporal historyThe event history retains the completed debit as the worker is stopped and restarted.

Durability matters because agent loops can involve many external calls and expensive model tokens. Without persisted execution state and recovery logic, a failure late in a long run can waste completed work. Egger says recovery can be transparent to a user if the interruption is short enough, though a longer outage can still be visible.

06

Protecting credentials and payloads

The integration supplies credentials outside event history, while payload encoding can protect other sensitive data.

The credentials used by this example are not placed in the Temporal event history. Egger inspects the recorded activity results and explains that Keycard's interceptor supplies credentials just in time rather than persisting them in the workflow history. This is a design property of the integration, not a guarantee that arbitrary application data is never recorded.

Keeping secrets out of event history
DIAPOSITIVE 4 / 4Keeping secrets out of event historyThe workshop contrasts just-in-time credentials with payload encryption.

For other sensitive payloads, Egger describes Temporal's payload encoding and encryption option: an application can arrange encryption and control its own keys before data reaches the service. He closes by positioning the components together: identity and scoped authorization control access, while durable execution helps the agent continue after failures.

Sur la même chaîne

2 diapositives23:05ZH
AI Engineer· 6 nov. 2026Ryo Lu:当我们什么都能做,还知道自己想做什么吗?Ryo Lu从 AI 生成的日记工具到爵士乐团,Ryo Lu 讨论如何在更强大的工具旁保有判断、生活和与他人合作的空间。AI interface designHuman-AI CollaborationCreativity+2
2 diapositives14:58EN
AI Engineer· 6 nov. 2026Sparsh Jain on Building Experiential Memory for AI AgentsSparsh Jain · CentralAgent AIAn agent-memory lifecycle forms, updates and retrieves lessons while evaluation loops manage changing context.AI agentsIngénierie d’agentsIngénierie du contexte+2
5 diapositives17:27EN
AI Engineer· 6 nov. 2026Philipp Schmid: Seven Things an AI Coworker NeedsPhilipp Schmid · Google DeepMindA walkthrough of managed agents, skills, credentials and controls, culminating in a scheduled portfolio-audit demo.Ingénierie d’agentsGeminiAuthentification des agents+2
2 diapositives18:13EN
AI Engineer· 6 nov. 2026Sid Pednekar: Judgment Is the Scarce Resource in AI AdoptionSid PednekarA framework for choosing valuable problems, building shared capabilities and turning experience into organizational learning.AI AdoptionDecision MakingAI Strategy+1
2 diapositives14:04EN
AI Engineer· 6 nov. 2026Frank Long on Building AI Investment Workflows Around QualityFrank Long · CoatueCoatue’s Frank Long breaks investing into information, analysis and decision steps, and argues for choosing the right combination of code, models and people.AI agentsInvestingIngénierie d’agents+2
3 diapositives17:52EN
AI Engineer· 5 nov. 2026Cameron Wolfe on Evaluating AI When Answers Are SubjectiveCameron Wolfe · NetflixNetflix’s Cameron Wolfe outlines human review, calibrated model judges and production monitoring as a repeatable evaluation loop.ÉvaluationsÉvaluations et observabilitéValidation avec humain dans la boucle+2