🔄 Big News! bazed.ai is now sagentic.ai. Same vision, new name!

Skip to content

Best Practices ​

When developing autonomous agents with Sagentic, following best practices can lead to more efficient, maintainable, and effective solutions. Here are some guidelines to help you build better agents and systems.

Divide and Conquer ​

Break down complex problems into smaller, manageable tasks that can be handled by specialized agents. This approach aligns with the UNIX philosophy of designing programs that do one thing well. It keeps your agents simple, making them easier to understand, debug, and efficient in terms of token usage.

Meticulous Type Definitions ​

Define your types carefully and consistently. Add descriptions and validations to your schemas to ensure clarity and correctness. This practice benefits both developers and LLMs by setting clear expectations and providing a means to self-correct when validations fail.

Limit Tools and Instructions ​

Avoid overloading an agent with too many tools and instructions. An excess of capabilities can confuse the LLM, leading to less effective operation. Aim for a focused set of tools that align with the agent's primary function.

Prevent Loops ​

Design your agents to prevent infinite loops, especially when making calls to LLMs. Implement counters or other logic to ensure that agents progress towards a conclusion and do not get stuck in repetitive cycles.

Managing LLM Behavior ​

If an LLM is not performing as expected, consider refining the system prompt or the instructions provided to it. Clear and direct prompts can often guide the LLM back to the desired behavior.

Choose the Right Model ​

Select the most appropriate model for the task at hand. For example, GPT-4 Turbo may be better suited for agents that require decision-making and reasoning, while GPT-3.5 can be more cost-effective for processing large amounts of input.

Use LLMs Strategically ​

Treat LLMs as functions that narrow down large problem spaces into smaller ones that can be managed programmatically. For instance, use an LLM to find an entry point in a large codebase, then handle the rest with traditional programming.

Programmatic Solutions Over LLMs ​

Whenever possible, prefer programmatic solutions over LLMs for tasks that do not require the generative capabilities of an LLM. This can lead to more predictable and efficient outcomes.

Optimize for Token Usage and Cost ​

Be mindful of token usage and cost. Optimize your agents to minimize the number of tokens they consume and the associated costs. This is crucial for maintaining a scalable and economically viable system.

By adhering to these best practices, you can create Sagentic agents and systems that are not only powerful but also practical and sustainable in the long term.

TIP

Want to dive deeper into Sagentic? Have some cool ideas for agents or facing challenges with implementation? Don't worry, we've got you covered! Come join us on Discord and let's figure it out together. Our community is all about collaboration, sharing knowledge, and helping each other create amazing things. See you there!