Skip to content

gregmercer/pi-agent-examples

Repository files navigation

pi-agent

Examples from How to Build a Custom Agent Framework.

Built with the @mariozechner/pi-ai and @mariozechner/pi-agent-core libraries.

Examples

File Description
basics.tsx Simple LLM completion with completeSimple
stream.tsx Streaming LLM response with streamSimple
weather.tsx Agent with a custom tool (mock weather lookup)
session.tsx Agent session via createAgentSession with in-memory SessionManager
assistant.ts Interactive REPL assistant with session persistence, a custom web search tool, and auto context compaction

Running

Files are run with tsx:

npx tsx <filename>

Examples:

npx tsx basics.tsx
npx tsx stream.tsx
npx tsx weather.tsx
npx tsx session.tsx
npx tsx assistant.ts

Prerequisites

Install dependencies:

npm install

About

Examples from [How to Build a Custom Agent Framework](https://nader.substack.com/p/how-to-build-a-custom-agent-framework). Built with the `@mariozechner/pi-ai` and `@mariozechner/pi-agent-core` libraries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors