No project description provided
Project description
sentient - browser controlling agents in 3 lines of code
[beta]
from sentient import sentient
import asyncio
result = asyncio.run(sentient.invoke(goal="play shape of you on youtube"))
setup
-
install sentient
pip install sentient
-
currently, you need to start chrome in dev mode - in a seaparate terminal on the port 9222. use the below commands to start the chrome instance and do necesssary logins if needed
for mac, use command -
sudo /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
to run brave browser (mac) -
sudo /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser --remote-debugging-port=9222 --guest
for linux -
google-chrome --remote-debugging-port=9222
for windows -
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
-
setup open ai api key in a .env file or
export OPENAI_API_KEY="sk-proj-"
-
run the agent
from sentient import sentient
import asyncio
# if you wanna run in a jupyter notebook, uncomment the following two lines :
#import nest_asyncio
#nest_asyncio.apply()
result = asyncio.run(sentient.invoke("play shape of you on youtube"))
- note - by default we use
gpt-4o-2024-08-06
fromopenai
to run sentient as it is the best performing model. you can also use other models likegpt4o
orgpt4o-mini
but the reliabilty may take some hit.
setting custom task specific instructions
you can customise the agent's behaviour by providing natural language descripition of how it should naviagate or what all things it should keep in mind while executing a particualr task. this is helpful in improving the accuracy and reliability of the agent on your specific task.
from sentient import sentient
import asyncio
custom_instructions = """
1. Directly go to youtube.com rather than searching for the song on google!
"""
#use with open ai
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
task_instructions=custom_instructions,
provider="openai",
model="gpt-4o-2024-08-06"))
using providers other than open ai
we currently support a few providers. if you wish to have others included, please create a new issue. you can pass custom instructions in a similar fashion as shown above. you can also refer the cookbook for seeing all examples of using sentient with various providers.
Note - the reliability of agent is dependent on whether the model is able to produce reliable json. we reccommend using open ai's latest gpt4o models for most tasks. claude 3.5 sonnet and some other instruction tuned models are also good. small local models might not produce reliable json - thus leading to failures more often.
using anthropic
-
set API key -
export ANTHROPIC_API_KEY="sk-ant..."
-
pass provider and model options to the invoke command.
#using with anthropic
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
provider="anthropic",
model="claude-3-5-sonnet-20240620"))
using ollama
- ensure the ollama server is on. you just need to pass the name of the model.
#use with ollama
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
provider="ollama",
model="llama3"))
using groq
-
set groq API key -
export GROQ_API_KEY="gsk..."
-
pass provider and model options to the invoke command. NOTE: only llama-3.1-70b-versatile has context window large enough to support the agent. also, the model does not produce reliable outputs. we recommend using groq only for testing purposes.
# use with groq models
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
provider="groq",
model="llama-3.1-70b-versatile"))
using together ai
-
set API key for Together AI -
export TOGETHER_API_KEY="your-api-key"
-
pass provider and model options to the invoke command.
#use with together ai
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
provider="together",
model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo"))
using a custom open ai compatible server
-
you can use this to use any open ai api compatible server (like vllm/ ollama running on a different machine. etc)
-
set API key for your custom server -
export CUSTOM_API_KEY="your-api-key"
. fill in any random value if there is no api key needed. -
pass in the custom base url and model name to the invoke command.
#use with custom server
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
provider="custom",
custom_base_url="http://localhost:8080/v1",
model="model_name"))
using open-router
-
set API key for open router -
export OPENROUTER_API_KEY="your-api-key"
-
we use litellm to call openrouter. so if you want to disable litellm logging -
export LITELLM_LOG="ERROR"
-
pass provider and model options to the invoke command. model name should be passed as openrouter/your-model-name
# use with open-router
result = asyncio.run(sentient.invoke(
goal="play shape of you on youtube",
provider="openrouter",
model="openrouter/anthropic/claude-3.5-sonnet"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sentient-0.1.10.tar.gz
.
File metadata
- Download URL: sentient-0.1.10.tar.gz
- Upload date:
- Size: 52.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e688597d4e7686ca1f09666087c8d782a6208776278abcb970bf5d3bb1144b09 |
|
MD5 | 100dd0f44c098563406ecc5ad4470b15 |
|
BLAKE2b-256 | fc419c496a9815edb4cb42cab492b7cacdab9373776b6cad41c9057302517048 |
File details
Details for the file sentient-0.1.10-py3-none-any.whl
.
File metadata
- Download URL: sentient-0.1.10-py3-none-any.whl
- Upload date:
- Size: 65.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4f937223c195c5e70d47b023683762a1b81f3165a1f45096b6cf2aeca4f958f |
|
MD5 | 63752868fe893ededcb642d117b53700 |
|
BLAKE2b-256 | e87bb22d1db154011e8de66cd9eafed5272ed307184cd40ff9da24f4786cade6 |