Author: admin

  • Day 21 – Work Diary #8

    Pydantic AI is an interesting library … it’s the best way to create agents and one of their examples is a basic one which acts as a bank account agent, where you can either find out what your balance is, or block your card.

    You can see the rest of the source code on the page but what’s interesting is how it uses LLMs to interpret your request to see if it will take a certain action or not.

    So you can run the agent with

    result = support_agent.run_sync('what is my balance?', deps=deps)

    This returns:

    support_advice=’Your current account balance is $123.45.’ block_card=False risk=1

    But I can also do something like

    result = support_agent.run_sync('i need to see if i have enough to buy a dog, my wife has spent it all', deps=deps)

    support_advice=”Your current account balance is $123.45. Please check the price of the dog you want to buy to see if it’s within your budget.” block_card=False risk=5

    Which is quite funny really … so it’s shown the user to see the balance because its interpreted it as a show balance action, and whilst I’m not sure banks would want the rest of it, it’s quite funny.

    However if I dont indicate balance intent …

    result = support_agent.run_sync('My dog died :-(', deps=deps)

    support_advice=”I’m very sorry to hear about your loss, John. Losing a pet is incredibly difficult. If there’s anything I can do to help you with your banking needs during this tough time, please let me know.” block_card=False risk=0

    In this above case, it just sends a message back but doesnt show the balance.

    https://ai.pydantic.dev/#tools-dependency-injection-example

  • Day 20 – Conversations, Social Contact, Mental Health and How AI Will Likely Ruin Us Further

    Day 20 – Conversations, Social Contact, Mental Health and How AI Will Likely Ruin Us Further

    Today was mostly conversations.

    Are conversations useful?

    If they lead to valuable action action then yes for sure.

    But if you’ve watched Stutz on Netflix, you’ll know that real world conversations – and hence socialising – are also vital for your own wellbeing and mental health. It’s more helpful if the conversations are interesting and not poisonous, but any social contact is better than none, funnily enough.

    If you are working on your own a lot as a founder, it’s so important to have social contact to ground yourself in reality. It’s very good for your brain.

    The sad reality of future AI is that people will be more and more communicating with AI generated feedback. But it’s down to each one of us to make sure you keep on talking, especially technical founders who are introverted.

    I was listening to someone the other day who said that whoever is alive now… we are the final era of humans who knew what life was like before AI (and robots) started to take over and reduce the cost of knowledge and content creation down to almost zero.

    Interesting new world!

    In other news, did some more R&D on web crawling. It turns out you can use the Crawl4AI python package in tandem with a language model and it will automatically run it through your prompt. I’ll do a video on it another time but for the moment here is my code. It basically will rewrite the BBC article as an excited Arsenal fan.

        
        # Example 2: Using Pruning filter
        url2 = "https://www.bbc.co.uk/sport/football/live/c8j00ke2r23t"
        success2, content2, file2 = await crawl_url(
            url=url2,
            filter_type="llm",
            llm_instruction="""
            Rewrite this as if you are an excited Arsenal fan.
            Include:
            - Emotive descriptive language of the goals
            Exclude:
            - Navigation elements
            - Sidebars
            - Footer content
            Format the output as clean markdown with proper paragraphs and headers.
            """,
        )

    and this is the definition of my custom function

    import asyncio
    from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, BM25ContentFilter, CacheMode, DefaultMarkdownGenerator, LLMContentFilter, PruningContentFilter
    from crawl4ai.async_configs import BrowserConfig, CrawlerRunConfig, LlmConfig
    import os
    from dotenv import load_dotenv
    
    async def crawl_url(url, filter_type="prune", query=None, llm_instruction=None):
        """
        Crawl a URL and apply a specified content filter.
        
        Args:
            url (str): The URL to crawl
            filter_type (str): Type of filter to use - "bm25", "prune", or "llm"
            query (str): Query for BM25 or Pruning filters
            llm_instruction (str): Instruction for LLM filter
            
        Returns:
            tuple: (success, markdown_content, output_filename)
        """
        # Load environment variables from .env file
        load_dotenv()
        OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
        
        # Select the appropriate content filter based on filter_type
        if filter_type == "bm25" and query:
            content_filter = BM25ContentFilter(
                user_query=query,
                bm25_threshold=1.2,
                # use_stemming=True
            )
        elif filter_type == "prune" and query:
            content_filter = PruningContentFilter(
                user_query=query,
                threshold=0.5,
                threshold_type="fixed",  # or "dynamic"
                min_word_threshold=50
            )
        elif filter_type == "llm" and llm_instruction:
            content_filter = LLMContentFilter(
                llmConfig=LlmConfig(provider="openai/gpt-4o-mini", api_token=OPENAI_API_KEY),
                instruction=llm_instruction,
                chunk_token_threshold=4096,
                verbose=True
            )
        else:
            # Default to pruning filter with empty query if no valid filter specified
            content_filter = PruningContentFilter(
                user_query=query or "",
                threshold=0.5,
                threshold_type="fixed",
                min_word_threshold=50
            )
        
        md_generator = DefaultMarkdownGenerator(
            content_filter=content_filter,
            options={"ignore_links": True},
        )
    
        config = CrawlerRunConfig(markdown_generator=md_generator)
    
        async with AsyncWebCrawler() as crawler:
            result = await crawler.arun(url=url, config=config)
    
            if not result.success:
                print(f"Crawl failed: {result.error_message}")
                print(f"Status code: {result.status_code}")
                return False, None, None
    
            # Create a filename based on the URL
            # Remove protocol and replace special characters
            filename = url.replace("https://", "").replace("http://", "").replace("/", "_").rstrip("_")
            output_file = f"{filename}.md"
            
            # Write the extracted content to a markdown file
            with open(output_file, "w", encoding="utf-8") as f:
                f.write(result.markdown.fit_markdown)
            
            print(f"Content successfully exported to {output_file}")
            return True, result.markdown.fit_markdown, output_file 

  • Day 19 – Some Basic R&D

    Finally got started on some proper AI R&D today focusing on my journey into the world of Python. It’s clear Python will play a big part in my longer term plans.

    Today I started out looking at :

    • Making an API server in Python
    • Using Pydantic for data validation
    • Using Crawl4AI which is a library that indexes websites into markdown files.
    • The basics of PydanticAI for building AI agents

    This will form the basis of the first low hanging fruit AI tool that I have in mind.

    Beyond that:

    • Another potential warm lead
    • A long conversation about using AI with Amazon fulfillments
    • Got my initial business model pricing and offering to a place I’m happy to start from
    • Setup my appointment calendar (cal is open source!)

    Random Notes

    Every Virtual Agent is going to need to be able to crawl websites. Luckily we don’t need to reinvent the wheel and can use:

    https://crawl4ai.com

    Today’s R&D looks at https://ai.pydantic.dev/

    PydanticAI is a Python agent framework designed to make it less painful to build production grade applications with Generative AI.

    Pydantic Data Validation

    PydanticAI is built upon Pydantic – which is a data validation library. Here’s an example:

    from datetime import datetime
    from pydantic import BaseModel, PositiveInt, ValidationError
    
    
    class User(BaseModel):
        id: int
        name: str = 'John Doe'
        signup_ts: datetime | None
        tastes: dict[str, PositiveInt]
    
    
    external_data = {'id': 'not an int', 'tastes': {}}  
    
    try:
        User(**external_data)  
    except ValidationError as e:
        print(e.errors())
        """
        [
            {
                'type': 'int_parsing',
                'loc': ('id',),
                'msg': 'Input should be a valid integer, unable to parse string as an integer',
                'input': 'not an int',
                'url': 'https://errors.pydantic.dev/2/v/int_parsing',
            },
            {
                'type': 'missing',
                'loc': ('signup_ts',),
                'msg': 'Field required',
                'input': {'id': 'not an int', 'tastes': {}},
                'url': 'https://errors.pydantic.dev/2/v/missing',
            },
        ]
        """

    Having not used it before, looking at the syntax I really liked several things about it:

    1. It’s really easy to set the validation, since you just do it in the class definition
    2. When you attempt to set properties of the object to something that fails the validation, you get all the validation stuff you need nice and simple

    Python Crash Course

    Creating a virtual environment

    python3 -m venv directory_name

    This creates, amongst other things, a bin dir, which you source in order to tell your terminal to use this python environment rather than your global systems one

    source bin/activate

    Make sure VSCode uses the correct one. Cmd + Shift + p … Select Interpreter … and then choose the correct one (you will see your directory_name in there)

    Then I wanted to see what it takes to setup a simple web server

    pip3 install fastapi uvicorn

    Then some basic web server code

    from fastapi import FastAPI
    
    app = FastAPI()
    
    @app.get("/")
    def read_root():
        return {"message": "Hello, Pythonic World!"}
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str = None):
        return {"item_id": item_id, "q": q}
    
    @app.post("/items/")
    def create_item(name: str, description: str = None):
        return {"name": name, "description": description}
    
    if __name__ == "__main__":
        import uvicorn
        uvicorn.run(app, host="localhost", port=8000)
    

    You can then use this in a browser at port 8000

    http://localhost:8000/items/12?q=hello

    After getting confused by Google Clouds console I opted for OpenAIs API and topped up. You can integrate with:

    from openai import OpenAI
    
    client = OpenAI(
      api_key="YOUR_API_KEY"
    )
    
    completion = client.chat.completions.create(
      model="gpt-4o-mini",
      store=True,
      messages=[
        {"role": "user", "content": "write a haiku about ai"}
      ]
    )
    
    print(completion.choices[0].message);
    

    And that will pump out a response. So easy to use.

    It’s clear that I am going to need to learn more about python3 in order to make my own advanced virtual agent

  • Day 18 -Sunday Of Rest

    Day 18 -Sunday Of Rest

    Today was too good a day of weather to stay indoors, and I was feeling like a day of rest was needed. Apart from some messages between colleagues, some browsing of some AI bits and this blog, I’ve given myself permission to have day off.

    Went for run, do some weights, did some ‘yoga’ (I know a few yoga poses but not super good at it, but they help my back)… and then meditated for two hours in the garden which included some phenomenal breathwork.

    Breathwork really is a key thing I wish I had knew a long time ago.

    If you do it correctly, it knocks out negative emotions and stress, clears your mind and body in a way that’s difficult to describe.

    Anyway that was great. After some breathwork I generally need to rest – it’s called ‘work’ for a reason and you need to let your body settle. Then off to families for a sunday roast.

    I’d recently been worrying that I hadn’t done enough over the last two weeks – a crisis of confidence was starting to dawn. But actually I’ve considered everything and given my current situation and capabilities, I’ve had a great 17 days since making the decision to motor forward and build an AI startup.

    Not going to post this on LinkedIn.

  • Day 17

    Day 17

    Today, main things:

    • Spent time looking into USA taxes … learnt quite a lot and realised that I’m going to drop Laravel Spark in favour of being able to use Stripe Tax
    • The rest of today’s work time was spent tightening up my value proposition and planned business model more, with the output being on the website. I wasn’t happy with the current incarnation of it, but I think i’m in a better place now. Will have to wait to see what the group thinks. Most of this was done in conversation with ChatGPT, my own thinking and a good conversation with my potential business partner.

    Being clear about the value

    I’m now able to communicate a lot clearer the general advantages that AI offers, and that’s crucial for an agency to be able to do before making their offering.

    I have broken the value of AI for companies down to 7 areas:

    1. Virtual Agents
    2. Automation
    3. Lead Generation
    4. Content Creation
    5. New capabilities
    6. Talking to your data
    7. All encompassing Virtual Assistants

    Life Stuff

    It’s Saturday 1st March 2025, and we had great blue skies today in Norwich. The grey winter was a long one, so it’s good to finally see the light.

    One thing I’m absolutely determined to stick to even when building this AI Company is making sure I get out and about for adventures. Life really isn’t about making money and building businesses. A lot of the time it’s egoic human mind busyness, and really, life isn’t about that. There’s so much more.

    But for those who for some reason, love the tech world, and are drawn to it naturally … we can easily lose years and decades staring at the screens. And it’s really not worth it. You don’t want to spend your entire career focused on making millions, only to make that target later in life and to realise that your real wealth – your time – has slipped away never to return.

    It’s true what they say that life goes fast, but you are completely ignorant of it when young. It’s also true that you never know which day is going to be your last.

    With that said, it’s so important to force yourself to make time to plan out adventures – of whatever scale – and then to actually do them. So I got myself out for a walk around the city today.

  • Day 17 – Work Diary #7 – Understanding Taxes, SaaS Taxes, US State Taxes, etc

    The big thing right now is pushing the Stripe integration over the line. Once I’ve done that I can start taking payments from customers and begin that process.

    Because I potentially have a US customer, I took a look at tax requirements. I didn’t realise it was so complex to sell to the US. Each state has differing rules, but in the main it sounds like the threshold is $100,000 over 12 months at which point you have to register with the state for taxes, and start paying them.

    Currently my offering is not a SaaS product, but that’s the plan in the future. At the moment I am doing effectively technical services to companies i.e. consultancy and software development – customers retain a set number of consultancy & development hours each month.

    US Tax Is Complex!

    I didn’t realise US taxes were so complicated. Sales tax is due to each state individually:

    In most states, the threshold for economic nexus is $100,000 in sales or 200 transactions over 12 months. There are exceptions, though; for example, in Texas and California the threshold is $500,000.

    Although SaaS products count as digital products, they often have unique regulations because they’re not necessarily downloaded. For example, SaaS sales are 100% taxable in Connecticut but non-taxable in California. And in Texas, SaaS products are taxed at 80% of the sale price, while downloaded software is fully taxed. See where SaaS is considered taxable

    Stripe Tax will deal with it all, but Spark doesn’t support it

    Whilst Stripe Tax seems to be the solution, which is great, I have a decision to make about Laravel Spark … this was the package I was going to use to manage subscriptions and had bought a licence for. However it doesn’t support Stripe Tax, which I think is a big negative.

    Spark does not currently support Stripe Tax. You should disable Stripe Tax via your Stripe dashboard when using Spark.

    https://spark.laravel.com/docs/spark-stripe/taxes#taxes

    This is a big issue, since I would be much happier using Stripe Tax to manage everything. It’s really annoying but my fault for not properly reviewing Spark’s docs.

    I’m probably over thinking it at the moment. The options are:

    • Keep Spark, switch of Stripe Tax, and let Spark deal with the taxes. Whilst Spark has probably done a great job, I wouldn’t trust them as much as I would Stripe. I would prefer to get this right now, as I don’t want to have to reverse six months down the line.
    • Get rid of Spark for this particular project and integrate Stripe Checkout instead. I’m not going to lose much time right now, so it’s not a big problem. There’s potentially another UK based project that I could use it for absolutely fine.

    The best thing to do at this point would be to remove Spark entirely from the system (I wasn’t liking the interface anyway) and rely on Stripes subscription handler, which would take care of the taxes. I won’t lose much time by making the switch now, and it would allow me to take instant payments this week.

    Some Interesting Stripe Guide On Taxation

    Also, this image below shows where SaaS products are liable for tax:

  • Day 16 – NorDevCon – Norfolk’s Tech Conference

    Day 16 – NorDevCon – Norfolk’s Tech Conference

    I decided to spend most of the day at the NorDevCon tech conference. It’s difficult to know where to put your time sometimes, but I’m glad I went. NorDevCon is managed by Alex Scotton who I have worked with on some projects over last few years, and I get on well with him.

    Some of the talks were too much of a technical niche for me; but I caught up on emails, wrote some notes and pottered about on the flutter app I’m building that will interface with the main laravel system; and the automation systems like n8n.

    The main takeaways were:

    1 – A talk by Onyi Anyado reinforced getting beyond fears, and executing with speed. Speed is the key thing in what I’m trying to do here, and I need to get a lot, lot faster than I am. Speed and consistency over valuable tasks

    2 – A talk by Paul Grenyer reinforced the point that I am going to have to get used to delegating and not doing it all myself. I can do a lot with Claude + Cursor, but I’m still going to need to trust in other people to do the things that need to get done.

    3 – It’s been worthwhile doing these LinkedIn posts. I’ve only been using LI for a few weeks properly, and my connections are pretty much only people I know in the real world, but I was somewhat shocked by how many people had seen that I was doing something with an AI startup. It’s clear my posts are coming up in peoples feeds and that’s a really good beginning of momentum.

    (EDIT NEW) 4 – I forgot there was a really good mobile app talk, and I will expand on that in the future. But talked about app testing, kill switches, app feedback feature, phased rollout and crashlytics.

    Now have to catch up with things, so that’s it for today.

  • Day 15 – Beginning Systems

    Day 15 – Beginning Systems

    Today I flicked between Google Startup School, a local tech conference and a fairly major sales call. And did some refactoring of my mobile app which will link up to an LLM eventually.

    It’s been two weeks and a fairly manic one at that. Initially I had planned to watch loads of AI tutorials & play with AI for three months before even doing anything else.

    In actual fact I’ve found myself focusing on the business actions:

    • Having conversations with potential business partners
    • Running through ideas and looking at current AI Startups
    • Making my first YouTube videos
    • Putting together a website with dashboard and stripe integration
    • Talking to my first few potential customers
    • Working on the existing AI platform attempting to get it running
    • Posting my thoughts every day on this website, and linking to it from LinkedIn

    But how much ‘AI’ have I actually done? Well, of course I use it all the time throughout the day. Claude cleans up my frontend, and ChatGPT helps me navigate through the other bits. It’s scary how little I use Google now, although I do find that StackOverflow is still super useful and often the last resort I goto; it’s a shame that they have been massively negatively affected by AI. I’m sure they will figure out a way forward.

    But in term’s of actual AI R&D, I haven’t been doing enough, and I’m going to make amends for that. The plan was to link up the dashboard once that’s up and running, and I’m close to that, but I need to be motoring forward a lot faster.

    End Of Sprint 1

    Although I hadn’t really planned anything out for the first sprint, my strategy had pretty much been just to jump in and get started. I knew that there’s really only two options for me:

    • Make web products that take advantage of the new AI tooling that provide value
    • Help others navigate through the world of AI

    This is nothing ground-breaking and is fairly obvious. But I hadn’t planned on getting started with an AI Agency straight away but my gut feeling is that feels like the right way forward. I can supplement the AI focus with my last two decades of professional web dev experience, and by dealing with customers in the field, I have a better idea of the problems they are facing and how AI can solve things for them.

    Of course this is nothing new. I’m sure most web development agencies will make this transition eventually. The difference for me is I had got bored of the idea of running purely a web development agency, and AI was this bright and shiny ‘new thing’ that is genuinely transformative. I was around when the Internet was just taking off, and missed some opportunities due to not having mentors and good advice around me when I was struggling… so I’m in a better position now to assess what to do at this point.

    Point is, I’ve created positive momentum at this point, and that’s the main takeaway. But I want to tweak somewhat.

    Businesses are systems

    If you can’t describe what you are doing as a process, you don’t know what you’re doing. —W. EDWARDS DEMING,

    Kaufman, Josh. The Personal MBA (p. 165). Penguin Books Ltd. Kindle Edition.

    Essentially, a system is a set of repeatable processes that produce a result. It’s similar to a plan, but this is a plan that is meant to be repeated, over and over, tweaked where necessary.

    All successful entities use systems to hone their craft, and if you are getting over worked, it’s a good idea to think about how you can systemise your business from the ground-up.

    The amount of jobs I’ve gone into where it’s basically just ‘get on with it’ and for most situations this gets the job done albeit really inefficiently. Employees at companies I’ve worked at never have a daily system and that’s why management and upper management get so fixated on reports and metrics in order to understand a complete mess of a system in the first place!

    There’s a really good book called the E-Myth which positions the turn-key franchise model as the most successful businesses out there. Franchise owners can buy into the business and because there’s a clear plan for how everything operates, they normally generate profits. Franchises are drivers in how America accelerated and how globalisation began.

    So the challenge is to work out actions the needs to take each cycle. A cycle can be a anything from 24 to 72 hrs. Whatever you want really.

    Fortunately, business has already been mapped out pretty well, and one of the components is to do some sort of R&D concerning your business. I think a lot of people miss this, since it’s not immediate payoffs, but when you are a few years down the road, if you aren’t researching and retooling, you eventually get left behind.

    • Every day I need to be increasing my knowledge of the industry, but in a valuable way. This is likely going to be watching Y Combinator startup school, or YouTubes of AI tooling being used. So everyday I will allocate a set amount of time to ensuring this gets done, I’ll throw it on my blog at least, and if it’s really good I’ll add to my social feeds. What I like to do these days with YouTube is to copy all the transcript and run it through an LLM so I can summarise the best bits.
    • Every day I need to be practically working with tooling, and where appropriate making content on it. The main focus here is catching up with the latest AI stuff and practically implementing it. I’ve had a list of YouTube videos to watch for a while now, and other things have taken priority.

    The Challenge Of AI

    The challenge most startups face will be the ability of others to replicate your product; and for the deep funded companies they will be able to do so almost immediately. This is somewhat frustrating. At least when the internet was born, it was fairly open territory. AI there is already the tech establishment and they are going full pace at it. But you have to get beyond that, keep going and look for the opportunites that can work for you; and are harder for big companies to get excited about. The main strength you have as a startup is your ability to be nimble.

    Some Interesting YouTube Videos

    So below I am going to list some YouTube videos (Thanks to Ollie & Toby for passing these on)

    Other Resources

    https://www.stagehand.dev

  • Day 14 – Two Weeks Gone. Lot’s done But It’s Never Enough. Need AI + Humans To Scale.

    Day 14 – Two Weeks Gone. Lot’s done But It’s Never Enough. Need AI + Humans To Scale.

    I’ve done a lot over the last two weeks and even had my first sales call today. I do love talking to people as an SME service business; you meet all sorts of good quality down to earth people. Dealing with large corporates can be more lucrative, but you tend to miss the human component.

    Going to leave it there for today. Sometimes your eyes and brain melt and that’s when its time for sleep.

    Off to the NorDevCon tech conference in Norwich tomorrow; and have to catch up on Google Startup School, … and I’m almost there on my dashboard signup system.

    Cheers

  • Day 13 – Startup School, Second YouTube Video, Some Sunshine and Hoping to find a Sales Partner

    Day 13 – Startup School, Second YouTube Video, Some Sunshine and Hoping to find a Sales Partner

    Sunshine!

    If you haven’t lived in England or similar you won’t know what it’s like to live under grey clouds 95% of the time for five months. But that’s what we’ve had and today we got blue skies and sunshine. Winter is starting to break. Which is great. Good to go for a run out.

    Google Startup School

    Started Google’s Startup School today. It’s exactly what I needed to find at this stage, so whilst it’s only six weeks of two days per week, it should give me a good starting point, and I’ll be able to share some of my findings.

    It’s going to be a bit of a time investment, but with a bit of effort I am going to be better versed in Google AI Studio, Vertex AI and Gemini. I will still go through the other videos that’s on my list, but this may as well be my main focus for the next six weeks.

    This combination of platforms are incredibly powerful and ready to build startups on. I will be able to use these to deliver clients for my AI Agency which is focused on AI Transformations.

    Second YouTube Video

    I’d wanted to do another video for people who have no idea what Cursor is … and no idea how good AI is at programming. Cursor breaks my mind often, and I enjoy making things in it that would take way too long to be practical in a busy life.

    Anyway, I edited it down 50% to 28 minutes, and was in a bit of a rush, and I still haven’t got the audio right yet. But it might be interesting for some people to flick through.

    In it I make a small fun tool that you can put some text on the screen, spin it around, etc and do the same for images.

    Here’s the video:

    Sales Partner

    I can’t do everything myself, so I’m meeting a friend tonight who has started to perfect the art of using AI in getting insane amounts of leads for businesses. I want to see if there’s a partnership there between us.

    Ok, hope you enjoy the video.