A minimal agent that can run in pi on Exe.dev VMs.
Hi there! This repo describes the agent that I use to help me run marketing for Datakami.
Do not run this agent locally. Pi has very little safety measures so it's not usable on your local machine.
For running the agent:
- git
- ssh/scp
- cron
- pi (exe.dev VMs come installed with this)
- exe.dev subscription
- subscription to LLM of your choice (optional, although I haven't run out of Shelley credits yet)
- buffer API key (optional, if you want your agent to publish to Buffer)
- exa API key (optoinal, if you want your agent to be able to do search engine queries using exa.ai)
For automatic backups:
- ssh-keygen
- rsync
- Clone this repository.
git clone git@github.com:jd7h/minimal-agent.git- Write or generate ./agent/README.md that describes the role and tasks of the agent. Here's the prompt that I used to generate this README for my Chief Marketing Officer agent:
## About my company
### What does Datakami do?
Datakami is a software engineering company specialized in generative AI. We help early-stage startups that are building products with generative AI at the core. When their own team hits a technical problem they can't solve (evals, pipelines, infrastructure, deploying open-source models) they call us. We show up like virtual Ghostbusters and break through the problem.
### What kind of clients does Datakami work with?
Startups of all shapes and sizes. We've worked for three co-founders with a prototype and Series C companies with their own ML engineers. So far we've had clients in the US and Europe. The one thing they all have in common: generative AI is at the heart of their product, and they need outside experts to reach the next milestone.
### What kind of problems does Datakami specialize in?
Everything needed to take a generative AI product from prototype to production: architecture, infrastructure, choosing and fine-tuning models, LLM evals, and scaling to serve thousands of users. If your product can't keep up with your users, or you're doing evals for the first time and want to do them right, that's our sweet spot.
### What services does Datakami offer?
Our core service is team embeddings for generative AI engineering. Our specialists join your team a few days per week to solve hard generative AI problems. Examples: building evals, optimizing LLM pipelines, designing infrastructure, fine-tuning models, and deploying open-source models into production.
Apart from that, we offer light-weight options for teams that are earlier in their journey: whiteboard sessions to sketch out what's possible, talks and workshops to upskill your team and help your company invent its own AI use cases, and advisory retainers where you talk to us regularly.
## Task
Datakami has a new Chief Marketing Officer starting next week and I (Judith, CEO) need to give some instructions to them.
My thoughts about the role:
- our target audience is early-stage AI startup founders and their investors, in the US and Europe.
- we need to post more often to the website and LinkedIn than we do now.
- I can probably manage writing a short opinion piece about generative AI per day... but I don't have time to turn these into polished posts
- Coming up with a marketing calendar, a month-long or year-long content plan, a marketing strategy etc, is something I want to hand over to the new CMO
- The CMO needs to help me stick to the target audience of Datakami when doing marketing and outreach
- The more of my outreach tasks the CMO can take over, the better. But never forget, I am the technical expert, the CMO is not.
Draft some instructions I can give to my CMO. Ask me lots of questions to build a shared understanding first, if stuff is not clear from my thoughts above.
- Go over all the files in ./agent/files and customize your agent.
- Fill in your favorite domains in ./agent/files/trusted_domains.txt
- Add a EXA_API_KEY to ./agent/files/search_with_exa.py
- Add a BUFFER_API_KEY to ./agent/files/buffer_access.md if you want the agent to post to Buffer. You can also add other third-party services. Always use a separate key for your bot(s)!
- Fill in the name of the bot in
project-nameanddescriptionin ./agent/pyproject.toml - Tweak the instructions in ./agent/files/email.md. For example, tell your name and role and email address to the bot by filling in [YOUR NAME HERE], [YOUR ROLE HERE], [RECEIVER EMAIL ADDRESS] and [BOT NAME HERE].
- Optional: tweak the prompt given to the agent when it receives a new mail in
./agent/bin/mail-processor.sh. The default prompt is "You've got mail! Check ~/Maildir/cur/unread!"
- Create a new VM at exe.dev Go to https://exe.dev/ > Home > + New, or do:
ssh exe.dev newThe default settings are fine.
Let's imagine your new VM is named pink-partyhat.
- Copy the files in ./agent/ to your new VM. Just put them in the /home/exedev folder. On your local machine:
cd minimal-agent
scp -rv ./agent/* pink-partyhat.exe.xyz:- Turn receiving mail on for the VM:
ssh exe.dev share receive-email pink-partyhat on- Set sending mail to the "owner" policy. This means the VM is only allowed to send email to the owner of the VM (you).
ssh exe.dev share receive-email pink-partyhat --reply-policy=owner- Create a cronjob to wake up your agent. On your VM:
crontab -eIn the crontab editor:
00 8 * * 1-5 pi -p "Do your thing"
30 23 * * 2-6 pi -p "Read today's memories and reflect on them. Tend to your worklog and your wiki."
This means the agent "wakes up" every day at 8:00 UTC to the prompt "Do your thing", and every day at 23:30 UTC to read and process its memories (LLM traces) of that day.
- Turn on the mail processor. Mail is handled by a systemd unit file in ./agent/.config/systemd/user/mail-processor.service. This is a systemd service that automatically processes incoming mail, and wakes up the agent to read that new email.
systemctl --user daemon-reload
systemctl --user enable --now mail-processor.service
systemctl --user start mail-processor.serviceYou can check the state of this service by running:
systemctl --user start mail-processor.service
journalctl --unit=mail-processor --since=todayYour new agent is now running. Try sending it an email at anyprefix@pink-partyhat.exe.xyz.
It's a good idea to set up a cronjob on a different machine to back up your VMs regularly.
First, generate a deploykey:
ssh-keygen -t ed25519 -C "deploy key for pink-partyhat" -f ~/.ssh/id_ed25519_pink_partyhat_deploykey # leave the password emptyAdd an ssh config for your VM to ~/.ssh/config:
Host pink-partyhat-deploy-key
HostName pink-partyhat.exe.xyz
User exedev
IdentityFile /home/someuser/.ssh/id_ed25519_pink_partyhat_deploykey
IdentitiesOnly yes
Tag your VM with something unique, such as #minimal-agent.
Go to exe.dev > VMs > pink-partyhat > Add Tag
or
ssh exe.dev tag pink-partyhat minimal-agentAdd the public key for this keypair to your exe.dev account, for this specific tag. Go to exe.dev > settings > ssh keys > Add SSH Key and choose the tag from the dropdown or:
ssh exe.dev ssh-key add --tag=minimal-agent <public-key>On a different machine than the VM:
mkdir -p exe.dev/pink-partyhat
crontab -eIn the crontab editor:
# rsync backup of pink-partyhat exe.dev container
0 * * * * cd exe.dev/pink-partyhat && rsync -av --exclude=.cache --exclude=.local --exclude=.venv pink-partyhat-deploy-key: . && git add -u && git add -A && DATE=$(date +"\%Y-\%m-\%d \%H:\%M") && git -c "commit.gpgsign=false" commit -m "Update exedev files at $DATE"