From 7dc1d9da148501491f99c8e9a8fccd66170af1a5 Mon Sep 17 00:00:00 2001 From: Tony Holdstock-Brown Date: Fri, 22 Nov 2024 09:54:49 -0800 Subject: [PATCH] Add examples --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 0bb0909..2f40c12 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,39 @@ at scale — from single model calls to multi-agent workflows that use tools. Using the SDK lets you focus on AI code instead of technical details like orchestration, state, or infrastructure. +A networked agent: +```ts +// Create a network of agents with separate tasks and instructions +// to solve // a specific task. +const network = new Network({ + agents: [navigator, classifier, summarizer], + defaultModel: openai({ model: "gpt-4o", step }), +}) + +const input = `Classify then summarize the latest 10 blog posts + on https://www.deeplearning.ai/blog/` + +const result = await network.run(, ({ network }) => { + // Use an agent which figures out the specific agent to call + // based off of the network's history. + return defaultRoutingAgent; +}); +``` + +A simple agent: +```ts +const writer = new Agent({ + name: "writer", + system: "You are an expert writer. You write readable, concise, simple content.", + model: openai({ model: "gpt-4o", step }), +}); + +const { output } = await writer.run( + "Describe the ideas behind the given input into clear topics, and explain any insight: " + + `${content}` +); +``` + ## Installation Agent kit requires the [Inngest TypeScript SDK](https://github.com/inngest/inngest-js) as a dependency. You can install both via `npm` or similar: