Getting Started¶
Welcome to CogniCoreAI! This guide will walk you through the entire process of installing the framework, setting up your environment, and running your first intelligent agent in just a few minutes.
Step 1: Installation¶
CogniCoreAI is available on PyPI and can be installed with any modern Python package manager. We recommend uv, which is used for the development of CogniCoreAI itself.
uv pip install cognicoreai
Step 2: Set Your OpenAI API Key¶
To power its reasoning, the agent needs to connect to an LLM. By default, it uses OpenAI. You must provide your API key for this to work.
The most secure and recommended way is to set an environment variable named OPENAI_API_KEY.
On Windows (Command Prompt):
set OPENAI_API_KEY=sk-YourSecretKeyHere
On macOS / Linux:
export OPENAI_API_KEY=sk-YourSecretKeyHere
The agent will automatically detect and use this environment variable.
Step 3: Create and Run Your First Agent¶
Now you’re ready to write some code! Create a new Python file (e.g., run_agent.py) and add the following:
1from cognicoreai import Agent, OpenAI_LLM, VolatileMemory, CalculatorTool
2
3def main():
4 """Sets up and runs a simple conversational agent."""
5 print("Initializing agent...")
6
7 # 1. Assemble the agent's components
8 # The LLM provides the reasoning capabilities.
9 llm = OpenAI_LLM()
10
11 # The memory stores the conversation history.
12 memory = VolatileMemory()
13
14 # Tools give the agent new abilities.
15 tools = [CalculatorTool()]
16
17 # 2. Create the Agent instance with a system prompt
18 agent = Agent(
19 llm=llm,
20 memory=memory,
21 tools=tools,
22 system_prompt="You are Cogni, a helpful assistant with a calculator."
23 )
24
25 print("Agent is ready! Ask a math question or say hello.")
26 print("Type 'exit' to end the session.\n")
27
28 # 3. Start an interactive chat loop
29 while True:
30 user_input = input("You: ")
31 if user_input.lower() == 'exit':
32 break
33
34 response = agent.chat(user_input)
35 print(f"Cogni: {response}\n")
36
37if __name__ == "__main__":
38 main()
Step 4: Interact with Your Agent¶
Save the file and run it from your terminal:
python run_agent.py
You can now have a conversation. Try asking it a question that requires a tool:
You: What is 256 divided by 8?
Cogni: 256 divided by 8 is 32.0.
Congratulations, you have successfully built and run your first agent with CogniCoreAI!
Next Steps¶
Now that you have a basic agent running, explore the rest of the documentation to learn more:
User Guide: To understand the core concepts behind how the agent works.
How-To Guides: For practical recipes to solve common problems.