Skip to content

Instantly share code, notes, and snippets.

View orarbel's full-sized avatar

Or Arbel orarbel

View GitHub Profile
Hi LinkedIn friend!
Here is how I managed to have the agent I'm building reduce token usage.
1. My agent has 62 tools (and growing quickly in terms of number of tools..)
2. Each tool has a description. All in all I was sending the entire 62 tools+description in every agent turn.
It came out to 10k tokens before even the system prompt+user prompt - ON EVERY TURN.
The solution I found was to do a preflight LLM request to select only the relevant tools for the user request.
import time
import pytest
from langchain.agents import initialize_agent, AgentType
from langchain.agents.agent import AgentExecutor
from langchain.tools import Tool
from langchain_community.llms import OpenAI
from langchain.prompts import PromptTemplate
from langgraph.prebuilt import create_react_agent
# Agno imports
from agno.agent.agent import Agent
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.Map.Entry;
public class CourseRegister implements Runnable {
boolean debug = false;
Yo all the users that Yo'ed your Yo service ("subscribers"):
curl --data "api_token=<token>" http://api.justyo.co/yoall/
---------------------------------------------------------------------
Specific user Yo:
curl --data "api_token=<token>&username=<username>" http://api.justyo.co/yo/