<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Casper Nielsen</title>
    <description>The latest articles on DEV Community by Casper Nielsen (@casper_nielsen_47eb2e6023).</description>
    <link>https://dev.to/casper_nielsen_47eb2e6023</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4167315%2Fb9fe829c-75c9-491f-983f-4f881baa9cf0.png</url>
      <title>DEV Community: Casper Nielsen</title>
      <link>https://dev.to/casper_nielsen_47eb2e6023</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/casper_nielsen_47eb2e6023"/>
    <language>en</language>
    <item>
      <title>Durable Sessions for the Claude Agent SDK, in One Prompt</title>
      <dc:creator>Casper Nielsen</dc:creator>
      <pubDate>Tue, 13 Oct 2026 06:52:34 +0000</pubDate>
      <link>https://dev.to/casper_nielsen_47eb2e6023/durable-sessions-for-the-claude-agent-sdk-in-one-prompt-3mb3</link>
      <guid>https://dev.to/casper_nielsen_47eb2e6023/durable-sessions-for-the-claude-agent-sdk-in-one-prompt-3mb3</guid>
      <description>&lt;p&gt;We shipped a Claude Agent SDK executor in Dapr Agents with durable sessions and human approvals. Meaning: your Claude-built agent survives a crash mid-task, resumes with its session intact, and waits for an approval for as long as the approval takes – through restarts and deploys.&lt;/p&gt;

&lt;p&gt;Getting started is rather easy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;dapr&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;agents&lt;/span&gt;
&lt;span class="n"&gt;dapr&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then paste this into your agent definition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dapr_agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DurableAgent&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dapr_agents.executors&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ClaudeAgentExecutor&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DurableAgent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;reviewer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;ClaudeAgentExecutor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session_store&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statestore&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;require_approval&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;merge_pr&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;deploy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now break it on purpose, because that's the whole point:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Give it a multi-step task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;kill -9 the process somewhere in the middle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start it again. The session resumes where it stopped and the steps already completed come back from the journal, not from re-running Claude.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Trigger an approval-gated tool, close your laptop, approve tomorrow. The wait survives because it lives in the workflow, not in memory.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All behavior was checked against dapr-agents main; the release notes have the exact versions: &lt;a href="https://github.com/dapr/dapr-agents/releases" rel="noopener noreferrer"&gt;https://github.com/dapr/dapr-agents/releases&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Same machinery works for LangChain Deep Agents. The adapter landed earlier this year in our diagrid python package, and deep agents with long tasks are exactly where durable sessions pay off.&lt;/p&gt;

&lt;p&gt;If you want the guided version, the Dapr Agents track at Dapr University is free: &lt;a href="https://www.diagrid.io/university/dapr-agents" rel="noopener noreferrer"&gt;https://www.diagrid.io/university/dapr-agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's that easy to get started. Give it a spin and lmk what you think 👀&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>dapr</category>
      <category>claude</category>
    </item>
    <item>
      <title>Hooks: Steer Your Agent Before the LLM Call</title>
      <dc:creator>Casper Nielsen</dc:creator>
      <pubDate>Fri, 09 Oct 2026 07:51:25 +0000</pubDate>
      <link>https://dev.to/casper_nielsen_47eb2e6023/hooks-steer-your-agent-before-the-llm-call-17hn</link>
      <guid>https://dev.to/casper_nielsen_47eb2e6023/hooks-steer-your-agent-before-the-llm-call-17hn</guid>
      <description>&lt;p&gt;Small feature, outsized leverage: Dapr Agents lets you register hooks around the agent loop where the &lt;code&gt;before_llm_call&lt;/code&gt; being the one I use the most.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dapr_agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DurableAgent&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_live_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;web_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# fresh context, every call
&lt;/span&gt;
&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DurableAgent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;researcher&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;hooks&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;before_llm_call&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;add_live_context&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything the hook does, lives inside the durable workflow, so a crash after the hook but before the call replays cleanly with no lost context. That's the difference between bolting logic onto the loop and having the runtime own it. It's important to note here that the hook itself has to be replay safe. Furthermore, the hook author needs to define whether this hook is deterministic or not. This has impact on replaying. A web search, as the above example is, will not be deterministic and thus will rerun. For live context, this is great and probably what we want. For validating user tokens, this is equally great - otherwise we'd just roll an approval on a potentially expired token!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Uses we've seen in the wild:&lt;/strong&gt; injecting fresh web context (my webinar demo), token-budget enforcement before the spend happens, redacting PII on the way in - and on the way out too. The latter is powerful to use if your agent handles sensitive data you'd want to mask before sending to an LLM provider.&lt;/p&gt;

&lt;p&gt;The webinar takes you through a full example with Tavily and Chainlit to enrich a models answer with fresh web results: &lt;a href="https://www.diagrid.io/webinars/make-your-llm-agent-production-smart" rel="noopener noreferrer"&gt;https://www.diagrid.io/webinars/make-your-llm-agent-production-smart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give it a spin and lmk what you think!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>dapr</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Casper Nielsen</dc:creator>
      <pubDate>Tue, 06 Oct 2026 20:01:11 +0000</pubDate>
      <link>https://dev.to/casper_nielsen_47eb2e6023/-48dp</link>
      <guid>https://dev.to/casper_nielsen_47eb2e6023/-48dp</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/diagrid/whats-new-in-the-dapr-dev-dashboard-for-local-workflow-debugging-2549" class="crayons-story__hidden-navigation-link"&gt;What's New in the Dapr Dev Dashboard for Local Workflow Debugging&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;
          &lt;a class="crayons-logo crayons-logo--l" href="/diagrid"&gt;
            &lt;img alt="Diagrid logo" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F6621%2Fca07de48-8345-4222-95f4-7c01627ee72e.png" class="crayons-logo__image" width="800" height="798"&gt;
          &lt;/a&gt;

          &lt;a href="/marcduiker" class="crayons-avatar  crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F220922%2Fb486eebe-5f4a-4d1d-8239-693aababb16a.png" alt="marcduiker profile" class="crayons-avatar__image" width="720" height="720"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/marcduiker" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Marc Duiker
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Marc Duiker
                
                
              
              &lt;div id="story-author-preview-content-4801678" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/marcduiker" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F220922%2Fb486eebe-5f4a-4d1d-8239-693aababb16a.png" class="crayons-avatar__image" alt="" width="720" height="720"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Marc Duiker&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

            &lt;span&gt;
              &lt;span class="crayons-story__tertiary fw-normal"&gt; for &lt;/span&gt;&lt;a href="/diagrid" class="crayons-story__secondary fw-medium"&gt;Diagrid&lt;/a&gt;
            &lt;/span&gt;
          &lt;/div&gt;
          &lt;a href="https://dev.to/diagrid/whats-new-in-the-dapr-dev-dashboard-for-local-workflow-debugging-2549" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Oct 5&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/diagrid/whats-new-in-the-dapr-dev-dashboard-for-local-workflow-debugging-2549" id="article-link-4801678"&gt;
          What's New in the Dapr Dev Dashboard for Local Workflow Debugging
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/dapr"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;dapr&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/debugging"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;debugging&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/programming"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;programming&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/diagrid/whats-new-in-the-dapr-dev-dashboard-for-local-workflow-debugging-2549" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;1&lt;span class="hidden s:inline"&gt;&amp;nbsp;reaction&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/diagrid/whats-new-in-the-dapr-dev-dashboard-for-local-workflow-debugging-2549#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              &lt;span class="hidden s:inline"&gt;Add&amp;nbsp;Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            7 min read
          &lt;/small&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>debugging</category>
      <category>devops</category>
      <category>tools</category>
    </item>
  </channel>
</rss>
