Sign in

Ian Macartney

@ianmacartney.bsky.social
74 followers 24 following 61 posts

Friendly engineer at Convex.dev

PostsRepliesMedia
Ian Macartney @ianmacartney.bsky.social · 24/09/2025
I feel clever subbing `return await fn()` with `return fn()` But gotchas don't seem worth it anymore • Breaks try/catch/finally expectations • Loses stack trace context My default is now to always await. Change my mind.
000
Ian Macartney @ianmacartney.bsky.social · 08/08/2025
I've added new features to my middleware-esque helper library, and got inspired to write down everything I think about authorization: stack.convex.dev/authorization
stack.convex.dev
Authorization Best Practices and Implementation Guide
Learn about authorization techniques and how to implemented them with practical examples.
000
Ian Macartney @ianmacartney.bsky.social · 08/08/2025
A recent talk on developing the Agent Component: www.youtube.com/watch?v=YM9n...
youtube.com
How to Build Realtime AI Agents with Convex Components
YouTube video by Convex
000
Ian Macartney @ianmacartney.bsky.social · 22/07/2025
Documentation for the Agent component is live 🎉 -> docs.convex​.dev/agents Odd coincidence that there's ~2300 lines of documentation & ~2300 lines of example code 🤔 ...maybe more surprising there's fewer lines of React? @​convex-dev/agent
000
Ian Macartney @ianmacartney.bsky.social · 17/06/2025
Rate limiting LLM chat per-user with `useRateLimit` const { status } = useRateLimit(api.rl.getRateLimit) Full code in 🧵 Algorithms: Sending messages: fixed window Token usage: token bucket courtesy of @​convex-dev/rate-limiter + @​convex-dev/agent (components)
100
Ian Macartney @ianmacartney.bsky.social · 10/06/2025
Recent talk on agents & agentic workflows, as well as my Convex Agent Component. Takes: • Agentic := prompting + routing • Prompting is input -> LLM -> output • Routing has code at every boundary (...even if an LLM "decides" what to do next) Full 📺🔗->🧵
200
Ian Macartney @ianmacartney.bsky.social · 31/05/2025
Streaming LLM text using websockets + client smoothing - no HTTP necessary! Agent v0.2.1 is out! Repo & release notes in 🧵 - Streaming text react hook + server fns - Client-side smoothing hook - Optimistic update helpers
100
Ian Macartney @ianmacartney.bsky.social · 31/05/2025
“Simple Made Easy” is incredibly relevant nowadays where “easy” but not “simple” systems abound youtu.be/SxdOUGdseq4?...
youtu.be
"Simple Made Easy" - Rich Hickey (2011)
YouTube video by Strange Loop Conference
000
Ian Macartney @ianmacartney.bsky.social · 23/05/2025
Agent Playground for @​convex-dev/agent is live! Investigate threads, messages, tool calls Dial in context params Iterate on prompting, etc. For the @​convex-dev/agent component. Links in 🧵
100
Ian Macartney @ianmacartney.bsky.social · 10/04/2025
Not all embeddings are created equal. Some represent more meaningful context. I struggled with AI Town to efficiently do vector search that also included a 1-10 "importance" Last night I figured out a way to prioritize some embeddings over others using a "bias" feature 🧵
100
Ian Macartney @ianmacartney.bsky.social · 10/04/2025
I do RAG via hybrid text/vector search using reciprocal rank fusion (the one-weird-trick of hybrid search imo) for my new Agent framework/component. It's open source and the code is remarkably simple, if you're looking for an example for yourself.
    let textSearchMessages: Doc<"messages">[] | undefined;
    if (args.text) {
      textSearchMessages = await ctx.runQuery(api.messages.textSearch, {
        userId: args.userId,
        threadId: args.threadId,
        text: args.text,
        limit,
      });
    }
    if (args.vector) {
      const dimension = args.vector.length as VectorDimension;
      if (!VectorDimensions.includes(dimension)) {
        throw new Error(`Unsupported vector dimension: ${dimension}`);
      }
      const vectors = (
        await searchVectors(ctx, args.vector, {
          dimension,
          model: args.vectorModel ?? "unknown",
          table: "messages",
          userId: args.userId,
          threadId: args.threadId,
          limit,
        })
      ).filter((v) => v._score > (args.vectorScoreThreshold ?? 0));
      // Reciprocal rank fusion
      const k = 10;
      const textEmbeddingIds = textSearchMessages?.map((m) => m.embeddingId);
      const vectorScores = vectors
        .map((v, i) => ({
          id: v._id,
          score:
            1 / (i + k) +
            1 / ((textEmbeddingIds?.indexOf(v._id) ?? Infinity) + k),
        }))
        .sort((a, b) => b.score - a.score);
      const vectorIds = vectorScores.slice(0, limit).map((v) => v.id);
      const messages: Doc<"messages">[] = await ctx.runQuery(
        internal.messages._fetchVectorMessages,
        {
          userId: args.userId,
          threadId: args.threadId,
          vectorIds,
          textSearchMessages: textSearchMessages?.filter(
            (m) => !vectorIds.includes(m.embeddingId!)
          ),
          messageRange: args.messageRange ?? DEFAULT_MESSAGE_RANGE,
          parentMessageId: args.parentMessageId,
          limit,
        }
      );
      return messages;
    }
    return textSearchMessages?.flat() ?? [];
100
Ian Macartney @ianmacartney.bsky.social · 08/04/2025
Exciting news for Agent Workflow front: 🪨Durable Workflows🪨: Orchestrate steps async with retries, checkpointing and more, using Inngest-style syntax 🤖 Agent Framework 🤖: Define agents and use threaded memory (can hand off between agents), with hybrid text/vector search. 🧵
210
Ian Macartney @ianmacartney.bsky.social · 31/03/2025
Welp not all experiments work out, but what will outlive all products is the insights you glean along the way. I reimplemented Mastra workflows in Convex last week and I regret it. Article in 🧵
100
Ian Macartney @ianmacartney.bsky.social · 28/03/2025
I made some cartoons today for an article I'm writing. This one is me when I'm too deep in a project that's gone off the rails, complete with alt text. Should I ship it or make a "better" version to make it "more professional"?
Where's Ian? Oh, he's in a code hole. Should we tell him his idea is risky? No, I mean his head is literally in a hole coding. He's an ostrich, did you know that?
110
Ian Macartney @ianmacartney.bsky.social · 27/03/2025
Programmers know why this sorting is busted the way it is. Maybe they should also know better :P
000
Ian Macartney @ianmacartney.bsky.social · 26/03/2025
What I meant to say was "correctness & reliability" - mental blip when I first posted this. The reality is that while everyone's talking about how cool their app is in the happy path, actually handling failure is near impossible when you're using leaky abstractions.
000
Ian Macartney @ianmacartney.bsky.social · 25/03/2025
Thoughts on about safety & reliability in the age of agentic flows and durable workflows: Details in 🧵, but tl;dr: 1️⃣ Isolate unreliable steps to safely retry 2️⃣ Model LLMs as ~idempotent & ~deterministic 3️⃣ Run asynchronously, subscribe to results Bonus: I made a thing
100
Ian Macartney @ianmacartney.bsky.social · 25/03/2025
I'm working on handling [agentic] workflows in @convex.dev using Mastra to define them. Anyone interested in an alpha I made over the last week? Based on the architecture diagram I shared. It uses my durable Workpool component to execute them with parallelism limits, retries, etc. (Open Source)
010
Ian Macartney @ianmacartney.bsky.social · 22/03/2025
Made this architecture diagram yesterday, implementing it today. Any guesses on what it is? Wish me luck!
010
Ian Macartney @ianmacartney.bsky.social · 11/03/2025
Tiago asked about integrating reactflow.dev with @convex.dev so I made a demo last night. - realtime syncing flow chart - authorize reads and writes - validation of custom data payloads - optimistic updates for UX 🧑‍🍳💋 I'm proud of it, and thanks Tiago for the help! github.com/ianmacartney...
000
Ian Macartney @ianmacartney.bsky.social · 11/03/2025
Tip: Use the `workpool` component to manage asynchronous workloads. - durable execution w/ onComplete handler - limit parallelism to be a nice neighbor - configure retries (w/ backoff, jitter, max attempts) - backlog & lag monitoring v0.2.1 out now www.convex.dev/components/w...
convex.dev
Workpool
Workpools give critical tasks priority by organizing async operations into separate, customizable queues.
110
Ian Macartney @ianmacartney.bsky.social · 20/02/2025
The Telepathy Tapes podcast is adding to the pile of worldview-changing things to grapple with. What deserves my attention?
At a crossroads, deciding between going deep on AI vs. ESP
000
Ian Macartney @ianmacartney.bsky.social · 14/02/2025
Local file sharing app (Open Source) Drag your files onto the site Drag them off on another computer git clone github.com/mikecann/our... cd ourfiles/ docker compose up open localhost:5173 by @mikeysee video in 🧵
100
Ian Macartney @ianmacartney.bsky.social · 14/02/2025
So fun to work with Annie. She helped a ton, giving us some just-in-time feedback on self-hosting ergonomics. Really grateful that we met through @kentcdodds.com's #EpicWebCamp.
1112
Ian Macartney @ianmacartney.bsky.social · 13/02/2025
Self-hosting Convex just got way easier, including running the dashboard. npx degit get-convex/convex-backend/self-hosted/fly fly && cd fly/backend && fly launch Dockerfiles, images, binaries @flydotio and more. Check it out 🧵
110
Ian Macartney @ianmacartney.bsky.social · 31/01/2025
I used AI to write a script to help me write AI evals to help AI write Convex code. Very meta 💡Each step uses RAG from previous evals Flow: 1. 🧑‍💻oneliner -> 🤖 task description -> 🧑‍💻 audit 2. 🤖 answer ->🧑‍💻 audit 3. 🤖 tests for answer ->🧑‍💻 audit 🔗 to evals 👀 & my script in 🧵
github.com
GitHub - get-convex/convex-evals
Contribute to get-convex/convex-evals development by creating an account on GitHub.
212
Ian Macartney @ianmacartney.bsky.social · 28/01/2025
Another feature of the BlockNote/Tiptap sync component that might interest folks: Server-side document editing, w/o clobbering user changes You can access & transform a document, but the really cool thing is that you provide a callback to rebase your transform on the latest version.
export const transformExample = action({
  args: { id: v.string() },
  handler: async (ctx, { id }) => {
    const schema = getSchema(extensions);
    const { doc, version } = await prosemirrorSync.getDoc(ctx, id, schema);
    const newContent = await generateAIContent(doc);
    const node = await prosemirrorSync.transform(ctx, id, schema, (doc, v) => {
      if (v !== version) {
        // If we wanted to avoid making changes, we could return null here.
        // Or we could rebase our changes on top of the new document.
      }
      const tr = EditorState.create({ doc }).tr;
      return tr.insertText(newContent, 0);
    });
    await updateDocSearchIndex(ctx, node);
  },
});
100
Ian Macartney @ianmacartney.bsky.social · 23/01/2025
Some improvements to the open-source collaborative editor sync component landed this week: 📝 Now supports syncing *BlockNote* & @tiptap.dev 🦾 Server-side editing of documents is now easier & documented, for those of you using AI thingies
121