Making Improvements to AI Agents

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Once you know your performance metrics and how to monitor them, you’ll be in a good position to optimize your AI agent.

Optimizing Prompts

If you aren’t getting the desired output from an LLM, one solution might be to improve your prompt. Study different prompt engineering techniques to guide the LLM toward better answers. Some techniques you should be familiar with are:

Optimizing Efficiency

You can do many things to improve the efficiency of your AI agents in terms of time and resources.

Time

One way to speed up an agent is to perform tasks in parallel rather than sequentially. For example, if two nodes both need to make an LLM call and neither depends on the result of the other, then this is a good candidate for running them in parallel.

O T F R
Lokuursiiy tyekz

M Q U T
Mareybub zlivz

Resources

When you think about optimizing resources, consider how you can reduce token usage. Do you need to send the entire message conversation on every request? Probably not. You noticed in the Lesson 3 and 4 demos that when the screenshot image was converted to Base64, it was a massive text string. The tutorial didn’t have you send the entire message list to the LLM because you wouldn’t upload all those tokens on every request. You only needed the screenshot image when you were generating the contextual comments. After you had those, you no longer needed the image.

Optimizing UX

Step back occasionally and ask yourself what would make the entire experience better for the end user. Perhaps you need to re-architect how the application works. Perhaps you need to use a more powerful model or a better text-to-speech engine. Maybe you need to work on decreasing latency. Don’t be afraid to make big changes or even start over from scratch if your current implementation isn’t working.

See forum comments
Download course materials from Github
Previous: Monitoring Agent Behavior Next: Monitoring & Debugging Demo