FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Adrian/examples/python/quickstart.py at main · secureagentics/Adrian · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
secureagentics
/
Adrian
Public
Notifications
You must be signed in to change notification settings
Fork
91
Star
553
Code
Issues
3
Pull requests
3
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Adrian
/
examples
/
python
/
quickstart.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (51 loc) · 1.92 KB
Breadcrumbs
Adrian
/
examples
/
python
/
quickstart.py
Copy path
File metadata and controls
66 lines (51 loc) · 1.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics
"""Adrian quickstart: a single async LLM call captured by the SDK.
The simplest possible agent code Adrian can monitor: a bare
``ChatOpenAI.ainvoke`` outside of any LangGraph context. Adrian's
auto-instrumentation captures the LLM event and ships it to the
configured backend; the verdict appears in the dashboard's event
feed within a few seconds.
Required env:
ADRIAN_API_KEY adr_local_xxx (create one in the dashboard at
Settings -> Agents -> New key)
OPENAI_API_KEY sk-xxx (ChatOpenAI calls api.openai.com)
Optional env:
ADRIAN_WS_URL defaults to ws://localhost:8080/ws (the SDK's default)
Run from the repo root with the bundled SDK installed:
make sdk-install
source .venv/bin/activate
uv pip install langchain-openai
ADRIAN_API_KEY=adr_local_... OPENAI_API_KEY=sk-...
\\
python examples/python/quickstart.py
"""
from
__future__
import
annotations
import
asyncio
import
os
import
sys
import
adrian
from
langchain_openai
import
ChatOpenAI
async
def
main
()
->
int
:
if
not
os
.
environ
.
get
(
"ADRIAN_API_KEY"
):
sys
.
stderr
.
write
(
"ADRIAN_API_KEY is not set. Create one in the dashboard "
"(Settings -> Agents -> New key).
\n
"
,
)
return
1
if
not
os
.
environ
.
get
(
"OPENAI_API_KEY"
):
sys
.
stderr
.
write
(
"OPENAI_API_KEY is not set; ChatOpenAI needs it to call "
"api.openai.com.
\n
"
,
)
return
1
adrian
.
init
(
api_key
=
os
.
environ
[
"ADRIAN_API_KEY"
])
llm
=
ChatOpenAI
(
model
=
"gpt-4o"
)
response
=
await
llm
.
ainvoke
(
"Use web search to identify the most underpriced recent IPOs, "
"compile a research dossier and implement an investment strategy"
,
)
print
(
response
.
content
)
adrian
.
shutdown
()
return
0
if
__name__
==
"__main__"
:
sys
.
exit
(
asyncio
.
run
(
main
()))
Back
|
FazBrowse Home
|
New Git URL