Skip to content

rinormaloku/agents-intro

Repository files navigation

Build a Full Agent in 3 Small Steps (+ config)

Each step is interactive (blocking) and waits for your input. Ensure OPENAI_API_KEY is set in your environment. Step 4 also reads .env.

Step 1 — step1-agent-loop.ts

Run:

npx tsx src/step1-agent-loop.ts

What it adds:

  • Minimal agent loop with two demo tools (weather, calculator)
  • Sends system prompt + user message + tool list to the LLM
  • Handles tool calls and prints a final response

Step 2 — step2-db.ts

Run:

npx tsx src/step2-db.ts

What it adds:

  • Memory via LowDB: stores all messages (system, user, assistant, tool)
  • Resends the full conversation each turn to maintain context
  • Conversation management: continue, list, switch, or start new

Step 3 — step3-mcp.ts

Run:

npx tsx src/step3-mcp.ts

What it adds:

  • MCP client: discovers and uses external tools (e.g., bash-mcp)
  • Combines built-in tools with MCP tools seamlessly
  • Executes tool results and feeds them back to the LLM

Step 4 — step4-declarative-agents.ts

Run:

npx tsx src/step4-declarative-agents.ts

What it adds:

  • External agent.yaml configuration defines agent behavior
  • System prompt, tools, and MCP servers are all configurable
  • Quick feedback loop: change config and run!

That’s the progression: start with the loop (Step 1), add memory (Step 2), add external tools (Step 3), then move configuration out of code (Step 4) and you have your own Declarative Agentic Framework.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors