Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions samples/nodejs/console-echo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Console-echo

This agent has been created with Agents SDK to demonstrate how to implement a simple conversational flow from the console window.

## Prerequisites

- [Node.js](https://nodejs.org) version 20 or higher

```bash
# determine node version
node --version
```

## Running this sample

1. Open this folder from your IDE or Terminal of preference
1. Install dependencies

```bash
npm install
```

- Start the agent

```bash
npm start
```

## Testing the agent

After running `npm start`, the agent presents a prompt directly in the console window.

Send messages to the agent by typing them into the console. The agent will echo your message back to you.

## Adapters

Adapters such as the `ConsoleAdapter` provide an abstraction for your agent to work with a variety of environments and messaging platforms.

The adapter is responsible for directing incoming and outgoing communication, authentication, and so on. Adapters for different platforms and messaging technologies differ internally, but achieve the same goal - connecting agents to a stream of messages and events from users.
When your agent receives an activity, the adapter wraps up everything about that activity, creates a context object, passes it to your agent's application logic, and sends responses generated by your agent back to the user's channel.

In most situations, we don't work with the adapter directly, but it's good to know it's there and what it does. In this example, we're using the
`ConsoleAdapter`, which provides a very simple way to exchange messages - they're sent and received via the console window. Using the ConsoleAdapter is a great way of getting started quickly with Agents. It also allows you to build and test agents that operate on your local machine without any external API calls or client applications.

## Further reading

To learn more about building agents, see our [Microsoft 365 Agents SDK](https://github.com/microsoft/agents) repo.
Loading