@@ -11,12 +11,14 @@ The Gradient™ Agent Development Kit (ADK) is a comprehensive toolkit for build
1111## Features
1212
1313### 🛠️ CLI (Command Line Interface)
14+
1415- ** Local Development** : Run and test your agents locally with hot-reload support
1516- ** Seamless Deployment** : Deploy agents to DigitalOcean with a single command
1617- ** Evaluation Framework** : Run comprehensive evaluations with custom metrics and datasets
1718- ** Observability** : View traces and runtime logs directly from the CLI
1819
1920### 🚀 Runtime Environment
21+
2022- ** Framework Agnostic** : Works with any Python framework for building AI agents
2123- ** Automatic LangGraph Integration** : Built-in trace capture for LangGraph nodes and state transitions
2224- ** Custom Decorators** : Capture traces from any framework using ` @trace ` decorators
@@ -40,6 +42,7 @@ gradient agent init
4042```
4143
4244This creates a new agent project with:
45+
4346- ` main.py ` - Agent entrypoint with example code
4447- ` agents/ ` - Directory for agent implementations
4548- ` tools/ ` - Directory for custom tools
@@ -77,7 +80,7 @@ gradient agent evaluate \
7780LangGraph agents automatically capture traces for all nodes and state transitions:
7881
7982``` python
80- from gradient_adk import entrypoint
83+ from gradient_adk import entrypoint, RequestContext
8184from langgraph.graph import StateGraph
8285from typing import TypedDict
8386
@@ -92,11 +95,11 @@ async def llm_call(state: State) -> State:
9295 return state
9396
9497@entrypoint
95- async def main (input : dict , context : dict ):
98+ async def main (input : dict , context : RequestContext ):
9699 graph = StateGraph(State)
97100 graph.add_node(" llm_call" , llm_call)
98101 graph.set_entry_point(" llm_call" )
99-
102+
100103 graph = graph.compile()
101104 result = await graph.ainvoke({" input" : input .get(" query" )})
102105 return result[" output" ]
@@ -107,7 +110,7 @@ async def main(input: dict, context: dict):
107110For frameworks beyond LangGraph, use trace decorators to capture custom spans:
108111
109112``` python
110- from gradient_adk import entrypoint, trace_llm, trace_tool, trace_retriever
113+ from gradient_adk import entrypoint, trace_llm, trace_tool, trace_retriever, RequestContext
111114
112115@trace_retriever (" vector_search" )
113116async def search_knowledge_base (query : str ):
@@ -127,7 +130,7 @@ async def calculate(x: int, y: int):
127130 return x + y
128131
129132@entrypoint
130- async def main (input : dict , context : dict ):
133+ async def main (input : dict , context : RequestContext ):
131134 docs = await search_knowledge_base(input [" query" ])
132135 result = await calculate(5 , 10 )
133136 response = await generate_response(f " Context: { docs} " )
@@ -139,10 +142,10 @@ async def main(input: dict, context: dict):
139142The runtime supports streaming responses with automatic trace capture:
140143
141144``` python
142- from gradient_adk import entrypoint
145+ from gradient_adk import entrypoint, RequestContext
143146
144147@entrypoint
145- async def main (input : dict , context : dict ):
148+ async def main (input : dict , context : RequestContext ):
146149 # Stream text chunks
147150 async def generate_chunks ():
148151 async for chunk in llm.stream(input [" query" ]):
@@ -190,12 +193,12 @@ gradient agent evaluate \
190193 --success-threshold 80.0
191194```
192195
193-
194196## Tracing
195197
196198The ADK provides comprehensive tracing capabilities to capture and analyze your agent's execution. You can use ** decorators** for wrapping functions or ** programmatic functions** for manual span creation.
197199
198200### What Gets Traced Automatically
201+
199202- ** LangGraph Nodes** : All node executions, state transitions, and edges (including LLM calls, tool calls, and DigitalOcean Knowledge Base calls)
200203- ** HTTP Requests** : Request/response payloads for LLM API calls
201204- ** Errors** : Full exception details and stack traces
@@ -206,7 +209,7 @@ The ADK provides comprehensive tracing capabilities to capture and analyze your
206209Use decorators to automatically trace function executions:
207210
208211``` python
209- from gradient_adk import entrypoint, trace_llm, trace_tool, trace_retriever
212+ from gradient_adk import entrypoint, trace_llm, trace_tool, trace_retriever, RequestContext
210213
211214@trace_llm (" model_call" )
212215async def call_model (prompt : str ):
@@ -226,7 +229,7 @@ async def search_docs(query: str):
226229 return results
227230
228231@entrypoint
229- async def main (input : dict , context : dict ):
232+ async def main (input : dict , context : RequestContext ):
230233 docs = await search_docs(input [" query" ])
231234 result = await calculate(5 , 10 )
232235 response = await call_model(f " Context: { docs} " )
@@ -238,10 +241,10 @@ async def main(input: dict, context: dict):
238241For more control over span creation, use the programmatic functions. These are useful when you can't use decorators or need to add spans for code you don't control:
239242
240243``` python
241- from gradient_adk import entrypoint, add_llm_span, add_tool_span, add_agent_span
244+ from gradient_adk import entrypoint, add_llm_span, add_tool_span, add_agent_span, RequestContext
242245
243246@entrypoint
244- async def main (input : dict , context : dict ):
247+ async def main (input : dict , context : RequestContext ):
245248 # Add an LLM span with detailed metadata
246249 response = await external_llm_call(input [" query" ])
247250 add_llm_span(
@@ -279,17 +282,18 @@ async def main(input: dict, context: dict):
279282
280283#### Available Span Functions
281284
282- | Function | Description | Key Optional Fields |
283- | ----------| -------------| ---------------------|
284- | ` add_llm_span() ` | Record LLM/model calls | ` model ` , ` temperature ` , ` num_input_tokens ` , ` num_output_tokens ` , ` total_tokens ` , ` tools ` , ` time_to_first_token_ns ` |
285- | ` add_tool_span() ` | Record tool/function executions | ` tool_call_id ` |
286- | ` add_agent_span() ` | Record agent/sub-agent executions | — |
285+ | Function | Description | Key Optional Fields |
286+ | ------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
287+ | ` add_llm_span() ` | Record LLM/model calls | ` model ` , ` temperature ` , ` num_input_tokens ` , ` num_output_tokens ` , ` total_tokens ` , ` tools ` , ` time_to_first_token_ns ` |
288+ | ` add_tool_span() ` | Record tool/function executions | ` tool_call_id ` |
289+ | ` add_agent_span() ` | Record agent/sub-agent executions | — |
287290
288291** Common optional fields for all span functions:** ` duration_ns ` , ` metadata ` , ` tags ` , ` status_code `
289292
290293### Viewing Traces
291294
292295Traces are:
296+
293297- Automatically sent to DigitalOcean's Gradient Platform
294298- Available in real-time through the web console
295299- Accessible via ` gradient agent traces ` command
0 commit comments