@@ -69,7 +69,8 @@ import asyncio
6969from value import initialize_async
7070
7171async def main ():
72- client = await initialize_async()
72+ # agent_secret is required
73+ client = await initialize_async(agent_secret = " your-agent-secret" )
7374
7475 async def process_data (data : str ) -> str :
7576 print (f " Processing data: { data} " )
@@ -94,9 +95,10 @@ asyncio.run(main())
9495``` python
9596from value import initialize_sync
9697
97- client = initialize_sync()
98+ # agent_secret is required
99+ client = initialize_sync(agent_secret = " your-agent-secret" )
98100
99- with client.action_context(user_id = " user123" ) as ctx:
101+ with client.action_context(user_id = " user123" , anonymous_id = " anon456 " ) as ctx:
100102 # Your code here
101103 ctx.send(action_name = " my_action" , ** {" custom.attribute" : " value" })
102104```
@@ -108,8 +110,8 @@ Enable automatic tracing for supported AI libraries:
108110``` python
109111from value import initialize_sync, auto_instrument
110112
111- # Initialize the client
112- client = initialize_sync()
113+ # Initialize the client with agent_secret
114+ client = initialize_sync(agent_secret = " your-agent-secret " )
113115
114116# Auto-instrument specific libraries
115117auto_instrument([" gemini" , " langchain" ])
@@ -124,8 +126,8 @@ auto_instrument()
124126from value import initialize_sync, auto_instrument
125127from google import genai
126128
127- # Initialize Value client and auto-instrument
128- client = initialize_sync()
129+ # Initialize Value client with agent_secret and auto-instrument
130+ client = initialize_sync(agent_secret = " your-agent-secret " )
129131auto_instrument([" gemini" ])
130132
131133# Use Gemini as usual - traces are automatically captured
@@ -140,11 +142,10 @@ print(response.text)
140142
141143## Configuration
142144
143- Configure the SDK using environment variables:
145+ The ` agent_secret ` is passed directly to ` initialize_sync() ` or ` initialize_async() ` . Additional configuration can be set using environment variables:
144146
145147| Variable | Description | Default |
146148| ---------------------- | ------------------------------------------ | ----------------------- |
147- | ` VALUE_AGENT_SECRET ` | Agent authentication secret | Required |
148149| ` VALUE_OTEL_ENDPOINT ` | OpenTelemetry collector endpoint | ` http://localhost:4317 ` |
149150| ` VALUE_BACKEND_URL ` | Value Control Plane backend URL | Required |
150151| ` VALUE_SERVICE_NAME ` | Service name for OpenTelemetry resource | ` value-control-agent ` |
@@ -161,8 +162,8 @@ Configure the SDK using environment variables:
161162
162163### Core Functions
163164
164- - ` initialize_sync() ` - Initialize a synchronous Value client
165- - ` initialize_async() ` - Initialize an asynchronous Value client
165+ - ` initialize_sync(agent_secret ) ` - Initialize a synchronous Value client
166+ - ` initialize_async(agent_secret ) ` - Initialize an asynchronous Value client
166167- ` auto_instrument(libraries=None) ` - Enable auto-instrumentation for specified libraries
167168- ` uninstrument(libraries=None) ` - Disable auto-instrumentation
168169- ` get_supported_libraries() ` - Get list of supported library names
0 commit comments