Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 54 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,39 +140,75 @@ Add powerful observability to your agents, tools, and functions with as little c
Refer to our [documentation](http://docs.agentops.ai)

```python
# Automatically associate all Events with the agent that originated them
from agentops import track_agent
# Create a session span (root for all other spans)
from agentops.sdk.decorators import session

@track_agent(name='SomeCustomName')
class MyAgent:
...
@session
def my_workflow():
# Your session code here
return result
```

```python
# Automatically create ToolEvents for tools that agents will use
from agentops import record_tool
# Create an agent span for tracking agent operations
from agentops.sdk.decorators import agent

@record_tool('SampleToolName')
def sample_tool(...):
...
@agent
class MyAgent:
def __init__(self, name):
self.name = name

# Agent methods here
```

```python
# Automatically create ActionEvents for other functions.
from agentops import record_action
# Create operation/task spans for tracking specific operations
from agentops.sdk.decorators import operation, task

@agentops.record_action('sample function being record')
def sample_function(...):
...
@operation # or @task
def process_data(data):
# Process the data
return result
```

```python
# Manually record any other Events
from agentops import record, ActionEvent
# Create workflow spans for tracking multi-operation workflows
from agentops.sdk.decorators import workflow

record(ActionEvent("received_user_input"))
@workflow
def my_workflow(data):
# Workflow implementation
return result
```

```python
# Nest decorators for proper span hierarchy
from agentops.sdk.decorators import session, agent, operation

@agent
class MyAgent:
@operation
def nested_operation(self, message):
return f"Processed: {message}"

@operation
def main_operation(self):
result = self.nested_operation("test message")
return result

@session
def my_session():
agent = MyAgent()
return agent.main_operation()
```

All decorators support:
- Input/Output Recording
- Exception Handling
- Async/await functions
- Generator functions
- Custom attributes and names

## Integrations 🦾

### OpenAI Agents SDK 🖇️
Expand Down