Basic Agent flow
Prerequisite
Before running this project, make sure the following are in place:
To run this agent, you'll need a GitHub token (used here as a secret key to access an OpenAI-compatible endpoint):
π Follow these steps:
- Go to GitHub Token Settings https://github.com/settings/tokens
- Click
Generate new token (classic)
- Give it a name
- Select scopes based on what's needed:
- For this sample (as an API key), you typically donβt need any scopes unless the endpoint requires GitHub access.
- Generate the token and copy it β you wonβt see it again.
How to run this project
- Make sure you have python
3.12
installed in your local learning environment. -
You'll need a
.env
file in the root directory with the following:GITHUB_TOKEN=your-access-token-here
[!NOTE] This token is used as an API key to authenticate with the custom OpenAI-compatible endpoint.
Visual Explaination
flowchart TD
A["π§ User Query\ne.g., 'What is 10 - 3?'"] --> B["AgentExecutor\n(LangChain)"]
B --> C["create_openai_tools_agent()\n(LLM + tools + prompt)"]
C --> D1["π§ LLM\nGPT-4.1 API (custom endpoint)"]
C --> D2["π§° Tools\nadd(a, b), subtract(a, b)"]
D1 & D2 --> E["π Final Answer\ne.g., '7'"]