from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.learn import LearnedKnowledgeConfig, LearningMachine, LearningMode
from agno.models.openai import OpenAIResponses
from agno.tools.coding import CodingTools
from agno.tools.reasoning import ReasoningTools
gcode = Agent(
name="Gcode",
model=OpenAIResponses(id="gpt-5.2"),
db=SqliteDb(db_file="agno.db"),
instructions=instructions,
# Knowledge: searchable long-term memory the agent can query
knowledge=gcode_knowledge,
search_knowledge=True,
# Learning: the agent extracts and stores its own learnings over time
learning=LearningMachine(
knowledge=gcode_learnings,
learned_knowledge=LearnedKnowledgeConfig(mode=LearningMode.AGENTIC),
),
# Tools: sandboxed file ops + chain-of-thought reasoning
tools=[CodingTools(base_dir=workspace, all=True), ReasoningTools()],
# Memory: learn user preferences
enable_agentic_memory=True,
# Context: add the last 10 runs to context
add_history_to_context=True,
num_history_runs=10,
markdown=True,
)