Here I will test Agno agent framework.
1. Installation: $ pip install openai agno // You need python version more then 3.10
2. Usage:
from agno.agent import Agent
from agno.models.fireworks import Fireworks
agent = Agent(
model=Fireworks(id="accounts/fireworks/models/deepseek-v3p1", api_key=" "),
markdown=True
)
agent.print_response("Share a 2 sentence horror story.") # Print the response in the terminal
3.1. LanceDb. $ pip install lancedb, tantivy, pypdf
3.1.1. Example of usage
knowledge = Knowledge(
vector_db=LanceDb(
uri="tmp/lancedb",
table_name="recipe_knowledge",
search_type=SearchType.hybrid,
embedder=OpenAIEmbedder(id="text-embedding-3-small"),
),
)
3.1.2. I need API key for OpenAIEmbedder but it is paid one as everething from "open"AI. Thats why I need some really open alternative and local alternative.
3.1.3. Embedder HuggingFaceEmbedder is remote hosted but free. Install with $ pip install sentence-transformers
from agno.embedder.huggingface import HuggingFaceEmbedder
knowledge = Knowledge(
vector_db=LanceDb(
uri="tmp/lancedb",
table_name="recipe_knowledge",
search_type=SearchType.hybrid,
embedder=HuggingFaceEmbedder(model="sentence-transformers/all-MiniLM-L6-v2"),
),
)
3.1.4. OllamaEmbedder. Local embedder. Install $ pip install ollama // This is only ollama client but I have to install ollama server on main system.
from agno.embedder.ollama import OllamaEmbedder
knowledge = Knowledge(
vector_db=LanceDb(
uri="tmp/lancedb",
table_name="recipe_knowledge",
search_type=SearchType.hybrid,
embedder=OllamaEmbedder(),
),
)
3.1.5. FastEmbed is local embedder. To install $ pip install fastembed pylance
from agno.knowledge.embedder.fastembed import FastEmbedEmbedder
knowledge = Knowledge(
vector_db=LanceDb(
uri="tmp/lancedb",
table_name="recipe_knowledge",
search_type=SearchType.hybrid,
embedder=FastEmbedEmbedder(),
),
)
knowledge.add_content(
path="/your-path-here/ThaiRecipes.pdf",
name="Recipes",
metadata={"doc_type": "recipe_book"},
description="Thai recipes"
)
3.2. MongoDB doesn't supports vector functionality.
3.3. Try ChromaDB
knowledge = Knowledge(
name="Basic SDK Knowledge Base",
description="Agno 2.0 Knowledge Implementation with ChromaDB",
vector_db=ChromaDb(
collection="vectors", path="tmp/chromadb", persistent_client=True
),
)
3.4. Get error ModuleNotFoundError: No module named '_sqlite3' because python complied without sqlite and version should be > 3.35
3.4.1. You can reinstall
$ sudo apt install libsqlite3-dev
$ python3 -m venv /home/john/venv-mlagent2 --system-site-packages
3.4.2. Or $ pip install pysqlite3-binary // Doesn't help
3.5. Qdrant database.
1. Install $ curl -fsSL https://ollama.com/install.sh | sh
2. $ ollama serve // run ollama server
2.1. If you use sandbox like google colab use ollama_process = subprocess.Popen(['ollama', 'serve'])
3. Download model $ ollama pull qwen3:8b
4. $ pip install ollama
5. Code
from pprint import pprint
from agno.agent import Agent
from agno.models.ollama import Ollama
agent = Agent(
model=Ollama(id="qwen3:8b"),
markdown=True
)
response = agent.run("What is the meaning of life?")
for chunk in response:
print(chunk.content)
1. $ sudo apt install mysql
2. $ pip install mysqlclient (or something like this)
3. $ pip install mysql-connector-python
4. python code
from agno.db.mysql import MySQLDb
dbs = MySQLDb(db_url="mysql://pmauser:12345@localhost:3306/agno")
agent = Agent(
model=Fireworks(id="accounts/fireworks/models/qwen3-8b", api_key="fw_3Z7r9"),
name="Assistant",
role="Useful assistant",
debug_mode=True,
instructions=dedent("""\
You are an expert in everything like Elon Musk! ????????
\ """),
db=dbs,
tools=[DuckDuckGoTools(), ],
markdown=True,
# To provide the agent with the chat history
# We can either:
# 1. Provide the agent with a tool to read the chat history
# 2. Automatically add the chat history to the messages sent to the model
# 1. Provide the agent with a tool to read the chat history
#read_chat_history=True,
# 2. Automatically add the chat history to the messages sent to the model
session_id="fixed_id_for_demo",
add_history_to_context=True,
# Number of historical responses to add to the messages.
num_history_runs=3,
)
1. Promprt for reasoning:
instructions=dedent("""\
You are an expert problem-solving assistant with strong analytical skills! ????
Your approach to problems:
1. First, break down complex questions into component parts
2. Clearly state your assumptions
3. Develop a structured reasoning path
4. Consider multiple perspectives
5. Evaluate evidence and counter-arguments
6. Draw well-justified conclusions
When solving problems:
- Use explicit step-by-step reasoning
- Identify key variables and constraints
- Explore alternative scenarios
- Highlight areas of uncertainty
- Explain your thought process clearly
- Consider both short and long-term implications
- Evaluate trade-offs explicitly
For quantitative problems:
- Show your calculations
- Explain the significance of numbers
- Consider confidence intervals when appropriate
- Identify source data reliability
For qualitative reasoning:
- Assess how different factors interact
- Consider psychological and social dynamics
- Evaluate practical constraints
- Address value considerations
\"""),
1. When I ask my agent to fill out a form with 5 input fields, the fill_form tool can only process one field per function call. This forces the agent to call the fill tool 5 separate times (once per field). This approach is highly inefficient because:
2. I want my Agno agent to plan all 5 field fills in a single step - generate all selectors and values at once. Execute multiple tool calls without intermediate LLM processing - run the 5 fill operations sequentially without returning to the LLM between operations. Batch validation - only validate the final page state after all fields are filled. This would dramatically reduce token usage by eliminating 4 redundant context transmissions (potentially saving 200K+ tokens per form submission) while maintaining the same functionality.
2.1. How to make five consequent simple tool calls (each of them fills one input) then validate all five. I mean Think -> 1 tool call -> 2 tool call -> 3-th call -> 4th -> 5th -> validate. // That is called multi-tool call support
2.1.1. Try to force agent to make multiple tool calls with system prompt. But not all agent frameworks support this at the time.
# **CRITICAL INSTRUCTION: OUTPUT MULTIPLE TOOL CALLS AT ONCE**
You MUST output ALL tool calls needed to complete a form fill in ONE response.
## **FORMAT FOR MULTI-TOOL OUTPUT:**
```
TOOL_CALL_START
Tool: fill_form
Selector: form#userForm #firstName
Data: John
---
Tool: fill_form
Selector: form#userForm #lastName
Data: Doe
---
Tool: fill_form
Selector: form#userForm input[name="userEmail"]
Data: john@example.com
---
Tool: fill_form
Selector: #gender-radio-1
Data: ""
---
Tool: fill_form
Selector: #userNumber
Data: "1234567890"
---
Tool: click_element
Selector: form#userForm button[type="submit"]
TOOL_CALL_END
```
## **RULES:**
1. Analyze the entire form first (get HTML with open_webpage)
2. Plan ALL 5+ fills in your mind
3. Output ALL tool calls separated by `---`
4. Each tool call must have:
- `Tool: [tool_name]`
- `Selector: [detailed_playwright_selector]`
- `Data: [value]` (for fill_form only)
5. No thinking between tool calls
6. Wait for ALL tools to execute
7. Then validate the result
## **Example Workflow:**
1. `open_webpage("https://demoqa.com/automation-practice-form")`
2. Analyze HTML, plan all fills
3. Output 5+ tool calls at once in the format above
4. All tools execute
5. Validate form completion
## **IMPORTANT:**
- This saves 80% tokens compared to sequential thinking
- Trust your initial analysis
- If a selector fails, the whole batch will be retried
## **Selectors Must Be:**
- Absolute: `form#formId #fieldId`
- Specific: Use full DOM hierarchy
- Unique: Must match exactly one element
NOW: For form filling, output ALL tool calls at once!
3. Contex condenser. Make context smaller, forgetting unnecesary.
4. Semantic Deduplication. Delete close or repeated blocks of text.
5. Context Fine-tuning is the most promissing idea. Human brain like scheme.
Essentially, I need a way to group sequential tool calls into a single logical operation with only one input/output exchange with the LLM.
==================================
client = openai.OpenAI(
api_key=" ",
base_url="https://api.fireworks.ai/inference/v1"
)
response = client.chat.completions.create(
model = 'accounts/fireworks/models/deepseek-v3p1',
messages= [{"role":"user","content":"My prompt is here"}],
temperature=0.7,
max_tokens=4000,
)
print(response.choices[0].message.content)