# Code-first workflows

Canonical page: https://intelligencesnacks.com/ideas/code-first-workflows/

Use agents to discover and judge; encode repeatable routes and handoffs in code. Applications and claimed outcomes remain distinct.

Agent editorial review: 2026-11-09. Shared themes do not assert agreement or independently verify source claims.

## Preserve a route once it is understood

A recurring proposal is to use agents while discovering how to do something, then encode the repeatable parts in software. The distinction is between open-ended exploration and recurring execution: discovering sources or a remedy can require judgement, while repeating a settled route may not.

Sources: https://intelligencesnacks.com/ideas/code-first-workflows/#observation-9ba6b920-3f16-4afb-abb6-4fc3857e973f https://intelligencesnacks.com/ideas/code-first-workflows/#observation-46695a6f-e3db-4d67-a4c6-150532753be9 https://intelligencesnacks.com/ideas/code-first-workflows/#observation-1956fb6d-2dce-4f11-90db-9eef8b728107

## Where judgement remains in the workflow

Code-first does not remove models from the process. The pipeline examples place agents at bounded classification, routing or transformation steps and pass structured results back to code. The source discussions argue for clearer control and less repeated inference; they do not establish that every business task already has a deterministic solution.

Sources: https://intelligencesnacks.com/ideas/code-first-workflows/#observation-cc3112ea-d391-4423-8ac5-17fdd4cd7fa0 https://intelligencesnacks.com/ideas/code-first-workflows/#observation-43b4f2b4-0f85-4376-94cb-bd2026835dd7 https://intelligencesnacks.com/ideas/code-first-workflows/#observation-2bb891e3-3272-4b59-aa2c-b107ab4a85d2

## Keep deterministic work outside the agent

Local AI Models — Episode 67

Scripts should perform repeatable operations while agents handle decisions that cannot be encoded cheaply, reducing latency, token use and context failures.

Grouping rationale: Episode 67 argues that repeatable script execution need not occupy an agent context window.

> [00:17:18] Pete
> I always felt this is why so many people's open claw Setups broke after about a month, and it's, it's 'cause they had to, 'cause they've kind of like loaded a lot of stuff into an agent runtime, which is probably the wrong place For it, like agents were doing a lot of just running scripts that could just be scripts running scripts running scripts, like none of that needed to exist in a context window.

Pete — https://intelligencesnacks.com/episodes/episode-067/#transcript-turn-76 (00:17:18)

## Let code keep control between agent decisions

Working with AI Agents — Episode 65

A code-first pipeline should invoke an agent only for bounded judgments, then return control to deterministic steps for predictable recurring work.

Grouping rationale: Episode 65 describes code-first pipelines that start an agent for a decision and return control to code.

> [00:46:37] Pete
> Yeah, so for the new listener, like a pipeline in Autopilot is effectively, it's a code first workflow that can include agents. So it's a way you can declare a workflow to be a certain set of thing. It can run certain instructions. It can pass data into the next steps and so on. And then any one of those steps could be an agent. And the agent will fire up, make a decision, do something that you need intelligence for, go look at something, and then it'll close itself down, moves back into the code space. but it just reduces the cost of doing repetitive work and it increases the level of, I guess, the predictability of the outcomes and the consistency. Like this, it sounds like

Pete — https://intelligencesnacks.com/episodes/episode-065/ (episode-level citation; exact passage not resolved)

## Put the process outside the agent

The AI Industry is Wrong — Episode 71

The workflow should be the runtime, invoking an agent only at ambiguous judgment points and handing structured results back to cheap deterministic code.

Grouping rationale: Episode 71 explicitly places the process outside the agent and bounds the agent to the part requiring it.

> Pete Winn (12:49.293)
> Yeah. I mean one way that we've described this quite a bit on the podcast in the last few months has been that we think the industry has the runtime wrong, which is that they like particularly anthropic are probably a little bit more aggressive in this sense where they kind of assume that the runtime is the agent.
> 
> And it's like the agent gets the task and then decides what it needs to do. And that's why skills are interesting, because now it's how you tell the agent to follow a process when really what you would do is you have a process that lives outside the agent. And the agent should only do the bit that you need the agent to do.

Pete Winn — https://intelligencesnacks.com/episodes/episode-071/#transcript-turn-46 (00:12:49.293)

## Let code run the workflow and call models for specific decisions

AI Model Explosion — Episode 73

Deterministic code should run most of a repeatable process, invoking a model only where classification, prioritisation, routing or translation requires bounded judgement.

Grouping rationale: Episode 73 applies the pattern to bounded decisions and translation inside mostly deterministic processes.

> sorry, I'm just closing down a few windows in the background 'cause my computer keeps telling me that it's struggling for some reason. And I feel like it shouldn't, but alas, it's probably doing something.
> 
> Yeah, so i it's we've talked about quite a a few times, is the idea is that it's
> 
> What you don't want is tons and tons of intelligence at every moment in time because it it's too easy to go off the reservation. Like often what you need is almost everything is code, but I need to make a decision here and that's why I had a person involved or you know, I need to move from this place to this place, or I need to like readjust something or rephrase something. And like LLMs are very good at kind of translating between one interface and another interface. I think one of the things that we also use them a lot for was just given set of information.
> 
> give me an output and a decision and then reasoning behind your decision. And you can get them to do that, but it it it does take a little bit of time and it does burn some burn some credits. And like they're not always that great at just accurately giving you back JSON that you can then use like in the next part of the program. So you've got

Pete Winn — https://intelligencesnacks.com/episodes/episode-073/ (episode-level citation; exact passage not resolved)

## Explore with agents, then put repeatable work into code

Humanmaxxing — Episode 76

Agents are useful during experimentation, but stable repeatable work should become deterministic code that an agent may still orchestrate end to end.

Grouping rationale: Episode 76 separates exploration with agents from crystallising repeatable work in code.

> Andy David (28:07.453)
> Yeah. Do it, do it. I but it was funny because I I think that episode preempted some of this like debate around like software this week. 'Cause I think maybe Peter Levels kind of kicked this off on on X and was like, I think software's gonna become like, you know, more ephemeral. Maybe d like the agent just kind of stands it up and it has a particular use and it disappears. And I think I think this was like one of the threads we'd pulled on in that episode, which was like, use the agent to explore and then
> 
> You you you crystallize the repeatable part in code, basically. And I I still think there's like place for that. And I that's what I tend to do is I'll stand up software based around the repeatable bit of work that I know I need. Once I've like played around and experimented and explored, and then I'm like, okay, like do I need to just throw tokens at a lot of this stuff? Probably not. It could just be deterministic code. Could the agent still run it end-to-end? Sure. but then do I need to see any of it?

Andy David — https://intelligencesnacks.com/episodes/episode-076/#transcript-turn-90 (00:28:07.453)

## Most business work is deterministic

Own Your AI Stack — Episode 53

Rules, scripts and transformations can handle routine work without frontier intelligence everywhere.

Grouping rationale: Episode 53 argues that most routine business work can run as deterministic transformations.

> You know, most of what you do inside the business is deterministic.

Andy — https://intelligencesnacks.com/episodes/episode-053/#transcript-turn-398 (15:04)

## Declarative pipelines constrain agent execution

Models or Harnesses — Episode 60

Functions, ordered steps and explicit data handoffs let code fix the route while agents solve bounded work inside it.

Grouping rationale: Episode 60 describes explicit ordered steps and data handoffs around bounded agent work.

> Pete
> 02:18
> I think the thing that got me on, I think Harness is more important,
> 
> Pete
> 02:22
> is just that I saw myself do stuff with these models.
> 
> Pete
> 02:27
> like months ago that you could then people start saying oh this almost works now with this new
> 
> Pete
> 02:34
> model well it worked with the old model but you needed to think about how you actually work true
> 
> Pete
> 02:38
> so i i was quite interested i haven't tried this because it's a called code like buried feature
> 
> Pete
> 02:43
> but they've just done their um the workflow the workflow piece yep i played a little bit
> 
> Pete
> 02:49
> so i feel like that's the right direction so that's that's where i ended up in wingman was to have
> 
> Pete
> 02:55
> I call them pipelines,
> 
> Pete
> 02:56
> but they're like declarative workflows.
> 
> Pete
> 02:58
> We have a selection of functions,
> 
> Pete
> 03:00
> and then you have steps and data that you can pass between them.
> 
> Pete
> 03:04
> And you can pretty much at runtime just say, oh, I'm going to create a pipeline that looks like this,
> 
> Pete
> 03:07
> and then run it,
> 
> Pete
> 03:08
> and you're up to just run.
> 
> Pete
> 03:10
> But it just constrains the agents to work in a particular way,
> 
> Pete
> 03:14
> which forces better

Pete — https://intelligencesnacks.com/episodes/episode-060/#transcript-turn-6 (02:18)

## Wingman composes code and agents into editable declarative pipelines

AI for Freedom Tech — Episode 62

Natural-language workflow descriptions become editable sequences in which deterministic code prepares data and focused agents perform bounded transformations, including loops.

Grouping rationale: Episode 62 describes editable pipelines mixing deterministic preparation and bounded agent transformations.

> Pete
> 01:00:10
> I took
> 
> Pete
> 01:00:11
> everything now so i can just run a script and go build me my wingman infrastructure and it'll go
> 
> Pete
> 01:00:17
> and set it all up for you and you just need to there's a few bits i'm still doing now about how
> 
> Pete
> 01:00:22
> you dial in some of the uh like connections between different parts of the app so that
> 
> Pete
> 01:00:27
> it runs like it has all the you know how paul did the whole hyper note os type thing we had the
> 
> Pete
> 01:00:33
> declarative apps yeah i took a similar type of style so i do a lot of workflows in ai because
> 
> Pete
> 01:00:38
> I think this is the best way to get stuff done.
> 
> Pete
> 01:00:40
> So I built like a declarative workflow system inside Wingman.
> 
> Pete
> 01:00:45
> So I can just describe in like natural language, right?
> 
> Pete
> 01:00:48
> Okay, we've got like five steps we're going to take.
> 
> Pete
> 01:00:50
> Step one, we're going to process this data.
> 
> Pete
> 01:00:52
> And this is like just straight code, like just process the data, throw all that stuff out, go get this stuff, go look over here, get that, pull it all together.
> 
> Pete
> 01:01:00
> And then you have an agent session and the agent's got a specific task and it runs and then it outputs

Pete — https://intelligencesnacks.com/episodes/episode-062/#transcript-turn-80 (01:00:10)

## Turn repeatable inference into software

AI Agent Economies — Episode 69

Once an AI discovers a stable remedy, encoding it as deterministic software saves tokens and improves predictability.

Grouping rationale: Episode 69 proposes encoding stable AI-discovered remedies as software rather than paying for repeated inference.

> Unless you have to. so one way of doing that is to basically use the AI to build a repeatable recipe that just stays yeah, basically turn it into software rather than token burn. Yeah.

mineracks — https://intelligencesnacks.com/episodes/episode-069/#transcript-turn-115 (00:46:58.437)

## Agents discover; workflows repeat

The AI Industry is Wrong — Episode 71

Open-ended agents are valuable while the route is unknown, but a bounded workflow should preserve the discovered route for repeated execution and checkpoints.

Grouping rationale: Episode 71 distinguishes open-ended discovery from preserving a repeatable route.

> Paul (16:21.187)
> We're gonna open source the whole thing and it includes you know, our approach to agents, memory, code automation, everything. So the big delay that we've had is there's a balance between what you want agents to go and figure out. The way I look at it is look, let's say you have a Robo Taxi Uber that needs to figure out how to get from your office to your house, and it doesn't have a map. So it just drives around until it figures out how to get to your house.
> 
> The next day what most people are doing in this industry is sending an agent to figure out how to get to your house again. You know, so it's just like, what are you doing? You're just burning tokens, driving cars around trying to figure out to when you know how to do it. So then everyone's now figured out, we gotta l we actually do need to make a workflow. Those are the turns to get to the house. The agent is great at finding the house, but once I know how to get there, why not create a workflow?
> 
> And then if I have many robotaxis discovering many things about my city, I want them all to know that so each one of them doesn't have to learn. So that's the shared agent memory that's critical to these systems.

Paul — https://intelligencesnacks.com/episodes/episode-071/#transcript-turn-56 (00:16:21.187)

## Successful research should become a repeatable pipeline

AI Model Explosion — Episode 73

After an agent discovers sources and a path through an open-ended task, subsequent runs can fetch with code and classify with specialised models instead of repeating the entire search.

Grouping rationale: Episode 73 proposes replacing repeated research with code fetching and specialised classification once the route is known.

> Pete Winn (36:12.397)
> Classification. I think like research type work. Again, I feel like that would be more of a a language model piece. It's like here's here's a question and a goal, and I want you to just loop on this and go after it. Like language models do really well in that that space, that pathfinding sort of space. I think what will be interesting is to like almost once you've done the pathfinding work.
> 
> with an agent to say like, okay, I want you to do all this research on all these different things. I want you to find out like how you find this data even on the internet and then go and get it. But once you've done it, then that probably boils down to next time you shouldn't go through the same process. You should just figure out where are all the sources, that should be code, all the stuff should come in, and then you should classify it using something like this. And
> 
> I I can see it eating a lot of that as well. Yeah, and just I I I think it's it it just makes you rethink a lot of it, I think, to be honest, because it used to I guess it was that you had code and you had agents and anything that wasn't that couldn't just be enumerated entirely, we just threw it an agent.

Pete Winn — https://intelligencesnacks.com/episodes/episode-073/ (episode-level citation; exact passage not resolved)

## Declarative pipelines alternate code and agents

The AI Industry is Wrong — Episode 71

Repeat work can be expressed as a schema that moves outputs among code steps and bounded agent sessions, with triggers and purpose-built interfaces for human input.

Grouping rationale: Episode 71 describes declarative steps and bounded sessions for repeated work.

> Pete Winn (44:41.097)
> so it can just be like a straight coding session. So if I just want to deal with clawed code and do questions I can do it in there on the web or on my phone from where I
> 
> If I want to then create a workflow, we we have those call them pipelines inside Autopilot. So I it's a declarative structure for those workflows. So effectively kind of like a JSON object, which would describe run this code, take the output of that code, put it into this agent session. The agent session returns this schema, take that schema, put it into this code, and so on. You can imagine like how that would work. That does the repeat work for us. we have obviously triggers, you can trigger across Nostor, webhooks, on schedules.

Pete Winn — https://intelligencesnacks.com/episodes/episode-071/#transcript-turn-123 (00:44:41.097)

## Repeatable agent work collapses into software

Own Your AI Stack — Episode 53

Agent-heavy operations lose to deterministic software delivering the same outcome more cheaply.

Grouping rationale: Episode 53 frames repeatable agent work as eventually collapsing back into software.

> it's not the end game of the whole thing
> it collapses back down into software

Pete — https://intelligencesnacks.com/episodes/episode-053/ (episode-level citation; exact passage not resolved)

## Successful agent work should become software

The AI Industry is Wrong — Episode 71

The durable role of agents is to discover what software should do; settled operations should then be encoded for predictable, low-cost execution.

Grouping rationale: Episode 71 argues that successful agent discovery should leave a repeatable software route.

> Pete Winn (51:56.856)
> Yeah. mean I feel like a big part of the like a big question and I I know we talked about this like a couple of years ago at least was like where does the value go in this in this world of AI and like what does it actually look like? Is it all gonna go to Anthropic and Claude? Is it somewhere else? And I I feel like we've always been reasonably aligned that I've I think the project of AI is not necessarily to be the AI thing or the AI is the the product.
> 
> at the end of it. It feels like it's the the translation of we're going to turn all of the businesses and the things that need to do stuff into society into code. And it's like we couldn't do that previously because we were locked on AI.
> 
> Like we didn't have enough intelligence, sorry. Now if we have that intelligence, that's just where we end up, is that things start getting reusable and repeatable and done quickly and at minimal cost. And that that would be the software. So when you describe like the the zoom out pieces, I want to do something, and then eventually you zoom in enough that it's like and now it's done repeatably and at minimal cost. And then so now I zoom back out and I say, What's the next

Pete Winn — https://intelligencesnacks.com/episodes/episode-071/#transcript-turn-143 (00:51:56.856)

Full JSON: https://intelligencesnacks.com/api/knowledge/v1/ideas/code-first-workflows.json
