Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions agentops/instrumentation/common/instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def _uninstrument(self, **kwargs):
unwrap(wrap_config)
except Exception as e:
logger.debug(
f"Failed to unwrap {wrap_config.package}."
f"{wrap_config.class_name}.{wrap_config.method_name}: {e}"
f"Failed to unwrap {wrap_config.package}.{wrap_config.class_name}.{wrap_config.method_name}: {e}"
)

# Perform custom unwrapping
Expand All @@ -89,7 +88,7 @@ def _wrap_methods(self):
wrap(wrap_config, self._tracer)
except (AttributeError, ModuleNotFoundError) as e:
logger.debug(
f"Could not wrap {wrap_config.package}." f"{wrap_config.class_name}.{wrap_config.method_name}: {e}"
f"Could not wrap {wrap_config.package}.{wrap_config.class_name}.{wrap_config.method_name}: {e}"
)

@abstractmethod
Expand Down
37 changes: 36 additions & 1 deletion agentops/sdk/decorators/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,21 @@
def __init__(self, *args: Any, **kwargs: Any):
op_name = name or wrapped.__name__
self._agentops_span_context_manager = _create_as_current_span(op_name, entity_kind, version)

self._agentops_active_span = self._agentops_span_context_manager.__enter__()
try:
_record_entity_input(self._agentops_active_span, args, kwargs)
except Exception as e:
logger.warning(f"Failed to record entity input for class {op_name}: {e}")
super().__init__(*args, **kwargs)

def __del__(self):
"""Ensure span is properly ended when object is destroyed."""
if hasattr(self, "_agentops_span_context_manager") and self._agentops_span_context_manager:
try:
self._agentops_span_context_manager.__exit__(None, None, None)
except Exception:
pass

Check warning on line 61 in agentops/sdk/decorators/factory.py

View check run for this annotation

Codecov / codecov/patch

agentops/sdk/decorators/factory.py#L60-L61

Added lines #L60 - L61 were not covered by tests

async def __aenter__(self) -> "WrappedClass":
if hasattr(self, "_agentops_active_span") and self._agentops_active_span is not None:
return self
Expand Down Expand Up @@ -95,6 +102,34 @@
f"@agentops.trace on generator '{operation_name}' creates a single span, not a full trace."
)
# Fallthrough to existing generator logic which creates a single span.

# !! was previously not implemented, checking with @dwij if this was intentional or if my implementation should go in
if is_generator:
span, _, token = tracer.make_span(
operation_name,
entity_kind,
version=version,
attributes={CoreAttributes.TAGS: tags} if tags else None,
)
try:
_record_entity_input(span, args, kwargs, entity_kind=entity_kind)
except Exception as e:
logger.warning(f"Input recording failed for '{operation_name}': {e}")

Check warning on line 117 in agentops/sdk/decorators/factory.py

View check run for this annotation

Codecov / codecov/patch

agentops/sdk/decorators/factory.py#L116-L117

Added lines #L116 - L117 were not covered by tests
result = wrapped_func(*args, **kwargs)
return _process_sync_generator(span, result)
elif is_async_generator:
span, _, token = tracer.make_span(
operation_name,
entity_kind,
version=version,
attributes={CoreAttributes.TAGS: tags} if tags else None,
)
try:
_record_entity_input(span, args, kwargs, entity_kind=entity_kind)
except Exception as e:
logger.warning(f"Input recording failed for '{operation_name}': {e}")

Check warning on line 130 in agentops/sdk/decorators/factory.py

View check run for this annotation

Codecov / codecov/patch

agentops/sdk/decorators/factory.py#L129-L130

Added lines #L129 - L130 were not covered by tests
result = wrapped_func(*args, **kwargs)
return _process_async_generator(span, token, result)
elif is_async:

async def _wrapped_session_async() -> Any:
Expand Down
14 changes: 8 additions & 6 deletions examples/agno/agno_async_operations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,22 @@
"async def demonstrate_async_operations():\n",
" \"\"\"\n",
" Demonstrate concurrent execution of multiple AI agent tasks.\n",
" \n",
"\n",
" This function creates multiple async tasks that execute concurrently rather than sequentially.\n",
" Each task makes an independent API call to the AI model, and asyncio.gather() \n",
" Each task makes an independent API call to the AI model, and asyncio.gather()\n",
" waits for all tasks to complete before returning results.\n",
" \n",
"\n",
" Performance benefit: Instead of 3 sequential calls taking ~90 seconds total,\n",
" concurrent execution typically completes in ~30 seconds.\n",
" \"\"\"\n",
" tracer = agentops.start_trace(trace_name=\"Agno Async Operations Example\",)\n",
" tracer = agentops.start_trace(\n",
" trace_name=\"Agno Async Operations Example\",\n",
" )\n",
"\n",
" try:\n",
" # Initialize AI agent with specified model\n",
" agent = Agent(model=OpenAIChat(id=\"gpt-4o-mini\"))\n",
" \n",
"\n",
" async def task1():\n",
" \"\"\"Query AI about Python programming language.\"\"\"\n",
" response = await agent.arun(\"Explain Python programming language in one paragraph\")\n",
Expand All @@ -113,7 +115,7 @@
"\n",
" # Execute all tasks concurrently using asyncio.gather()\n",
" results = await asyncio.gather(task1(), task2(), task3())\n",
" \n",
"\n",
" for i, result in enumerate(results, 1):\n",
" print(f\"\\nTask {i} Result:\")\n",
" print(result)\n",
Expand Down
1 change: 1 addition & 0 deletions examples/agno/agno_async_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

By using async operations, you can run multiple AI queries simultaneously instead of waiting for each one to complete sequentially. This is particularly beneficial when dealing with I/O-bound operations like API calls to AI models.
"""

import os
import asyncio
from dotenv import load_dotenv
Expand Down
22 changes: 11 additions & 11 deletions examples/agno/agno_basic_agents.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,44 +126,44 @@
"def demonstrate_basic_agents():\n",
" \"\"\"\n",
" Demonstrate basic agent creation and team coordination.\n",
" \n",
"\n",
" This function shows how to:\n",
" 1. Create specialized agents with specific roles\n",
" 2. Organize agents into a team\n",
" 3. Use the team to solve tasks that require multiple perspectives\n",
" \"\"\"\n",
" tracer = agentops.start_trace(trace_name=\"Agno Basic Agents and Teams Demonstration\",)\n",
" tracer = agentops.start_trace(\n",
" trace_name=\"Agno Basic Agents and Teams Demonstration\",\n",
" )\n",
"\n",
" try:\n",
" # Create individual agents with specific roles\n",
" # Each agent has a name and a role that defines its expertise\n",
"\n",
" # News Agent: Specializes in gathering and analyzing news information\n",
" news_agent = Agent(\n",
" name=\"News Agent\", \n",
" role=\"Get the latest news and provide news analysis\", \n",
" model=OpenAIChat(id=\"gpt-4o-mini\")\n",
" name=\"News Agent\", role=\"Get the latest news and provide news analysis\", model=OpenAIChat(id=\"gpt-4o-mini\")\n",
" )\n",
"\n",
" # Weather Agent: Specializes in weather forecasting and analysis\n",
" weather_agent = Agent(\n",
" name=\"Weather Agent\", \n",
" role=\"Get weather forecasts and provide weather analysis\", \n",
" model=OpenAIChat(id=\"gpt-4o-mini\")\n",
" name=\"Weather Agent\",\n",
" role=\"Get weather forecasts and provide weather analysis\",\n",
" model=OpenAIChat(id=\"gpt-4o-mini\"),\n",
" )\n",
"\n",
" # Create a team with coordination mode\n",
" # The \"coordinate\" mode allows agents to work together and share information\n",
" team = Team(\n",
" name=\"News and Weather Team\", \n",
" name=\"News and Weather Team\",\n",
" mode=\"coordinate\", # Agents will coordinate their responses\n",
" members=[news_agent, weather_agent]\n",
" members=[news_agent, weather_agent],\n",
" )\n",
"\n",
" # Run a task that requires team coordination\n",
" # The team will automatically determine which agent(s) should respond\n",
" response = team.run(\"What is the weather in Tokyo?\")\n",
" \n",
"\n",
" print(\"\\nTeam Response:\")\n",
" print(\"-\" * 60)\n",
" print(f\"{response.content}\")\n",
Expand Down
1 change: 1 addition & 0 deletions examples/agno/agno_basic_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
### Coordination Modes
Different strategies for how agents within a team interact and collaborate. The "coordinate" mode enables intelligent task routing and information sharing.
"""

import os
from dotenv import load_dotenv
import agentops
Expand Down
9 changes: 4 additions & 5 deletions examples/agno/agno_research_team.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@
" reddit_researcher = Agent(\n",
" name=\"Reddit Researcher\",\n",
" role=\"Research a topic on Reddit\",\n",
" model=OpenAIChat(id=\"gpt-4o\"), \n",
" tools=[GoogleSearchTools()], \n",
" add_name_to_instructions=True, \n",
" model=OpenAIChat(id=\"gpt-4o\"),\n",
" tools=[GoogleSearchTools()],\n",
" add_name_to_instructions=True,\n",
" instructions=dedent(\n",
" \"\"\"\n",
" You are a Reddit researcher specializing in community insights.\n",
Expand Down Expand Up @@ -186,7 +186,7 @@
" name=\"Academic Paper Researcher\",\n",
" model=OpenAIChat(\"gpt-4o\"),\n",
" role=\"Research academic papers and scholarly content\",\n",
" tools=[GoogleSearchTools(), ArxivTools()], \n",
" tools=[GoogleSearchTools(), ArxivTools()],\n",
" add_name_to_instructions=True,\n",
" instructions=dedent(\n",
" \"\"\"\n",
Expand Down Expand Up @@ -269,7 +269,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"demonstrate_research_team()"
]
}
Expand Down
2 changes: 1 addition & 1 deletion examples/agno/agno_research_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
------------------
- Mode: Collaborative discussion
- Coordination: Team uses GPT-4 for discussion management
- Process:
- Process:
1. Each agent researches independently using their tools
2. Agents share findings and discuss implications
3. Team works towards consensus through structured discussion
Expand Down
3 changes: 0 additions & 3 deletions examples/agno/agno_tool_integrations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,9 @@
" search_type=SearchType.hybrid,\n",
" embedder=CohereEmbedder(\n",
" id=\"embed-v4.0\",\n",
" \n",
" ),\n",
" reranker=CohereReranker(\n",
" model=\"rerank-v3.5\",\n",
" \n",
" ),\n",
" ),\n",
" )\n",
Expand Down Expand Up @@ -153,7 +151,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"demonstrate_tool_integration()"
]
}
Expand Down
1 change: 0 additions & 1 deletion examples/agno/agno_workflow_setup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"demonstrate_workflows()"
]
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file added examples/crew/db/chroma.sqlite3
Binary file not shown.
55 changes: 55 additions & 0 deletions examples/crew/job_posting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
```markdown
**Job Title: Software Engineer**

**Company: AgentOps.ai**

**Location: [Location/Remote]**

**About AgentOps.ai:**
At AgentOps.ai, we are revolutionizing the field of conversational AI by providing robust, scalable, and efficient solutions that ensure seamless integration and optimal performance of AI agents. Our mission is to empower businesses with cutting-edge AI technologies that enhance customer experiences and drive operational efficiency. We believe in fostering a culture of innovation, collaboration, and continuous learning.

**Introduction:**
Are you passionate about building innovative software solutions and enhancing AI agent observability? AgentOps.ai is looking for a skilled Software Engineer to join our dynamic team. In this role, you will have the opportunity to work on groundbreaking projects that involve tracking and analyzing the performance, behavior, and interactions of AI agents in real-time. If you are a detail-oriented problem solver with a desire to create impactful software, we want to hear from you!

**Role Description:**
As a Software Engineer at AgentOps.ai, you will be responsible for designing and building tools and frameworks to automate the development, testing, deployment, and management of services and products. You will play a key role in planning and executing the full software development lifecycle for assigned projects, ensuring scalability and efficiency of distributed software and applications. Collaboration with product managers and user-experience designers will be essential to influence the strategy and delivery of next-wave product features and system capabilities.

**Responsibilities:**
- Design and build tools and frameworks to automate the development, testing, deployment, and management of services and products.
- Plan and execute the full software development lifecycle for each assigned project, adhering to company standards and expectations.
- Plan and scale distributed software and applications using synchronous and asynchronous design patterns.
- Work with product managers and user-experience designers to influence the strategy and delivery of next-wave product features and system capabilities.
- Track, document, and maintain software and network system functionality, leveraging opportunities to improve engineering.

**Required Skills and Qualifications:**
- **Programming Languages:** Proficiency in Java, Python, and C++ is essential.
- **Scripting and Automation:** Strong ability in scripting and test automation.
- **Web Technologies:** Proficiency with HTML5, CSS3, and content management systems.
- **Relational Databases:** Working knowledge of ORM and SQL technologies.
- **Software Development:** Experience with rapid development cycles in a web-based environment, including full software development lifecycle.
- **Frameworks:** Knowledge of frameworks such as Wicket, GWT, and Spring MVC.
- **Engineering Experience:** Five or more years of experience as an engineer of software and networking platforms.
- **Development Experience:** Seven or more years of combined professional and academic experience in relevant programming languages.
- **Documentation:** Proven ability to document design processes, including development, testing, analytics, and troubleshooting.
- **Web Application Development:** Experience in developing web applications with multiple technologies.
- **Network Systems:** Experience in testing and evaluating current networking systems.
- **Collaboration:** Ability to work with global teams to produce project plans and analyze project operations.
- **Problem-Solving:** Highly motivated to find technical issues and fix them with meticulous code.
- **Detail-Oriented:** Focus on creating software and networking platforms free of faulty programming without compromising site reliability.
- **Innovation:** Ability to visualize, design, and develop innovative software platforms.
- **Continuous Learning:** Desire to continue professional growth through training and education.
- **Educational Background:** Bachelor’s degree (or equivalent) in software engineering or information technology.

**Company Benefits:**
- Competitive salary and performance bonuses
- Health, dental, and vision insurance
- Generous paid time off and holidays
- Professional development opportunities
- Collaborative and innovative work environment
- Free sandwiches (yes, you read that right!)

**How to Apply:**
If you are ready to take your career to the next level and join a company that values innovation and excellence, apply today by submitting your resume and cover letter to [email address] with the subject line "Software Engineer Application - [Your Name]". We look forward to meeting you!

**AgentOps.ai is an equal opportunity employer. We celebrate diversity and are committed to creating an inclusive environment for all employees.**
```
Loading
Loading