Files
8.-samopisnyy-poiskovyy-age…/README.md
T
kuzakhmetovartur fea117b469
CI / build (3.1) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
feat: solution for '8. Самописный поисковый агент на основе deep agents from scratch'
2026-07-01 13:50:40 +03:00

70 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Deep Agent Search
This project demonstrates a simple search agent built with **LangChain**'s `DeepAgent` and the **OpenAI** language model. The agent can answer user queries and perform web searches when needed.
## Prerequisites
- Node.js 18+ (ES modules support)
- An OpenAI API key. Set it in your environment:
```bash
export OPENAI_API_KEY="your-api-key-here"
```
## Installation
```bash
npm install
```
## Usage
### CLI
Run the agent interactively:
```bash
npm start
```
You will be prompted to enter a question. The agent will respond.
### Programmatic
```js
import { ask } from "./src/index.js";
async function main() {
const answer = await ask("Who wrote 'Pride and Prejudice'?");
console.log(answer);
}
main();
```
## Testing
A simple test script is provided:
```bash
npm test
```
It queries the agent with a sample question and prints the answer.
## Project Structure
- `src/agent.js` Configures the `DeepAgent` with OpenAI LLM and the search tool.
- `src/index.js` Exposes the `ask` function and a CLI demo.
- `test.js` Quick test script.
- `package.json` Project metadata and dependencies.
## Dependencies
- `langchain` Core LangChain library.
- `langchain-openai` OpenAI wrapper for LangChain.
- `langchain-community` Community tools, including the web search tool.
## License
MIT